diff --git a/sdk/resourcemanager/compute/armcompute/CHANGELOG.md b/sdk/resourcemanager/compute/armcompute/CHANGELOG.md index 836f84817b78..e36756f31b4f 100644 --- a/sdk/resourcemanager/compute/armcompute/CHANGELOG.md +++ b/sdk/resourcemanager/compute/armcompute/CHANGELOG.md @@ -1,5 +1,11 @@ # Release History +## 5.6.0 (2024-02-01) +### Features Added + +- New field `VirtualMachineID` in struct `GalleryArtifactVersionFullSource` + + ## 5.5.0 (2024-01-26) ### Features Added diff --git a/sdk/resourcemanager/compute/armcompute/autorest.md b/sdk/resourcemanager/compute/armcompute/autorest.md index 3e856c7d295f..bd14b14ad455 100644 --- a/sdk/resourcemanager/compute/armcompute/autorest.md +++ b/sdk/resourcemanager/compute/armcompute/autorest.md @@ -5,9 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/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: 5.5.0 -tag: package-2023-10-02 +module-version: 5.6.0 ``` 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 4f2f10d3afdf..000000000000 --- a/sdk/resourcemanager/compute/armcompute/availabilitysets_client_example_test.go +++ /dev/null @@ -1,634 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package 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/v5" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAvailabilitySetsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AvailabilitySet = armcompute.AvailabilitySet{ - // Name: to.Ptr("myAvailabilitySet"), - // Type: to.Ptr("Microsoft.Compute/availabilitySets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/availabilitySets/myAvailabilitySet"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.AvailabilitySetProperties{ - // PlatformFaultDomainCount: to.Ptr[int32](2), - // PlatformUpdateDomainCount: to.Ptr[int32](20), - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Classic"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/availabilitySetExamples/AvailabilitySet_Update_MaximumSet_Gen.json -func ExampleAvailabilitySetsClient_Update_availabilitySetUpdateMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAvailabilitySetsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AvailabilitySet = armcompute.AvailabilitySet{ - // Name: to.Ptr("myAvailabilitySet"), - // Type: to.Ptr("Microsoft.Compute/availabilitySets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/availabilitySets/myAvailabilitySet"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "key2505": to.Ptr("aa"), - // "key9626": to.Ptr("aaaaaaaaaaaaaaaaaaaa"), - // }, - // 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}"), - // }, - // 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}()), - // }}, - // VirtualMachines: []*armcompute.SubResource{ - // { - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }}, - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Classic"), - // Capacity: to.Ptr[int64](29), - // Tier: to.Ptr("aaaaaaaaaaaaaa"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/availabilitySetExamples/AvailabilitySet_Update_MinimumSet_Gen.json -func ExampleAvailabilitySetsClient_Update_availabilitySetUpdateMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAvailabilitySetsClient().Update(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaa", armcompute.AvailabilitySetUpdate{}, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AvailabilitySet = armcompute.AvailabilitySet{ - // Location: to.Ptr("westus"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/availabilitySetExamples/AvailabilitySet_Delete_MaximumSet_Gen.json -func ExampleAvailabilitySetsClient_Delete_availabilitySetDeleteMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewAvailabilitySetsClient().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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/availabilitySetExamples/AvailabilitySet_Delete_MinimumSet_Gen.json -func ExampleAvailabilitySetsClient_Delete_availabilitySetDeleteMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewAvailabilitySetsClient().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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/availabilitySetExamples/AvailabilitySet_Get_MaximumSet_Gen.json -func ExampleAvailabilitySetsClient_Get_availabilitySetGetMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAvailabilitySetsClient().Get(ctx, "rgcompute", "aaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AvailabilitySet = armcompute.AvailabilitySet{ - // Name: to.Ptr("myAvailabilitySet"), - // Type: to.Ptr("Microsoft.Compute/availabilitySets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/availabilitySets/myAvailabilitySet"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "key2505": to.Ptr("aa"), - // "key9626": to.Ptr("aaaaaaaaaaaaaaaaaaaa"), - // }, - // 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}"), - // }, - // 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}()), - // }}, - // VirtualMachines: []*armcompute.SubResource{ - // { - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }}, - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Classic"), - // Capacity: to.Ptr[int64](29), - // Tier: to.Ptr("aaaaaaaaaaaaaa"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/availabilitySetExamples/AvailabilitySet_Get_MinimumSet_Gen.json -func ExampleAvailabilitySetsClient_Get_availabilitySetGetMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAvailabilitySetsClient().Get(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AvailabilitySet = armcompute.AvailabilitySet{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/rgcompute/providers/Microsoft.Compute/availabilitySets/myAvailabilitySet"), - // Location: to.Ptr("westus"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAvailabilitySetsClient().NewListBySubscriptionPager(&armcompute.AvailabilitySetsClientListBySubscriptionOptions{Expand: to.Ptr("virtualMachines\\$ref")}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.AvailabilitySetListResult = armcompute.AvailabilitySetListResult{ - // Value: []*armcompute.AvailabilitySet{ - // { - // Name: to.Ptr("{availabilitySetName}"), - // Type: to.Ptr("Microsoft.Compute/availabilitySets"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // Location: to.Ptr("australiasoutheast"), - // Properties: &armcompute.AvailabilitySetProperties{ - // PlatformFaultDomainCount: to.Ptr[int32](3), - // PlatformUpdateDomainCount: to.Ptr[int32](5), - // VirtualMachines: []*armcompute.SubResource{ - // { - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}"), - // }}, - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Classic"), - // }, - // }, - // { - // Name: to.Ptr("{availabilitySetName}"), - // Type: to.Ptr("Microsoft.Compute/availabilitySets"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // Location: to.Ptr("australiasoutheast"), - // Properties: &armcompute.AvailabilitySetProperties{ - // PlatformFaultDomainCount: to.Ptr[int32](3), - // PlatformUpdateDomainCount: to.Ptr[int32](5), - // VirtualMachines: []*armcompute.SubResource{ - // { - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}"), - // }}, - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Classic"), - // }, - // }, - // { - // Name: to.Ptr("{availabilitySetName}"), - // Type: to.Ptr("Microsoft.Compute/availabilitySets"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // Location: to.Ptr("westcentralus"), - // Tags: map[string]*string{ - // "{tagName}": to.Ptr("{tagValue}"), - // }, - // Properties: &armcompute.AvailabilitySetProperties{ - // PlatformFaultDomainCount: to.Ptr[int32](3), - // PlatformUpdateDomainCount: to.Ptr[int32](5), - // VirtualMachines: []*armcompute.SubResource{ - // }, - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Classic"), - // }, - // }, - // { - // Name: to.Ptr("{availabilitySetName}"), - // Type: to.Ptr("Microsoft.Compute/availabilitySets"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // Location: to.Ptr("westcentralus"), - // Tags: map[string]*string{ - // "{tagName}": to.Ptr("{tagValue}"), - // }, - // Properties: &armcompute.AvailabilitySetProperties{ - // PlatformFaultDomainCount: to.Ptr[int32](3), - // PlatformUpdateDomainCount: to.Ptr[int32](5), - // VirtualMachines: []*armcompute.SubResource{ - // }, - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Classic"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/availabilitySetExamples/AvailabilitySet_List_MaximumSet_Gen.json -func ExampleAvailabilitySetsClient_NewListPager_availabilitySetListMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAvailabilitySetsClient().NewListPager("rgcompute", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.AvailabilitySetListResult = armcompute.AvailabilitySetListResult{ - // Value: []*armcompute.AvailabilitySet{ - // { - // Name: to.Ptr("{availabilitySetName}"), - // Type: to.Ptr("Microsoft.Compute/availabilitySets"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // Location: to.Ptr("australiasoutheast"), - // Tags: map[string]*string{ - // "key2039": to.Ptr("aaaaaaaaaaaaa"), - // }, - // Properties: &armcompute.AvailabilitySetProperties{ - // PlatformFaultDomainCount: to.Ptr[int32](3), - // PlatformUpdateDomainCount: to.Ptr[int32](5), - // ProximityPlacementGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("aaaaaaaaaaaaaaa"), - // DisplayStatus: to.Ptr("aaaaaaaaaaa"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("aaaaaa"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T13:39:56.427Z"); return t}()), - // }}, - // VirtualMachines: []*armcompute.SubResource{ - // { - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}"), - // }}, - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Classic"), - // Capacity: to.Ptr[int64](22), - // Tier: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"), - // }, - // }, - // { - // Name: to.Ptr("{availabilitySetName}"), - // Type: to.Ptr("Microsoft.Compute/availabilitySets"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // Location: to.Ptr("australiasoutheast"), - // Tags: map[string]*string{ - // "key5849": to.Ptr("aaaaaaaaaaaaaaa"), - // }, - // Properties: &armcompute.AvailabilitySetProperties{ - // PlatformFaultDomainCount: to.Ptr[int32](3), - // PlatformUpdateDomainCount: to.Ptr[int32](5), - // ProximityPlacementGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("aaaaaaaaaaaaaaa"), - // DisplayStatus: to.Ptr("aaaaaaaaaaa"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("aaaaaa"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T13:39:56.427Z"); return t}()), - // }}, - // VirtualMachines: []*armcompute.SubResource{ - // { - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}"), - // }}, - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Classic"), - // Capacity: to.Ptr[int64](23), - // Tier: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // }, - // }, - // { - // Name: to.Ptr("{availabilitySetName}"), - // Type: to.Ptr("Microsoft.Compute/availabilitySets"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // Location: to.Ptr("westcentralus"), - // Tags: map[string]*string{ - // }, - // Properties: &armcompute.AvailabilitySetProperties{ - // PlatformFaultDomainCount: to.Ptr[int32](3), - // PlatformUpdateDomainCount: to.Ptr[int32](5), - // ProximityPlacementGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("aaaaaaaaaaaaaaa"), - // DisplayStatus: to.Ptr("aaaaaaaaaaa"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("aaaaaa"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T13:39:56.427Z"); return t}()), - // }}, - // VirtualMachines: []*armcompute.SubResource{ - // }, - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Classic"), - // Capacity: to.Ptr[int64](26), - // Tier: to.Ptr("aaaaaaaaaaaaaaaaaaaaa"), - // }, - // }, - // { - // Name: to.Ptr("{availabilitySetName}"), - // Type: to.Ptr("Microsoft.Compute/availabilitySets"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // Location: to.Ptr("westcentralus"), - // Tags: map[string]*string{ - // }, - // Properties: &armcompute.AvailabilitySetProperties{ - // PlatformFaultDomainCount: to.Ptr[int32](3), - // PlatformUpdateDomainCount: to.Ptr[int32](5), - // ProximityPlacementGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("aaaaaaaaaaaaaaa"), - // DisplayStatus: to.Ptr("aaaaaaaaaaa"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("aaaaaa"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T13:39:56.427Z"); return t}()), - // }}, - // VirtualMachines: []*armcompute.SubResource{ - // }, - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Classic"), - // Capacity: to.Ptr[int64](6), - // Tier: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/availabilitySetExamples/AvailabilitySet_List_MinimumSet_Gen.json -func ExampleAvailabilitySetsClient_NewListPager_availabilitySetListMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAvailabilitySetsClient().NewListPager("rgcompute", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.AvailabilitySetListResult = armcompute.AvailabilitySetListResult{ - // Value: []*armcompute.AvailabilitySet{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/rgcompute/providers/Microsoft.Compute/availabilitySets/myAvailabilitySet1"), - // Location: to.Ptr("australiasoutheast"), - // }, - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/rgcompute/providers/Microsoft.Compute/availabilitySets/myAvailabilitySet2"), - // Location: to.Ptr("australiasoutheast"), - // }, - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/rgcompute/providers/Microsoft.Compute/availabilitySets/myAvailabilitySet3"), - // Location: to.Ptr("westcentralus"), - // }, - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/rgcompute/providers/Microsoft.Compute/availabilitySets/myAvailabilitySet4"), - // Location: to.Ptr("westcentralus"), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/availabilitySetExamples/AvailabilitySet_ListAvailableSizes_MaximumSet_Gen.json -func ExampleAvailabilitySetsClient_NewListAvailableSizesPager_availabilitySetListAvailableSizesMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAvailabilitySetsClient().NewListAvailableSizesPager("rgcompute", "aaaaaaaaaaaaaaaaaaaa", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.VirtualMachineSizeListResult = armcompute.VirtualMachineSizeListResult{ - // Value: []*armcompute.VirtualMachineSize{ - // { - // Name: to.Ptr("Standard_A1_V2"), - // MaxDataDiskCount: to.Ptr[int32](2), - // MemoryInMB: to.Ptr[int32](2048), - // NumberOfCores: to.Ptr[int32](1), - // OSDiskSizeInMB: to.Ptr[int32](1047552), - // ResourceDiskSizeInMB: to.Ptr[int32](10240), - // }, - // { - // Name: to.Ptr("Standard_A2_V2"), - // MaxDataDiskCount: to.Ptr[int32](4), - // MemoryInMB: to.Ptr[int32](4096), - // NumberOfCores: to.Ptr[int32](2), - // OSDiskSizeInMB: to.Ptr[int32](1047552), - // ResourceDiskSizeInMB: to.Ptr[int32](20480), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/availabilitySetExamples/AvailabilitySet_ListAvailableSizes_MinimumSet_Gen.json -func ExampleAvailabilitySetsClient_NewListAvailableSizesPager_availabilitySetListAvailableSizesMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAvailabilitySetsClient().NewListAvailableSizesPager("rgcompute", "aa", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.VirtualMachineSizeListResult = armcompute.VirtualMachineSizeListResult{ - // } - } -} 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 584c6aa04c9c..000000000000 --- a/sdk/resourcemanager/compute/armcompute/capacityreservationgroups_client_example_test.go +++ /dev/null @@ -1,441 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package 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/v5" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCapacityReservationGroupsClient().CreateOrUpdate(ctx, "myResourceGroup", "myCapacityReservationGroup", armcompute.CapacityReservationGroup{ - Location: to.Ptr("westus"), - Tags: map[string]*string{ - "department": to.Ptr("finance"), - }, - Properties: &armcompute.CapacityReservationGroupProperties{ - SharingProfile: &armcompute.ResourceSharingProfile{ - SubscriptionIDs: []*armcompute.SubResource{ - { - ID: to.Ptr("/subscriptions/{subscription-id1}"), - }, - { - ID: to.Ptr("/subscriptions/{subscription-id2}"), - }}, - }, - }, - Zones: []*string{ - to.Ptr("1"), - to.Ptr("2")}, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CapacityReservationGroup = armcompute.CapacityReservationGroup{ - // Name: to.Ptr("myCapacityReservationGroup"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/CapacityReservationGroups/myCapacityReservationGroup"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "department": to.Ptr("finance"), - // "owner": to.Ptr("myCompany"), - // }, - // Properties: &armcompute.CapacityReservationGroupProperties{ - // SharingProfile: &armcompute.ResourceSharingProfile{ - // SubscriptionIDs: []*armcompute.SubResource{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id1}"), - // }, - // { - // ID: to.Ptr("/subscriptions/{subscription-id2}"), - // }}, - // }, - // }, - // Zones: []*string{ - // to.Ptr("1"), - // to.Ptr("2")}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/capacityReservationExamples/CapacityReservationGroup_Update_MaximumSet_Gen.json -func ExampleCapacityReservationGroupsClient_Update_capacityReservationGroupUpdateMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCapacityReservationGroupsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CapacityReservationGroup = armcompute.CapacityReservationGroup{ - // Name: to.Ptr("myCapacityReservationGroup"), - // Type: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/CapacityReservationGroups/myCapacityReservationGroup"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // }, - // Properties: &armcompute.CapacityReservationGroupProperties{ - // CapacityReservations: []*armcompute.SubResourceReadOnly{ - // { - // ID: to.Ptr("aaaa"), - // }}, - // InstanceView: &armcompute.CapacityReservationGroupInstanceView{ - // CapacityReservations: []*armcompute.CapacityReservationInstanceViewWithName{ - // { - // 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{ - // VirtualMachinesAllocated: []*armcompute.SubResourceReadOnly{ - // { - // ID: to.Ptr("aaaa"), - // }}, - // }, - // Name: to.Ptr("aaaaaaaaaaaaaaaa"), - // }}, - // }, - // VirtualMachinesAssociated: []*armcompute.SubResourceReadOnly{ - // { - // ID: to.Ptr("aaaa"), - // }}, - // }, - // Zones: []*string{ - // to.Ptr("1"), - // to.Ptr("2")}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/capacityReservationExamples/CapacityReservationGroup_Update_MinimumSet_Gen.json -func ExampleCapacityReservationGroupsClient_Update_capacityReservationGroupUpdateMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCapacityReservationGroupsClient().Update(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaa", armcompute.CapacityReservationGroupUpdate{}, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CapacityReservationGroup = armcompute.CapacityReservationGroup{ - // Location: to.Ptr("westus"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/capacityReservationExamples/CapacityReservationGroup_Delete_MaximumSet_Gen.json -func ExampleCapacityReservationGroupsClient_Delete_capacityReservationGroupDeleteMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewCapacityReservationGroupsClient().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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/capacityReservationExamples/CapacityReservationGroup_Delete_MinimumSet_Gen.json -func ExampleCapacityReservationGroupsClient_Delete_capacityReservationGroupDeleteMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewCapacityReservationGroupsClient().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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCapacityReservationGroupsClient().Get(ctx, "myResourceGroup", "myCapacityReservationGroup", &armcompute.CapacityReservationGroupsClientGetOptions{Expand: to.Ptr(armcompute.CapacityReservationGroupInstanceViewTypesInstanceView)}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CapacityReservationGroup = armcompute.CapacityReservationGroup{ - // Name: to.Ptr("myCapacityReservationGroup"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/CapacityReservationGroups/myCapacityReservationGroup"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "{tagName}": to.Ptr("{tagValue}"), - // }, - // Properties: &armcompute.CapacityReservationGroupProperties{ - // CapacityReservations: []*armcompute.SubResourceReadOnly{ - // { - // ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/capacityReservationGroups/myCapacityReservationGroup/capacityReservations/myCapacityReservation1"), - // }, - // { - // ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/capacityReservationGroups/myCapacityReservationGroup/capacityReservations/myCapacityReservation2"), - // }}, - // InstanceView: &armcompute.CapacityReservationGroupInstanceView{ - // CapacityReservations: []*armcompute.CapacityReservationInstanceViewWithName{ - // { - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("ProvisioningState/succeeded"), - // DisplayStatus: to.Ptr("Provisioning succeeded"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // }}, - // UtilizationInfo: &armcompute.CapacityReservationUtilization{ - // CurrentCapacity: to.Ptr[int32](5), - // VirtualMachinesAllocated: []*armcompute.SubResourceReadOnly{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM1"), - // }, - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM2"), - // }}, - // }, - // Name: to.Ptr("myCapacityReservation1"), - // }, - // { - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("ProvisioningState/succeeded"), - // DisplayStatus: to.Ptr("Provisioning succeeded"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // }}, - // UtilizationInfo: &armcompute.CapacityReservationUtilization{ - // CurrentCapacity: to.Ptr[int32](5), - // VirtualMachinesAllocated: []*armcompute.SubResourceReadOnly{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM3"), - // }, - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM4"), - // }}, - // }, - // Name: to.Ptr("myCapacityReservation2"), - // }}, - // SharedSubscriptionIDs: []*armcompute.SubResourceReadOnly{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id1}"), - // }, - // { - // ID: to.Ptr("/subscriptions/{subscription-id2}"), - // }}, - // }, - // SharingProfile: &armcompute.ResourceSharingProfile{ - // SubscriptionIDs: []*armcompute.SubResource{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id1}"), - // }, - // { - // ID: to.Ptr("/subscriptions/{subscription-id2}"), - // }}, - // }, - // }, - // Zones: []*string{ - // to.Ptr("3"), - // to.Ptr("1")}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewCapacityReservationGroupsClient().NewListByResourceGroupPager("myResourceGroup", &armcompute.CapacityReservationGroupsClientListByResourceGroupOptions{Expand: to.Ptr(armcompute.ExpandTypesForGetCapacityReservationGroupsVirtualMachinesRef)}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.CapacityReservationGroupListResult = armcompute.CapacityReservationGroupListResult{ - // Value: []*armcompute.CapacityReservationGroup{ - // { - // Name: to.Ptr("{capacityReservationGroupName}"), - // Type: to.Ptr("Microsoft.Compute/CapacityReservationGroups"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.CapacityReservationGroupProperties{ - // CapacityReservations: []*armcompute.SubResourceReadOnly{ - // { - // ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/capacityReservationGroups/myCapacityReservationGroup/capacityReservations/myCapacityReservation1"), - // }, - // { - // ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/capacityReservationGroups/myCapacityReservationGroup/capacityReservations/myCapacityReservation2"), - // }}, - // VirtualMachinesAssociated: []*armcompute.SubResourceReadOnly{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM1"), - // }, - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM2"), - // }}, - // }, - // }, - // { - // Name: to.Ptr("{capacityReservationGroupName}"), - // Type: to.Ptr("Microsoft.Compute/CapacityReservationGroups"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.CapacityReservationGroupProperties{ - // CapacityReservations: []*armcompute.SubResourceReadOnly{ - // { - // ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/capacityReservationGroups/myCapacityReservationGroup/capacityReservations/myCapacityReservation3"), - // }, - // { - // ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/capacityReservationGroups/myCapacityReservationGroup/capacityReservations/myCapacityReservation4"), - // }}, - // VirtualMachinesAssociated: []*armcompute.SubResourceReadOnly{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM3"), - // }}, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewCapacityReservationGroupsClient().NewListBySubscriptionPager(&armcompute.CapacityReservationGroupsClientListBySubscriptionOptions{Expand: to.Ptr(armcompute.ExpandTypesForGetCapacityReservationGroupsVirtualMachinesRef)}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.CapacityReservationGroupListResult = armcompute.CapacityReservationGroupListResult{ - // Value: []*armcompute.CapacityReservationGroup{ - // { - // Name: to.Ptr("{capacityReservationGroupName}"), - // Type: to.Ptr("Microsoft.Compute/CapacityReservationGroups"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup1/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.CapacityReservationGroupProperties{ - // CapacityReservations: []*armcompute.SubResourceReadOnly{ - // { - // ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup1/providers/Microsoft.Compute/capacityReservationGroups/myCapacityReservationGroup/capacityReservations/myCapacityReservation1"), - // }, - // { - // ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup1/providers/Microsoft.Compute/capacityReservationGroups/myCapacityReservationGroup/capacityReservations/myCapacityReservation2"), - // }}, - // VirtualMachinesAssociated: []*armcompute.SubResourceReadOnly{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup1/providers/Microsoft.Compute/virtualMachines/myVM1"), - // }, - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup1/providers/Microsoft.Compute/virtualMachines/myVM2"), - // }}, - // }, - // }, - // { - // Name: to.Ptr("{capacityReservationGroupName}"), - // Type: to.Ptr("Microsoft.Compute/CapacityReservationGroups"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup2/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.CapacityReservationGroupProperties{ - // CapacityReservations: []*armcompute.SubResourceReadOnly{ - // { - // ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup2/providers/Microsoft.Compute/capacityReservationGroups/myCapacityReservationGroup/capacityReservations/myCapacityReservation3"), - // }, - // { - // ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup2/providers/Microsoft.Compute/capacityReservationGroups/myCapacityReservationGroup/capacityReservations/myCapacityReservation4"), - // }}, - // VirtualMachinesAssociated: []*armcompute.SubResourceReadOnly{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup2/providers/Microsoft.Compute/virtualMachines/myVM3"), - // }}, - // }, - // }}, - // } - } -} 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 e29ee24730a3..000000000000 --- a/sdk/resourcemanager/compute/armcompute/capacityreservations_client_example_test.go +++ /dev/null @@ -1,387 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package 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/v5" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCapacityReservationsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CapacityReservation = armcompute.CapacityReservation{ - // Name: to.Ptr("myCapacityReservation"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/capacityReservationGroups/myCapacityReservationGroup/capacityReservations/myCapacityReservation"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "department": to.Ptr("HR"), - // }, - // Properties: &armcompute.CapacityReservationProperties{ - // PlatformFaultDomainCount: to.Ptr[int32](3), - // ProvisioningState: to.Ptr("Succeeded"), - // ProvisioningTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-27T01:02:38.313Z"); return t}()), - // ReservationID: to.Ptr("{GUID}"), - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Standard_DS1_v2"), - // Capacity: to.Ptr[int64](4), - // }, - // Zones: []*string{ - // to.Ptr("1")}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/capacityReservationExamples/CapacityReservation_Update_MaximumSet_Gen.json -func ExampleCapacityReservationsClient_BeginUpdate_capacityReservationUpdateMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCapacityReservationsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CapacityReservation = armcompute.CapacityReservation{ - // Name: to.Ptr("myCapacityReservation"), - // Type: to.Ptr("aaaaaaaaaaaaaaa"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/capacityReservationGroups/myCapacityReservationGroup/capacityReservations/myCapacityReservation"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // }, - // 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{ - // VirtualMachinesAllocated: []*armcompute.SubResourceReadOnly{ - // { - // ID: to.Ptr("aaaa"), - // }}, - // }, - // }, - // PlatformFaultDomainCount: to.Ptr[int32](3), - // ProvisioningState: to.Ptr("Succeeded"), - // ProvisioningTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-27T01:02:38.313Z"); return t}()), - // ReservationID: to.Ptr("{GUID}"), - // VirtualMachinesAssociated: []*armcompute.SubResourceReadOnly{ - // { - // ID: to.Ptr("aaaa"), - // }}, - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Standard_DS1_v2"), - // Capacity: to.Ptr[int64](4), - // Tier: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaa"), - // }, - // Zones: []*string{ - // to.Ptr("1")}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/capacityReservationExamples/CapacityReservation_Update_MinimumSet_Gen.json -func ExampleCapacityReservationsClient_BeginUpdate_capacityReservationUpdateMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCapacityReservationsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CapacityReservation = armcompute.CapacityReservation{ - // Location: to.Ptr("westus"), - // SKU: &armcompute.SKU{ - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/capacityReservationExamples/CapacityReservation_Delete_MaximumSet_Gen.json -func ExampleCapacityReservationsClient_BeginDelete_capacityReservationDeleteMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCapacityReservationsClient().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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/capacityReservationExamples/CapacityReservation_Delete_MinimumSet_Gen.json -func ExampleCapacityReservationsClient_BeginDelete_capacityReservationDeleteMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCapacityReservationsClient().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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCapacityReservationsClient().Get(ctx, "myResourceGroup", "myCapacityReservationGroup", "myCapacityReservation", &armcompute.CapacityReservationsClientGetOptions{Expand: to.Ptr(armcompute.CapacityReservationInstanceViewTypesInstanceView)}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CapacityReservation = armcompute.CapacityReservation{ - // Name: to.Ptr("myCapacityReservation"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/capacityReservationGroups/myCapacityReservationGroup/capacityReservations/myCapacityReservation"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "department": to.Ptr("HR"), - // }, - // Properties: &armcompute.CapacityReservationProperties{ - // InstanceView: &armcompute.CapacityReservationInstanceView{ - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("ProvisioningState/succeeded"), - // DisplayStatus: to.Ptr("Provisioning succeeded"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // }}, - // UtilizationInfo: &armcompute.CapacityReservationUtilization{ - // CurrentCapacity: to.Ptr[int32](5), - // VirtualMachinesAllocated: []*armcompute.SubResourceReadOnly{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM1"), - // }, - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM2"), - // }}, - // }, - // }, - // PlatformFaultDomainCount: to.Ptr[int32](3), - // ProvisioningState: to.Ptr("Succeeded"), - // ProvisioningTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-27T01:02:38.313Z"); return t}()), - // ReservationID: to.Ptr("{GUID}"), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-27T01:02:38.313Z"); return t}()), - // VirtualMachinesAssociated: []*armcompute.SubResourceReadOnly{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM1"), - // }, - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM2"), - // }, - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM3"), - // }}, - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Standard_DS1_v2"), - // Capacity: to.Ptr[int64](4), - // }, - // Zones: []*string{ - // to.Ptr("1")}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewCapacityReservationsClient().NewListByCapacityReservationGroupPager("myResourceGroup", "myCapacityReservationGroup", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.CapacityReservationListResult = armcompute.CapacityReservationListResult{ - // Value: []*armcompute.CapacityReservation{ - // { - // Name: to.Ptr("{capacityReservationName}"), - // Type: to.Ptr("Microsoft.Compute/CapacityReservations"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/CapacityReservation/{capacityReservationName}"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "department": to.Ptr("HR"), - // }, - // Properties: &armcompute.CapacityReservationProperties{ - // PlatformFaultDomainCount: to.Ptr[int32](3), - // ProvisioningState: to.Ptr("Succeeded"), - // ProvisioningTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-27T01:02:38.313Z"); return t}()), - // ReservationID: to.Ptr("{GUID}"), - // VirtualMachinesAssociated: []*armcompute.SubResourceReadOnly{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM1"), - // }, - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM2"), - // }, - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM3"), - // }}, - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Standard_DS1_v2"), - // Capacity: to.Ptr[int64](4), - // }, - // Zones: []*string{ - // to.Ptr("1")}, - // }, - // { - // Name: to.Ptr("{capacityReservationName}"), - // Type: to.Ptr("Microsoft.Compute/CapacityReservations"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/CapacityReservation/{capacityReservationName}"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "department": to.Ptr("HR"), - // }, - // Properties: &armcompute.CapacityReservationProperties{ - // PlatformFaultDomainCount: to.Ptr[int32](3), - // ProvisioningState: to.Ptr("Succeeded"), - // ProvisioningTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-27T01:02:38.313Z"); return t}()), - // ReservationID: to.Ptr("{GUID}"), - // VirtualMachinesAssociated: []*armcompute.SubResourceReadOnly{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM4"), - // }}, - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Standard_A1_v2"), - // Capacity: to.Ptr[int64](4), - // }, - // Zones: []*string{ - // to.Ptr("1")}, - // }}, - // } - } -} 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 8612d3e9d521..000000000000 --- a/sdk/resourcemanager/compute/armcompute/cloudserviceoperatingsystems_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. -// DO NOT EDIT. - -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/v5" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCloudServiceOperatingSystemsClient().GetOSVersion(ctx, "westus2", "WA-GUEST-OS-3.90_202010-02", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.OSVersion = armcompute.OSVersion{ - // Name: to.Ptr("WA-GUEST-OS-3.90_202010-02"), - // Type: to.Ptr("Microsoft.Compute/locations/cloudServiceOsVersions"), - // ID: to.Ptr("/subscriptions/{subscription-id}/providers/Microsoft.Compute/locations/westus2/cloudServiceOSVersions/WA-GUEST-OS-3.90_202010-02"), - // Location: to.Ptr("westus2"), - // Properties: &armcompute.OSVersionProperties{ - // Family: to.Ptr("3"), - // FamilyLabel: to.Ptr("Windows Server 2012"), - // IsActive: to.Ptr(true), - // IsDefault: to.Ptr(true), - // Label: to.Ptr("Windows Azure Guest OS 3.90 (Release 202010-02)"), - // Version: to.Ptr("WA-GUEST-OS-3.90_202010-02"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewCloudServiceOperatingSystemsClient().NewListOSVersionsPager("westus2", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.OSVersionListResult = armcompute.OSVersionListResult{ - // Value: []*armcompute.OSVersion{ - // { - // Name: to.Ptr("WA-GUEST-OS-3.90_202010-02"), - // Type: to.Ptr("Microsoft.Compute/locations/cloudServiceOsVersions"), - // ID: to.Ptr("/subscriptions/{subscription-id}/providers/Microsoft.Compute/locations/westus2/cloudServiceOSVersions/WA-GUEST-OS-3.90_202010-02"), - // Location: to.Ptr("westus2"), - // Properties: &armcompute.OSVersionProperties{ - // Family: to.Ptr("3"), - // FamilyLabel: to.Ptr("Windows Server 2012"), - // IsActive: to.Ptr(true), - // IsDefault: to.Ptr(true), - // Label: to.Ptr("Windows Azure Guest OS 3.90 (Release 202010-02)"), - // Version: to.Ptr("WA-GUEST-OS-3.90_202010-02"), - // }, - // }, - // { - // Name: to.Ptr("WA-GUEST-OS-4.83_202010-02"), - // Type: to.Ptr("Microsoft.Compute/locations/cloudServiceOsVersions"), - // ID: to.Ptr("/subscriptions/{subscription-id}/providers/Microsoft.Compute/locations/westus2/cloudServiceOSVersions/WA-GUEST-OS-4.83_202010-02"), - // Location: to.Ptr("westus2"), - // Properties: &armcompute.OSVersionProperties{ - // Family: to.Ptr("4"), - // FamilyLabel: to.Ptr("Windows Server 2012 R2"), - // IsActive: to.Ptr(true), - // IsDefault: to.Ptr(true), - // Label: to.Ptr("Windows Azure Guest OS 4.83 (Release 202010-02)"), - // Version: to.Ptr("WA-GUEST-OS-4.83_202010-02"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCloudServiceOperatingSystemsClient().GetOSFamily(ctx, "westus2", "3", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.OSFamily = armcompute.OSFamily{ - // Name: to.Ptr("3"), - // Type: to.Ptr("Microsoft.Compute/locations/cloudServiceOsFamilies"), - // ID: to.Ptr("/subscriptions/{subscription-id}/providers/Microsoft.Compute/locations/westus2/cloudServiceOSFamilies/3"), - // Location: to.Ptr("westus2"), - // Properties: &armcompute.OSFamilyProperties{ - // Name: to.Ptr("3"), - // Label: to.Ptr("Windows Server 2012"), - // Versions: []*armcompute.OSVersionPropertiesBase{ - // { - // IsActive: to.Ptr(true), - // IsDefault: to.Ptr(true), - // Label: to.Ptr("Windows Azure Guest OS 3.90 (Release 202010-02)"), - // Version: to.Ptr("WA-GUEST-OS-3.90_202010-02"), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewCloudServiceOperatingSystemsClient().NewListOSFamiliesPager("westus2", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.OSFamilyListResult = armcompute.OSFamilyListResult{ - // Value: []*armcompute.OSFamily{ - // { - // Name: to.Ptr("3"), - // Type: to.Ptr("Microsoft.Compute/locations/cloudServiceOsFamilies"), - // ID: to.Ptr("/subscriptions/{subscription-id}/providers/Microsoft.Compute/locations/westus2/cloudServiceOSFamilies/3"), - // Location: to.Ptr("westus2"), - // Properties: &armcompute.OSFamilyProperties{ - // Name: to.Ptr("3"), - // Label: to.Ptr("Windows Server 2012"), - // Versions: []*armcompute.OSVersionPropertiesBase{ - // { - // IsActive: to.Ptr(true), - // IsDefault: to.Ptr(true), - // Label: to.Ptr("Windows Azure Guest OS 3.90 (Release 202010-02)"), - // Version: to.Ptr("WA-GUEST-OS-3.90_202010-02"), - // }}, - // }, - // }, - // { - // Name: to.Ptr("4"), - // Type: to.Ptr("Microsoft.Compute/locations/cloudServiceOsFamilies"), - // ID: to.Ptr("/subscriptions/{subscription-id}/providers/Microsoft.Compute/locations/westus2/cloudServiceOSFamilies/4"), - // Location: to.Ptr("westus2"), - // Properties: &armcompute.OSFamilyProperties{ - // Name: to.Ptr("4"), - // Label: to.Ptr("Windows Server 2012 R2"), - // Versions: []*armcompute.OSVersionPropertiesBase{ - // { - // IsActive: to.Ptr(true), - // IsDefault: to.Ptr(true), - // Label: to.Ptr("Windows Azure Guest OS 4.83 (Release 202010-02)"), - // Version: to.Ptr("WA-GUEST-OS-4.83_202010-02"), - // }}, - // }, - // }}, - // } - } -} 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 2ed78a77bb5a..000000000000 --- a/sdk/resourcemanager/compute/armcompute/cloudserviceroleinstances_client_example_test.go +++ /dev/null @@ -1,289 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package 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/v5" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCloudServiceRoleInstancesClient().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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCloudServiceRoleInstancesClient().Get(ctx, "{roleInstance-name}", "ConstosoRG", "{cs-name}", &armcompute.CloudServiceRoleInstancesClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RoleInstance = armcompute.RoleInstance{ - // Name: to.Ptr("{roleInstance-name}"), - // Type: to.Ptr("Microsoft.Compute/cloudServices/roleInstances"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}/roleInstances/{roleInstance-name}"), - // Location: to.Ptr("eastus2euap"), - // Properties: &armcompute.RoleInstanceProperties{ - // NetworkProfile: &armcompute.RoleInstanceNetworkProfile{ - // NetworkInterfaces: []*armcompute.SubResource{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}/roleInstances/{roleInstance-name}/networkInterfaces/nic1"), - // }}, - // }, - // }, - // SKU: &armcompute.InstanceSKU{ - // Name: to.Ptr("Standard_D1_v2"), - // Tier: to.Ptr("Standard"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCloudServiceRoleInstancesClient().GetInstanceView(ctx, "{roleInstance-name}", "ConstosoRG", "{cs-name}", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RoleInstanceView = armcompute.RoleInstanceView{ - // PlatformFaultDomain: to.Ptr[int32](0), - // PlatformUpdateDomain: to.Ptr[int32](0), - // PrivateID: to.Ptr("3491bc0c-1f6c-444f-b1d0-ec0751a74e3e"), - // Statuses: []*armcompute.ResourceInstanceViewStatus{ - // { - // Code: to.Ptr("RoleState/RoleStateStarted"), - // DisplayStatus: to.Ptr("RoleStateStarted"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr(""), - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewCloudServiceRoleInstancesClient().NewListPager("ConstosoRG", "{cs-name}", &armcompute.CloudServiceRoleInstancesClientListOptions{Expand: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.RoleInstanceListResult = armcompute.RoleInstanceListResult{ - // Value: []*armcompute.RoleInstance{ - // { - // Name: to.Ptr("ContosoFrontend_IN_0"), - // Type: to.Ptr("Microsoft.Compute/cloudServices/roleInstances"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}/roleInstances/ContosoFrontend_IN_0"), - // Location: to.Ptr("eastus2euap"), - // Properties: &armcompute.RoleInstanceProperties{ - // NetworkProfile: &armcompute.RoleInstanceNetworkProfile{ - // NetworkInterfaces: []*armcompute.SubResource{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}/roleInstances/ContosoFrontend_IN_0/networkInterfaces/nic1"), - // }}, - // }, - // }, - // SKU: &armcompute.InstanceSKU{ - // Name: to.Ptr("Standard_D1_v2"), - // Tier: to.Ptr("Standard"), - // }, - // }, - // { - // Name: to.Ptr("ContosoFrontend_IN_1"), - // Type: to.Ptr("Microsoft.Compute/cloudServices/roleInstances"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}/roleInstances/ContosoFrontend_IN_1"), - // Location: to.Ptr("eastus2euap"), - // Properties: &armcompute.RoleInstanceProperties{ - // NetworkProfile: &armcompute.RoleInstanceNetworkProfile{ - // NetworkInterfaces: []*armcompute.SubResource{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}/roleInstances/ContosoFrontend_IN_1/networkInterfaces/nic1"), - // }}, - // }, - // }, - // SKU: &armcompute.InstanceSKU{ - // Name: to.Ptr("Standard_D1_v2"), - // Tier: to.Ptr("Standard"), - // }, - // }, - // { - // Name: to.Ptr("ContosoBackend_IN_0"), - // Type: to.Ptr("Microsoft.Compute/cloudServices/roleInstances"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}/roleInstances/ContosoBackend_IN_0"), - // Location: to.Ptr("eastus2euap"), - // Properties: &armcompute.RoleInstanceProperties{ - // NetworkProfile: &armcompute.RoleInstanceNetworkProfile{ - // NetworkInterfaces: []*armcompute.SubResource{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}/roleInstances/ContosoBackend_IN_0/networkInterfaces/nic1"), - // }}, - // }, - // }, - // SKU: &armcompute.InstanceSKU{ - // Name: to.Ptr("Standard_D1_v2"), - // Tier: to.Ptr("Standard"), - // }, - // }, - // { - // Name: to.Ptr("ContosoBackend_IN_1"), - // Type: to.Ptr("Microsoft.Compute/cloudServices/roleInstances"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}/roleInstances/ContosoBackend_IN_1"), - // Location: to.Ptr("eastus2euap"), - // Properties: &armcompute.RoleInstanceProperties{ - // NetworkProfile: &armcompute.RoleInstanceNetworkProfile{ - // NetworkInterfaces: []*armcompute.SubResource{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}/roleInstances/ContosoBackend_IN_1/networkInterfaces/nic1"), - // }}, - // }, - // }, - // SKU: &armcompute.InstanceSKU{ - // Name: to.Ptr("Standard_D1_v2"), - // Tier: to.Ptr("Standard"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCloudServiceRoleInstancesClient().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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCloudServiceRoleInstancesClient().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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCloudServiceRoleInstancesClient().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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewCloudServiceRoleInstancesClient().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 13c717ca06ff..000000000000 --- a/sdk/resourcemanager/compute/armcompute/cloudserviceroles_client_example_test.go +++ /dev/null @@ -1,108 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package 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/v5" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCloudServiceRolesClient().Get(ctx, "{role-name}", "ConstosoRG", "{cs-name}", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CloudServiceRole = armcompute.CloudServiceRole{ - // Name: to.Ptr("{role-name}"), - // Type: to.Ptr("Microsoft.Compute/cloudServices/roles"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}/roles/{role-name}"), - // Location: to.Ptr("eastus2euap"), - // Properties: &armcompute.CloudServiceRoleProperties{ - // UniqueID: to.Ptr("b03bc269-766b-4921-b91a-7dffaae4d03b:{role-name}"), - // }, - // SKU: &armcompute.CloudServiceRoleSKU{ - // Name: to.Ptr("Standard_D1_v2"), - // Capacity: to.Ptr[int64](2), - // Tier: to.Ptr("Standard"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewCloudServiceRolesClient().NewListPager("ConstosoRG", "{cs-name}", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.CloudServiceRoleListResult = armcompute.CloudServiceRoleListResult{ - // Value: []*armcompute.CloudServiceRole{ - // { - // Name: to.Ptr("ContosoFrontend"), - // Type: to.Ptr("Microsoft.Compute/cloudServices/roles"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}/roles/ContosoFrontend"), - // Location: to.Ptr("eastus2euap"), - // Properties: &armcompute.CloudServiceRoleProperties{ - // UniqueID: to.Ptr("b03bc269-766b-4921-b91a-7dffaae4d03b:ContosoFrontend"), - // }, - // SKU: &armcompute.CloudServiceRoleSKU{ - // Name: to.Ptr("Standard_D1_v2"), - // Capacity: to.Ptr[int64](2), - // Tier: to.Ptr("Standard"), - // }, - // }, - // { - // Name: to.Ptr("ContosoBackend"), - // Type: to.Ptr("Microsoft.Compute/cloudServices/roles"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}/roles/ContosoBackend"), - // Location: to.Ptr("eastus2euap"), - // Properties: &armcompute.CloudServiceRoleProperties{ - // UniqueID: to.Ptr("b03bc269-766b-4921-b91a-7dffaae4d03b:ContosoBackend"), - // }, - // SKU: &armcompute.CloudServiceRoleSKU{ - // Name: to.Ptr("Standard_D1_v2"), - // Capacity: to.Ptr[int64](2), - // Tier: to.Ptr("Standard"), - // }, - // }}, - // } - } -} 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 ffee6c222feb..000000000000 --- a/sdk/resourcemanager/compute/armcompute/cloudservices_client_example_test.go +++ /dev/null @@ -1,1242 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package 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/v5" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCloudServicesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CloudService = armcompute.CloudService{ - // Name: to.Ptr("{cs-name}"), - // Type: to.Ptr("Microsoft.Compute/cloudServices"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}"), - // 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{ - // }, - // }, - // PackageURL: to.Ptr("{PackageUrl}"), - // ProvisioningState: to.Ptr("Succeeded"), - // 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"), - // }, - // }}, - // }, - // UniqueID: to.Ptr("7f3edf91-cb34-4a3e-971a-177dc3dd43cb"), - // UpgradeMode: to.Ptr(armcompute.CloudServiceUpgradeModeAuto), - // }, - // SystemData: &armcompute.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.123Z"); return t}()), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.123Z"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-04/examples/CloudService_Create_WithMultiRole_WithZones.json -func ExampleCloudServicesClient_BeginCreateOrUpdate_createNewCloudServiceWithMultipleRolesInASpecificAvailabilityZone() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCloudServicesClient().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), - }, - 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CloudService = armcompute.CloudService{ - // Name: to.Ptr("{cs-name}"), - // Type: to.Ptr("Microsoft.Compute/cloudServices"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}"), - // 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{ - // }, - // }, - // PackageURL: to.Ptr("{PackageUrl}"), - // ProvisioningState: to.Ptr("Succeeded"), - // 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"), - // }, - // }}, - // }, - // UniqueID: to.Ptr("7f3edf91-cb34-4a3e-971a-177dc3dd43cb"), - // UpgradeMode: to.Ptr(armcompute.CloudServiceUpgradeModeAuto), - // }, - // SystemData: &armcompute.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.123Z"); return t}()), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.123Z"); return t}()), - // }, - // Zones: []*string{ - // to.Ptr("1")}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCloudServicesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CloudService = armcompute.CloudService{ - // Name: to.Ptr("{cs-name}"), - // Type: to.Ptr("Microsoft.Compute/cloudServices"), - // ID: to.Ptr("/subscriptions/5393f919-a68a-43d0-9063-4b2bda6bffdf/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}"), - // 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"), - // }, - // }, - // }}, - // }, - // }}, - // }, - // OSProfile: &armcompute.CloudServiceOsProfile{ - // Secrets: []*armcompute.CloudServiceVaultSecretGroup{ - // }, - // }, - // PackageURL: to.Ptr("{PackageUrl}"), - // ProvisioningState: to.Ptr("Succeeded"), - // 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"), - // }, - // }}, - // }, - // UniqueID: to.Ptr("14d10b45-ced7-42ef-a406-50a3df2cea7d"), - // UpgradeMode: to.Ptr(armcompute.CloudServiceUpgradeModeAuto), - // }, - // SystemData: &armcompute.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.123Z"); return t}()), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.123Z"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCloudServicesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CloudService = armcompute.CloudService{ - // Name: to.Ptr("{cs-name}"), - // Type: to.Ptr("Microsoft.Compute/cloudServices"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}"), - // 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}"), - // ProvisioningState: to.Ptr("Succeeded"), - // 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"), - // }, - // }}, - // }, - // UniqueID: to.Ptr("60b6cd59-600b-4e02-b717-521b07aa94bf"), - // UpgradeMode: to.Ptr(armcompute.CloudServiceUpgradeModeAuto), - // }, - // SystemData: &armcompute.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.123Z"); return t}()), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.123Z"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCloudServicesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CloudService = armcompute.CloudService{ - // Name: to.Ptr("{cs-name}"), - // Type: to.Ptr("Microsoft.Compute/cloudServices"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}"), - // 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), - // ProvisioningState: to.Ptr("Succeeded"), - // Publisher: to.Ptr("Microsoft.Windows.Azure.Extensions"), - // RolesAppliedTo: []*string{ - // to.Ptr("*")}, - // 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"), - // }, - // }, - // }}, - // }, - // }}, - // }, - // OSProfile: &armcompute.CloudServiceOsProfile{ - // Secrets: []*armcompute.CloudServiceVaultSecretGroup{ - // }, - // }, - // PackageURL: to.Ptr("{PackageUrl}"), - // ProvisioningState: to.Ptr("Succeeded"), - // 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"), - // }, - // }}, - // }, - // UniqueID: to.Ptr("c948cccb-bbfa-4516-a250-c28abc4d0c15"), - // UpgradeMode: to.Ptr(armcompute.CloudServiceUpgradeModeAuto), - // }, - // SystemData: &armcompute.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.123Z"); return t}()), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.123Z"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCloudServicesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CloudService = armcompute.CloudService{ - // Name: to.Ptr("{cs-name}"), - // Type: to.Ptr("Microsoft.Compute/cloudServices"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}"), - // Location: to.Ptr("eastus2euap"), - // 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{ - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // RoleProfile: &armcompute.CloudServiceRoleProfile{ - // Roles: []*armcompute.CloudServiceRoleProfileProperties{ - // { - // Name: to.Ptr("ContosoFrontend"), - // SKU: &armcompute.CloudServiceRoleSKU{ - // Name: to.Ptr("Standard_D1_v2"), - // Capacity: to.Ptr[int64](2), - // Tier: to.Ptr("Standard"), - // }, - // }, - // { - // Name: to.Ptr("ContosoBackend"), - // SKU: &armcompute.CloudServiceRoleSKU{ - // Name: to.Ptr("Standard_D1_v2"), - // Capacity: to.Ptr[int64](2), - // Tier: to.Ptr("Standard"), - // }, - // }}, - // }, - // UniqueID: to.Ptr("4ccb4323-4740-4545-bb81-780b27375947"), - // UpgradeMode: to.Ptr(armcompute.CloudServiceUpgradeModeAuto), - // }, - // Tags: map[string]*string{ - // "Documentation": to.Ptr("RestAPI"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCloudServicesClient().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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCloudServicesClient().Get(ctx, "ConstosoRG", "{cs-name}", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CloudService = armcompute.CloudService{ - // Name: to.Ptr("{cs-name}"), - // Type: to.Ptr("Microsoft.Compute/cloudServices"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}"), - // Location: to.Ptr("eastus2euap"), - // 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), - // ProvisioningState: to.Ptr("Succeeded"), - // Publisher: to.Ptr("Microsoft.Windows.Azure.Extensions"), - // RolesAppliedTo: []*string{ - // to.Ptr("*")}, - // Settings: "userazure01/12/2022 16:29:02", - // 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"), - // }, - // }, - // }}, - // }, - // }}, - // }, - // OSProfile: &armcompute.CloudServiceOsProfile{ - // Secrets: []*armcompute.CloudServiceVaultSecretGroup{ - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // RoleProfile: &armcompute.CloudServiceRoleProfile{ - // Roles: []*armcompute.CloudServiceRoleProfileProperties{ - // { - // Name: to.Ptr("ContosoFrontend"), - // SKU: &armcompute.CloudServiceRoleSKU{ - // Name: to.Ptr("Standard_D1_v2"), - // Capacity: to.Ptr[int64](2), - // Tier: to.Ptr("Standard"), - // }, - // }, - // { - // Name: to.Ptr("ContosoBackend"), - // SKU: &armcompute.CloudServiceRoleSKU{ - // Name: to.Ptr("Standard_D1_v2"), - // Capacity: to.Ptr[int64](2), - // Tier: to.Ptr("Standard"), - // }, - // }}, - // }, - // UniqueID: to.Ptr("4ccb4323-4740-4545-bb81-780b27375947"), - // UpgradeMode: to.Ptr(armcompute.CloudServiceUpgradeModeAuto), - // }, - // SystemData: &armcompute.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.123Z"); return t}()), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.123Z"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCloudServicesClient().GetInstanceView(ctx, "ConstosoRG", "{cs-name}", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CloudServiceInstanceView = armcompute.CloudServiceInstanceView{ - // PrivateIDs: []*string{ - // to.Ptr("3491bc0c-1f6c-444f-b1d0-ec0751a74e3e")}, - // RoleInstance: &armcompute.InstanceViewStatusesSummary{ - // StatusesSummary: []*armcompute.StatusCodeCount{ - // { - // Code: to.Ptr("ProvisioningState/succeeded"), - // Count: to.Ptr[int32](4), - // }, - // { - // Code: to.Ptr("PowerState/started"), - // Count: to.Ptr[int32](4), - // }, - // { - // Code: to.Ptr("RoleState/RoleStateStarted"), - // Count: to.Ptr[int32](4), - // }}, - // }, - // SdkVersion: to.Ptr("2.9.6496.3"), - // Statuses: []*armcompute.ResourceInstanceViewStatus{ - // { - // Code: to.Ptr("ProvisioningState/succeeded"), - // DisplayStatus: to.Ptr("Provisioning succeeded"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-12T11:20:07.095Z"); return t}()), - // }, - // { - // Code: to.Ptr("PowerState/started"), - // DisplayStatus: to.Ptr("Started"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-12T11:20:07.095Z"); return t}()), - // }, - // { - // Code: to.Ptr("CurrentUpgradeDomain/-1"), - // DisplayStatus: to.Ptr("Current Upgrade Domain of cloud service is -1."), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // }, - // { - // Code: to.Ptr("MaxUpgradeDomain/1"), - // DisplayStatus: to.Ptr("Max Upgrade Domain of cloud service is 1."), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewCloudServicesClient().NewListAllPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.CloudServiceListResult = armcompute.CloudServiceListResult{ - // Value: []*armcompute.CloudService{ - // { - // Name: to.Ptr("{cs-name}"), - // Type: to.Ptr("Microsoft.Compute/cloudServices"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}"), - // Location: to.Ptr("eastus2euap"), - // 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), - // ProvisioningState: to.Ptr("Succeeded"), - // Publisher: to.Ptr("Microsoft.Windows.Azure.Extensions"), - // RolesAppliedTo: []*string{ - // to.Ptr("*")}, - // Settings: "userazure01/12/2022 16:29:02", - // 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"), - // }, - // }, - // }}, - // }, - // }}, - // }, - // OSProfile: &armcompute.CloudServiceOsProfile{ - // Secrets: []*armcompute.CloudServiceVaultSecretGroup{ - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // RoleProfile: &armcompute.CloudServiceRoleProfile{ - // Roles: []*armcompute.CloudServiceRoleProfileProperties{ - // { - // Name: to.Ptr("ContosoFrontend"), - // SKU: &armcompute.CloudServiceRoleSKU{ - // Name: to.Ptr("Standard_D1_v2"), - // Capacity: to.Ptr[int64](2), - // Tier: to.Ptr("Standard"), - // }, - // }, - // { - // Name: to.Ptr("ContosoBackend"), - // SKU: &armcompute.CloudServiceRoleSKU{ - // Name: to.Ptr("Standard_D1_v2"), - // Capacity: to.Ptr[int64](2), - // Tier: to.Ptr("Standard"), - // }, - // }}, - // }, - // UniqueID: to.Ptr("4ccb4323-4740-4545-bb81-780b27375947"), - // UpgradeMode: to.Ptr(armcompute.CloudServiceUpgradeModeAuto), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewCloudServicesClient().NewListPager("ConstosoRG", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.CloudServiceListResult = armcompute.CloudServiceListResult{ - // Value: []*armcompute.CloudService{ - // { - // Name: to.Ptr("{cs-name}"), - // Type: to.Ptr("Microsoft.Compute/cloudServices"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}"), - // Location: to.Ptr("eastus2euap"), - // 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), - // ProvisioningState: to.Ptr("Succeeded"), - // Publisher: to.Ptr("Microsoft.Windows.Azure.Extensions"), - // RolesAppliedTo: []*string{ - // to.Ptr("*")}, - // Settings: "userazure01/12/2022 16:29:02", - // 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"), - // }, - // }, - // }}, - // }, - // }}, - // }, - // OSProfile: &armcompute.CloudServiceOsProfile{ - // Secrets: []*armcompute.CloudServiceVaultSecretGroup{ - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // RoleProfile: &armcompute.CloudServiceRoleProfile{ - // Roles: []*armcompute.CloudServiceRoleProfileProperties{ - // { - // Name: to.Ptr("ContosoFrontend"), - // SKU: &armcompute.CloudServiceRoleSKU{ - // Name: to.Ptr("Standard_D1_v2"), - // Capacity: to.Ptr[int64](2), - // Tier: to.Ptr("Standard"), - // }, - // }, - // { - // Name: to.Ptr("ContosoBackend"), - // SKU: &armcompute.CloudServiceRoleSKU{ - // Name: to.Ptr("Standard_D1_v2"), - // Capacity: to.Ptr[int64](2), - // Tier: to.Ptr("Standard"), - // }, - // }}, - // }, - // UniqueID: to.Ptr("4ccb4323-4740-4545-bb81-780b27375947"), - // UpgradeMode: to.Ptr(armcompute.CloudServiceUpgradeModeAuto), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCloudServicesClient().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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCloudServicesClient().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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCloudServicesClient().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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCloudServicesClient().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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCloudServicesClient().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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCloudServicesClient().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 bf132c2ce370..000000000000 --- a/sdk/resourcemanager/compute/armcompute/cloudservicesupdatedomain_client_example_test.go +++ /dev/null @@ -1,99 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package 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/v5" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCloudServicesUpdateDomainClient().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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCloudServicesUpdateDomainClient().GetUpdateDomain(ctx, "ConstosoRG", "{cs-name}", 1, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.UpdateDomain = armcompute.UpdateDomain{ - // Name: to.Ptr("1"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}/updateDomains/1"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewCloudServicesUpdateDomainClient().NewListUpdateDomainsPager("ConstosoRG", "{cs-name}", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.UpdateDomainListResult = armcompute.UpdateDomainListResult{ - // Value: []*armcompute.UpdateDomain{ - // { - // Name: to.Ptr("0"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}/updateDomains/0"), - // }, - // { - // Name: to.Ptr("1"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}/updateDomains/1"), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/compute/armcompute/communitygalleries_client.go b/sdk/resourcemanager/compute/armcompute/communitygalleries_client.go index 2bfc798f355d..431a26cdef24 100644 --- a/sdk/resourcemanager/compute/armcompute/communitygalleries_client.go +++ b/sdk/resourcemanager/compute/armcompute/communitygalleries_client.go @@ -47,7 +47,7 @@ func NewCommunityGalleriesClient(subscriptionID string, credential azcore.TokenC // Get - Get a community gallery by gallery public name. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-08-03 +// Generated from API version 2023-07-03 // - location - Resource location. // - publicGalleryName - The public name of the community gallery. // - options - CommunityGalleriesClientGetOptions contains the optional parameters for the CommunityGalleriesClient.Get method. @@ -93,7 +93,7 @@ func (client *CommunityGalleriesClient) getCreateRequest(ctx context.Context, lo return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-03") + reqQP.Set("api-version", "2023-07-03") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil 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 53c106e5367e..000000000000 --- a/sdk/resourcemanager/compute/armcompute/communitygalleries_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. -// DO NOT EDIT. - -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/v5" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-08-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCommunityGalleriesClient().Get(ctx, "myLocation", "publicGalleryName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CommunityGallery = armcompute.CommunityGallery{ - // Name: to.Ptr("publicGalleryName"), - // Type: to.Ptr("Microsoft.Compute/locations/communityGallery"), - // Identifier: &armcompute.CommunityGalleryIdentifier{ - // UniqueID: to.Ptr("/CommunityGalleries/publicGalleryName"), - // }, - // Location: to.Ptr("myLocation"), - // Properties: &armcompute.CommunityGalleryProperties{ - // ArtifactTags: map[string]*string{ - // "ShareTag-CommunityGallery": to.Ptr("CommunityGallery"), - // }, - // CommunityMetadata: &armcompute.CommunityGalleryMetadata{ - // Eula: to.Ptr("https://test-uri.com"), - // PrivacyStatementURI: to.Ptr("https://test-uri.com"), - // PublicNames: []*string{ - // to.Ptr("prefix-xxxxx")}, - // PublisherContact: to.Ptr("sameple@email.com"), - // PublisherURI: to.Ptr("https://test-uri.com"), - // }, - // Disclaimer: to.Ptr("https://test-uri.com"), - // }, - // } -} diff --git a/sdk/resourcemanager/compute/armcompute/communitygalleryimages_client.go b/sdk/resourcemanager/compute/armcompute/communitygalleryimages_client.go index 25b118f072ae..4ecc005caafe 100644 --- a/sdk/resourcemanager/compute/armcompute/communitygalleryimages_client.go +++ b/sdk/resourcemanager/compute/armcompute/communitygalleryimages_client.go @@ -47,7 +47,7 @@ func NewCommunityGalleryImagesClient(subscriptionID string, credential azcore.To // Get - Get a community gallery image. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-08-03 +// Generated from API version 2023-07-03 // - location - Resource location. // - publicGalleryName - The public name of the community gallery. // - galleryImageName - The name of the community gallery image definition. @@ -99,7 +99,7 @@ func (client *CommunityGalleryImagesClient) getCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-03") + reqQP.Set("api-version", "2023-07-03") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -116,7 +116,7 @@ func (client *CommunityGalleryImagesClient) getHandleResponse(resp *http.Respons // NewListPager - List community gallery images inside a gallery. // -// Generated from API version 2022-08-03 +// Generated from API version 2023-07-03 // - location - Resource location. // - publicGalleryName - The public name of the community gallery. // - options - CommunityGalleryImagesClientListOptions contains the optional parameters for the CommunityGalleryImagesClient.NewListPager @@ -164,7 +164,7 @@ func (client *CommunityGalleryImagesClient) listCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-03") + reqQP.Set("api-version", "2023-07-03") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil 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 8482b3089928..000000000000 --- a/sdk/resourcemanager/compute/armcompute/communitygalleryimages_client_example_test.go +++ /dev/null @@ -1,111 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package 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/v5" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-08-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCommunityGalleryImagesClient().Get(ctx, "myLocation", "publicGalleryName", "myGalleryImageName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CommunityGalleryImage = armcompute.CommunityGalleryImage{ - // Name: to.Ptr("myGalleryImageName"), - // Type: to.Ptr("Microsoft.Compute/locations/communityGalleryImage"), - // Identifier: &armcompute.CommunityGalleryIdentifier{ - // UniqueID: to.Ptr("/CommunityGalleries/publicGalleryName/Images/myGalleryImageName"), - // }, - // Location: to.Ptr("myLocation"), - // Properties: &armcompute.CommunityGalleryImageProperties{ - // ArtifactTags: map[string]*string{ - // "ShareTag-CommunityGallery": to.Ptr("CommunityGallery"), - // }, - // Disclaimer: to.Ptr("https://test-uri.com"), - // Eula: to.Ptr("https://test-uri.com"), - // HyperVGeneration: to.Ptr(armcompute.HyperVGenerationV1), - // Identifier: &armcompute.CommunityGalleryImageIdentifier{ - // Offer: to.Ptr("myOfferName"), - // Publisher: to.Ptr("myPublisherName"), - // SKU: to.Ptr("mySkuName"), - // }, - // OSState: to.Ptr(armcompute.OperatingSystemStateTypesGeneralized), - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // PrivacyStatementURI: to.Ptr("https://test-uri.com"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-08-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewCommunityGalleryImagesClient().NewListPager("myLocation", "publicGalleryName", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.CommunityGalleryImageList = armcompute.CommunityGalleryImageList{ - // Value: []*armcompute.CommunityGalleryImage{ - // { - // Name: to.Ptr("myGalleryImageName"), - // Identifier: &armcompute.CommunityGalleryIdentifier{ - // UniqueID: to.Ptr("/CommunityGalleries/publicGalleryName/Images/myGalleryImageName"), - // }, - // Location: to.Ptr("myLocation"), - // Properties: &armcompute.CommunityGalleryImageProperties{ - // ArtifactTags: map[string]*string{ - // "ShareTag-CommunityGallery": to.Ptr("CommunityGallery"), - // }, - // Disclaimer: to.Ptr("https://test-uri.com"), - // HyperVGeneration: to.Ptr(armcompute.HyperVGenerationV1), - // Identifier: &armcompute.CommunityGalleryImageIdentifier{ - // Offer: to.Ptr("myOfferName"), - // Publisher: to.Ptr("myPublisherName"), - // SKU: to.Ptr("mySkuName"), - // }, - // OSState: to.Ptr(armcompute.OperatingSystemStateTypesGeneralized), - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/compute/armcompute/communitygalleryimageversions_client.go b/sdk/resourcemanager/compute/armcompute/communitygalleryimageversions_client.go index 5e382b36d1de..e98cfa506c7d 100644 --- a/sdk/resourcemanager/compute/armcompute/communitygalleryimageversions_client.go +++ b/sdk/resourcemanager/compute/armcompute/communitygalleryimageversions_client.go @@ -47,7 +47,7 @@ func NewCommunityGalleryImageVersionsClient(subscriptionID string, credential az // Get - Get a community gallery image version. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-08-03 +// Generated from API version 2023-07-03 // - location - Resource location. // - publicGalleryName - The public name of the community gallery. // - galleryImageName - The name of the community gallery image definition. @@ -106,7 +106,7 @@ func (client *CommunityGalleryImageVersionsClient) getCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-03") + reqQP.Set("api-version", "2023-07-03") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -123,7 +123,7 @@ func (client *CommunityGalleryImageVersionsClient) getHandleResponse(resp *http. // NewListPager - List community gallery image versions inside an image. // -// Generated from API version 2022-08-03 +// Generated from API version 2023-07-03 // - location - Resource location. // - publicGalleryName - The public name of the community gallery. // - galleryImageName - The name of the community gallery image definition. @@ -176,7 +176,7 @@ func (client *CommunityGalleryImageVersionsClient) listCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-03") + reqQP.Set("api-version", "2023-07-03") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil 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 3e2600859bf8..000000000000 --- a/sdk/resourcemanager/compute/armcompute/communitygalleryimageversions_client_example_test.go +++ /dev/null @@ -1,111 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package 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/v5" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-08-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCommunityGalleryImageVersionsClient().Get(ctx, "myLocation", "publicGalleryName", "myGalleryImageName", "myGalleryImageVersionName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CommunityGalleryImageVersion = armcompute.CommunityGalleryImageVersion{ - // Name: to.Ptr("myGalleryImageVersionName"), - // Type: to.Ptr("Microsoft.Compute/locations/communityGalleryImageVersion"), - // Identifier: &armcompute.CommunityGalleryIdentifier{ - // UniqueID: to.Ptr("/CommunityGalleries/publicGalleryName/Images/myGalleryImageName/Versions/myGalleryImageVersionName"), - // }, - // Location: to.Ptr("myLocation"), - // Properties: &armcompute.CommunityGalleryImageVersionProperties{ - // ArtifactTags: map[string]*string{ - // "ShareTag-CommunityGallery": to.Ptr("CommunityGallery"), - // }, - // Disclaimer: to.Ptr("https://test-uri.com"), - // EndOfLifeDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-20T09:12:28.000Z"); return t}()), - // ExcludeFromLatest: to.Ptr(false), - // PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-03-20T09:12:28.000Z"); return t}()), - // StorageProfile: &armcompute.SharedGalleryImageVersionStorageProfile{ - // OSDiskImage: &armcompute.SharedGalleryOSDiskImage{ - // DiskSizeGB: to.Ptr[int32](29), - // HostCaching: to.Ptr(armcompute.SharedGalleryHostCachingNone), - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-08-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewCommunityGalleryImageVersionsClient().NewListPager("myLocation", "publicGalleryName", "myGalleryImageName", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.CommunityGalleryImageVersionList = armcompute.CommunityGalleryImageVersionList{ - // Value: []*armcompute.CommunityGalleryImageVersion{ - // { - // Name: to.Ptr("myGalleryImageVersionName"), - // Identifier: &armcompute.CommunityGalleryIdentifier{ - // UniqueID: to.Ptr("/CommunityGalleries/publicGalleryName/Images/myGalleryImageName/Versions/myGalleryImageVersionName"), - // }, - // Location: to.Ptr("myLocation"), - // Properties: &armcompute.CommunityGalleryImageVersionProperties{ - // ArtifactTags: map[string]*string{ - // "ShareTag-CommunityGallery": to.Ptr("CommunityGallery"), - // }, - // Disclaimer: to.Ptr("https://test-uri.com"), - // EndOfLifeDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-20T09:12:28.000Z"); return t}()), - // ExcludeFromLatest: to.Ptr(false), - // PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-03-20T09:12:28.000Z"); return t}()), - // StorageProfile: &armcompute.SharedGalleryImageVersionStorageProfile{ - // OSDiskImage: &armcompute.SharedGalleryOSDiskImage{ - // DiskSizeGB: to.Ptr[int32](29), - // HostCaching: to.Ptr(armcompute.SharedGalleryHostCachingNone), - // }, - // }, - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/compute/armcompute/constants.go b/sdk/resourcemanager/compute/armcompute/constants.go index e4858a588c77..73f3548e459c 100644 --- a/sdk/resourcemanager/compute/armcompute/constants.go +++ b/sdk/resourcemanager/compute/armcompute/constants.go @@ -10,7 +10,7 @@ package armcompute const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute" - moduleVersion = "v5.5.0" + moduleVersion = "v5.6.0" ) type AccessLevel string 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 3dd1de9d7d54..000000000000 --- a/sdk/resourcemanager/compute/armcompute/dedicatedhostgroups_client_example_test.go +++ /dev/null @@ -1,620 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package 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/v5" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDedicatedHostGroupsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DedicatedHostGroup = armcompute.DedicatedHostGroup{ - // Name: to.Ptr("myDedicatedHostGroup"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/HostGroups/myDedicatedHostGroup"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "department": to.Ptr("finance"), - // "owner": to.Ptr("myCompany"), - // }, - // Properties: &armcompute.DedicatedHostGroupProperties{ - // AdditionalCapabilities: &armcompute.DedicatedHostGroupPropertiesAdditionalCapabilities{ - // UltraSSDEnabled: to.Ptr(true), - // }, - // PlatformFaultDomainCount: to.Ptr[int32](3), - // SupportAutomaticPlacement: to.Ptr(true), - // }, - // Zones: []*string{ - // to.Ptr("1")}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDedicatedHostGroupsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DedicatedHostGroup = armcompute.DedicatedHostGroup{ - // Name: to.Ptr("myDedicatedHostGroup"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/HostGroups/myDedicatedHostGroup"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "department": to.Ptr("finance"), - // "owner": to.Ptr("myCompany"), - // }, - // Properties: &armcompute.DedicatedHostGroupProperties{ - // PlatformFaultDomainCount: to.Ptr[int32](3), - // SupportAutomaticPlacement: to.Ptr(true), - // }, - // Zones: []*string{ - // to.Ptr("1")}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/dedicatedHostExamples/DedicatedHostGroup_Update_MaximumSet_Gen.json -func ExampleDedicatedHostGroupsClient_Update_dedicatedHostGroupUpdateMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDedicatedHostGroupsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DedicatedHostGroup = armcompute.DedicatedHostGroup{ - // Name: to.Ptr("myDedicatedHostGroup"), - // Type: to.Ptr("aaaa"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/HostGroups/myDedicatedHostGroup"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // }, - // Properties: &armcompute.DedicatedHostGroupProperties{ - // Hosts: []*armcompute.SubResourceReadOnly{ - // { - // ID: to.Ptr("aaaa"), - // }}, - // InstanceView: &armcompute.DedicatedHostGroupInstanceView{ - // Hosts: []*armcompute.DedicatedHostInstanceViewWithName{ - // { - // AssetID: to.Ptr("aaaa"), - // 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}()), - // }}, - // Name: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // }}, - // }, - // PlatformFaultDomainCount: to.Ptr[int32](3), - // SupportAutomaticPlacement: to.Ptr(true), - // }, - // Zones: []*string{ - // to.Ptr("1")}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/dedicatedHostExamples/DedicatedHostGroup_Update_MinimumSet_Gen.json -func ExampleDedicatedHostGroupsClient_Update_dedicatedHostGroupUpdateMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDedicatedHostGroupsClient().Update(ctx, "rgcompute", "aaaaaaaaaaa", armcompute.DedicatedHostGroupUpdate{}, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DedicatedHostGroup = armcompute.DedicatedHostGroup{ - // Location: to.Ptr("westus"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/dedicatedHostExamples/DedicatedHostGroup_Delete_MaximumSet_Gen.json -func ExampleDedicatedHostGroupsClient_Delete_dedicatedHostGroupDeleteMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewDedicatedHostGroupsClient().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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/dedicatedHostExamples/DedicatedHostGroup_Delete_MinimumSet_Gen.json -func ExampleDedicatedHostGroupsClient_Delete_dedicatedHostGroupDeleteMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewDedicatedHostGroupsClient().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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDedicatedHostGroupsClient().Get(ctx, "myResourceGroup", "myDedicatedHostGroup", &armcompute.DedicatedHostGroupsClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DedicatedHostGroup = armcompute.DedicatedHostGroup{ - // Name: to.Ptr("myDedicatedHostGroup"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/HostGroups/myDedicatedHostGroup"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "{tagName}": to.Ptr("{tagValue}"), - // }, - // Properties: &armcompute.DedicatedHostGroupProperties{ - // Hosts: []*armcompute.SubResourceReadOnly{ - // { - // ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/myDedicatedHostGroup/myHostGroup/Hosts/myHost1"), - // }, - // { - // ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/myDedicatedHostGroup/myHostGroup/Hosts/myHost2"), - // }}, - // InstanceView: &armcompute.DedicatedHostGroupInstanceView{ - // Hosts: []*armcompute.DedicatedHostInstanceViewWithName{ - // { - // AssetID: to.Ptr("eb3f58b8-b4e8-4882-b69f-301a01812407"), - // AvailableCapacity: &armcompute.DedicatedHostAvailableCapacity{ - // AllocatableVMs: []*armcompute.DedicatedHostAllocatableVM{ - // { - // Count: to.Ptr[float64](10), - // VMSize: to.Ptr("Standard_A1"), - // }}, - // }, - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("ProvisioningState/succeeded"), - // DisplayStatus: to.Ptr("Provisioning succeeded"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // }, - // { - // Code: to.Ptr("HealthState/available"), - // DisplayStatus: to.Ptr("Host available"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // }}, - // Name: to.Ptr("myHost1"), - // }, - // { - // AssetID: to.Ptr("f293d4ac-5eea-4be2-b0c0-0fcaa09aebf8"), - // AvailableCapacity: &armcompute.DedicatedHostAvailableCapacity{ - // AllocatableVMs: []*armcompute.DedicatedHostAllocatableVM{ - // { - // Count: to.Ptr[float64](10), - // VMSize: to.Ptr("Standard_A1"), - // }}, - // }, - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("ProvisioningState/succeeded"), - // DisplayStatus: to.Ptr("Provisioning succeeded"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // }, - // { - // Code: to.Ptr("HealthState/available"), - // DisplayStatus: to.Ptr("Host available"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // }}, - // Name: to.Ptr("myHost2"), - // }}, - // }, - // PlatformFaultDomainCount: to.Ptr[int32](3), - // SupportAutomaticPlacement: to.Ptr(true), - // }, - // Zones: []*string{ - // to.Ptr("3")}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDedicatedHostGroupsClient().Get(ctx, "myResourceGroup", "myDedicatedHostGroup", &armcompute.DedicatedHostGroupsClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DedicatedHostGroup = armcompute.DedicatedHostGroup{ - // Name: to.Ptr("myDedicatedHostGroup"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/HostGroups/myDedicatedHostGroup"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "{tagName}": to.Ptr("{tagValue}"), - // }, - // Properties: &armcompute.DedicatedHostGroupProperties{ - // AdditionalCapabilities: &armcompute.DedicatedHostGroupPropertiesAdditionalCapabilities{ - // UltraSSDEnabled: to.Ptr(true), - // }, - // Hosts: []*armcompute.SubResourceReadOnly{ - // { - // ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/myDedicatedHostGroup/myHostGroup/Hosts/myHost"), - // }}, - // InstanceView: &armcompute.DedicatedHostGroupInstanceView{ - // Hosts: []*armcompute.DedicatedHostInstanceViewWithName{ - // { - // AssetID: to.Ptr("eb3f58b8-b4e8-4882-b69f-301a01812407"), - // AvailableCapacity: &armcompute.DedicatedHostAvailableCapacity{ - // AllocatableVMs: []*armcompute.DedicatedHostAllocatableVM{ - // { - // Count: to.Ptr[float64](10), - // VMSize: to.Ptr("Standard_A1"), - // }}, - // }, - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("ProvisioningState/succeeded"), - // DisplayStatus: to.Ptr("Provisioning succeeded"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // }, - // { - // Code: to.Ptr("HealthState/available"), - // DisplayStatus: to.Ptr("Host available"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // }}, - // Name: to.Ptr("myHost"), - // }}, - // }, - // PlatformFaultDomainCount: to.Ptr[int32](3), - // SupportAutomaticPlacement: to.Ptr(true), - // }, - // Zones: []*string{ - // to.Ptr("3")}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/dedicatedHostExamples/DedicatedHostGroup_ListByResourceGroup_MaximumSet_Gen.json -func ExampleDedicatedHostGroupsClient_NewListByResourceGroupPager_dedicatedHostGroupListByResourceGroupMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDedicatedHostGroupsClient().NewListByResourceGroupPager("rgcompute", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DedicatedHostGroupListResult = armcompute.DedicatedHostGroupListResult{ - // Value: []*armcompute.DedicatedHostGroup{ - // { - // Name: to.Ptr("myDedicatedHostGroup"), - // Type: to.Ptr("aaaa"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/HostGroups/myDedicatedHostGroup"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // }, - // Properties: &armcompute.DedicatedHostGroupProperties{ - // Hosts: []*armcompute.SubResourceReadOnly{ - // { - // ID: to.Ptr("aaaa"), - // }}, - // InstanceView: &armcompute.DedicatedHostGroupInstanceView{ - // Hosts: []*armcompute.DedicatedHostInstanceViewWithName{ - // { - // AssetID: to.Ptr("aaaa"), - // 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}()), - // }}, - // Name: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // }}, - // }, - // PlatformFaultDomainCount: to.Ptr[int32](3), - // SupportAutomaticPlacement: to.Ptr(true), - // }, - // Zones: []*string{ - // to.Ptr("1")}, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/dedicatedHostExamples/DedicatedHostGroup_ListByResourceGroup_MinimumSet_Gen.json -func ExampleDedicatedHostGroupsClient_NewListByResourceGroupPager_dedicatedHostGroupListByResourceGroupMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDedicatedHostGroupsClient().NewListByResourceGroupPager("rgcompute", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DedicatedHostGroupListResult = armcompute.DedicatedHostGroupListResult{ - // Value: []*armcompute.DedicatedHostGroup{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/rgcompute/providers/Microsoft.Compute/HostGroups/myDedicatedHostGroup"), - // Location: to.Ptr("westus"), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/dedicatedHostExamples/DedicatedHostGroup_ListBySubscription_MaximumSet_Gen.json -func ExampleDedicatedHostGroupsClient_NewListBySubscriptionPager_dedicatedHostGroupListBySubscriptionMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDedicatedHostGroupsClient().NewListBySubscriptionPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DedicatedHostGroupListResult = armcompute.DedicatedHostGroupListResult{ - // Value: []*armcompute.DedicatedHostGroup{ - // { - // Name: to.Ptr("myDedicatedHostGroup"), - // Type: to.Ptr("aaaa"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/HostGroups/myDedicatedHostGroup"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // }, - // Properties: &armcompute.DedicatedHostGroupProperties{ - // Hosts: []*armcompute.SubResourceReadOnly{ - // { - // ID: to.Ptr("aaaa"), - // }}, - // InstanceView: &armcompute.DedicatedHostGroupInstanceView{ - // Hosts: []*armcompute.DedicatedHostInstanceViewWithName{ - // { - // AssetID: to.Ptr("aaaa"), - // 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}()), - // }}, - // Name: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // }}, - // }, - // PlatformFaultDomainCount: to.Ptr[int32](3), - // SupportAutomaticPlacement: to.Ptr(true), - // }, - // Zones: []*string{ - // to.Ptr("1")}, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/dedicatedHostExamples/DedicatedHostGroup_ListBySubscription_MinimumSet_Gen.json -func ExampleDedicatedHostGroupsClient_NewListBySubscriptionPager_dedicatedHostGroupListBySubscriptionMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDedicatedHostGroupsClient().NewListBySubscriptionPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DedicatedHostGroupListResult = armcompute.DedicatedHostGroupListResult{ - // Value: []*armcompute.DedicatedHostGroup{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/rgcompute/providers/Microsoft.Compute/HostGroups/myDedicatedHostGroup"), - // Location: to.Ptr("westus"), - // }}, - // } - } -} 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 28e964d8b546..000000000000 --- a/sdk/resourcemanager/compute/armcompute/dedicatedhosts_client_example_test.go +++ /dev/null @@ -1,531 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package 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/v5" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDedicatedHostsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DedicatedHost = armcompute.DedicatedHost{ - // Name: to.Ptr("myDedicatedHost"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/HostGroups/myDedicatedHostGroup/hosts/myDedicatedHost"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "department": to.Ptr("HR"), - // }, - // Properties: &armcompute.DedicatedHostProperties{ - // AutoReplaceOnFailure: to.Ptr(false), - // HostID: to.Ptr("{GUID}"), - // LicenseType: to.Ptr(armcompute.DedicatedHostLicenseTypesWindowsServerHybrid), - // PlatformFaultDomain: to.Ptr[int32](1), - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("DSv3-Type1"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/dedicatedHostExamples/DedicatedHost_Update_MaximumSet_Gen.json -func ExampleDedicatedHostsClient_BeginUpdate_dedicatedHostUpdateMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDedicatedHostsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DedicatedHost = armcompute.DedicatedHost{ - // Name: to.Ptr("myDedicatedHost"), - // Type: to.Ptr("aaaaaaaaaaaaaaaaaaa"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/HostGroups/myDedicatedHostGroup/hosts/myDedicatedHost"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // }, - // Properties: &armcompute.DedicatedHostProperties{ - // AutoReplaceOnFailure: to.Ptr(true), - // HostID: to.Ptr("{GUID}"), - // InstanceView: &armcompute.DedicatedHostInstanceView{ - // AssetID: to.Ptr("aaaaaaaaaaaaaaaa"), - // 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), - // ProvisioningState: to.Ptr("Succeeded"), - // ProvisioningTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.526Z"); return t}()), - // VirtualMachines: []*armcompute.SubResourceReadOnly{ - // { - // ID: to.Ptr("aaaa"), - // }}, - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("DSv3-Type1"), - // Capacity: to.Ptr[int64](7), - // Tier: to.Ptr("aaa"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/dedicatedHostExamples/DedicatedHost_Update_MinimumSet_Gen.json -func ExampleDedicatedHostsClient_BeginUpdate_dedicatedHostUpdateMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDedicatedHostsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DedicatedHost = armcompute.DedicatedHost{ - // Location: to.Ptr("westus"), - // SKU: &armcompute.SKU{ - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/dedicatedHostExamples/DedicatedHost_Update_Resize.json -func ExampleDedicatedHostsClient_BeginUpdate_dedicatedHostUpdateResize() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDedicatedHostsClient().BeginUpdate(ctx, "rgcompute", "aaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaa", armcompute.DedicatedHostUpdate{ - 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DedicatedHost = armcompute.DedicatedHost{ - // Name: to.Ptr("myDedicatedHost"), - // Type: to.Ptr("aaaaaaaaaaaaaaaaaaa"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/HostGroups/myDedicatedHostGroup/hosts/myDedicatedHost"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // }, - // Properties: &armcompute.DedicatedHostProperties{ - // AutoReplaceOnFailure: to.Ptr(true), - // HostID: to.Ptr("{GUID}"), - // LicenseType: to.Ptr(armcompute.DedicatedHostLicenseTypesWindowsServerHybrid), - // PlatformFaultDomain: to.Ptr[int32](1), - // ProvisioningState: to.Ptr("Succeeded"), - // ProvisioningTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.526Z"); return t}()), - // VirtualMachines: []*armcompute.SubResourceReadOnly{ - // { - // ID: to.Ptr("aaaa"), - // }}, - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("DSv3-Type1"), - // Capacity: to.Ptr[int64](7), - // Tier: to.Ptr("aaa"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/dedicatedHostExamples/DedicatedHost_Delete_MaximumSet_Gen.json -func ExampleDedicatedHostsClient_BeginDelete_dedicatedHostDeleteMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDedicatedHostsClient().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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/dedicatedHostExamples/DedicatedHost_Delete_MinimumSet_Gen.json -func ExampleDedicatedHostsClient_BeginDelete_dedicatedHostDeleteMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDedicatedHostsClient().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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDedicatedHostsClient().Get(ctx, "myResourceGroup", "myDedicatedHostGroup", "myHost", &armcompute.DedicatedHostsClientGetOptions{Expand: to.Ptr(armcompute.InstanceViewTypesInstanceView)}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DedicatedHost = armcompute.DedicatedHost{ - // Name: to.Ptr("myHost"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/HostGroups/myDedicatedHostGroup/hosts/myHost"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "department": to.Ptr("HR"), - // }, - // Properties: &armcompute.DedicatedHostProperties{ - // AutoReplaceOnFailure: to.Ptr(true), - // HostID: to.Ptr("{GUID}"), - // InstanceView: &armcompute.DedicatedHostInstanceView{ - // AssetID: to.Ptr("eb3f58b8-b4e8-4882-b69f-301a01812407"), - // AvailableCapacity: &armcompute.DedicatedHostAvailableCapacity{ - // AllocatableVMs: []*armcompute.DedicatedHostAllocatableVM{ - // { - // Count: to.Ptr[float64](10), - // VMSize: to.Ptr("Standard_A1"), - // }}, - // }, - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("ProvisioningState/succeeded"), - // DisplayStatus: to.Ptr("Provisioning succeeded"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // }, - // { - // Code: to.Ptr("HealthState/available"), - // DisplayStatus: to.Ptr("Host available"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // }}, - // }, - // PlatformFaultDomain: to.Ptr[int32](1), - // ProvisioningState: to.Ptr("Succeeded"), - // ProvisioningTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-06-27T01:02:38.313Z"); return t}()), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-06-27T01:02:38.313Z"); return t}()), - // VirtualMachines: []*armcompute.SubResourceReadOnly{ - // { - // ID: to.Ptr("/subscriptions/subId/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/vm1"), - // }}, - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("DSv3-Type1"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/dedicatedHostExamples/DedicatedHost_ListByHostGroup_MaximumSet_Gen.json -func ExampleDedicatedHostsClient_NewListByHostGroupPager_dedicatedHostListByHostGroupMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDedicatedHostsClient().NewListByHostGroupPager("rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DedicatedHostListResult = armcompute.DedicatedHostListResult{ - // Value: []*armcompute.DedicatedHost{ - // { - // Name: to.Ptr("myDedicatedHost"), - // Type: to.Ptr("aaaaaaaaaaaaaaaaaaa"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/HostGroups/myDedicatedHostGroup/hosts/myDedicatedHost"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // }, - // Properties: &armcompute.DedicatedHostProperties{ - // AutoReplaceOnFailure: to.Ptr(true), - // HostID: to.Ptr("{GUID}"), - // InstanceView: &armcompute.DedicatedHostInstanceView{ - // AssetID: to.Ptr("aaaaaaaaaaaaaaaa"), - // 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), - // ProvisioningState: to.Ptr("Succeeded"), - // ProvisioningTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.526Z"); return t}()), - // VirtualMachines: []*armcompute.SubResourceReadOnly{ - // { - // ID: to.Ptr("aaaa"), - // }}, - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("DSv3-Type1"), - // Capacity: to.Ptr[int64](7), - // Tier: to.Ptr("aaa"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/dedicatedHostExamples/DedicatedHost_ListByHostGroup_MinimumSet_Gen.json -func ExampleDedicatedHostsClient_NewListByHostGroupPager_dedicatedHostListByHostGroupMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDedicatedHostsClient().NewListByHostGroupPager("rgcompute", "aaaa", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DedicatedHostListResult = armcompute.DedicatedHostListResult{ - // Value: []*armcompute.DedicatedHost{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/rgcompute/providers/Microsoft.Compute/HostGroups/myDedicatedHostGroup/hosts/myHost"), - // Location: to.Ptr("westus"), - // SKU: &armcompute.SKU{ - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDedicatedHostsClient().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) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/dedicatedHostExamples/DedicatedHost_Redeploy.json -func ExampleDedicatedHostsClient_BeginRedeploy() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDedicatedHostsClient().BeginRedeploy(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) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/dedicatedHostExamples/DedicatedHost_ListAvailableSizes.json -func ExampleDedicatedHostsClient_NewListAvailableSizesPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDedicatedHostsClient().NewListAvailableSizesPager("myResourceGroup", "myDedicatedHostGroup", "myHost", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DedicatedHostSizeListResult = armcompute.DedicatedHostSizeListResult{ - // Value: []*string{ - // to.Ptr("Dsv3-Type1"), - // to.Ptr("Esv3-Type1")}, - // } - } -} 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 7e19d292b004..000000000000 --- a/sdk/resourcemanager/compute/armcompute/diskaccesses_client_example_test.go +++ /dev/null @@ -1,529 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package 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/v5" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-10-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDiskAccessesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DiskAccess = armcompute.DiskAccess{ - // Name: to.Ptr("myDiskAccess"), - // Type: to.Ptr("Microsoft.Compute/diskAccesses"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourcegroup/providers/Microsoft.Compute/diskAccesses/myDiskAccess"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.DiskAccessProperties{ - // ProvisioningState: to.Ptr("Succeeded"), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-01T04:41:35.079Z"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-10-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDiskAccessesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DiskAccess = armcompute.DiskAccess{ - // Name: to.Ptr("myDiskAccess"), - // Type: to.Ptr("Microsoft.Compute/diskAccesses"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourcegroup/providers/Microsoft.Compute/diskAccesses/myDiskAccess"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "department": to.Ptr("Development"), - // "project": to.Ptr("PrivateEndpoints"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-10-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDiskAccessesClient().Get(ctx, "myResourceGroup", "myDiskAccess", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DiskAccess = armcompute.DiskAccess{ - // Name: to.Ptr("myDiskAccess"), - // Type: to.Ptr("Microsoft.Compute/diskAccesses"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskAccesses/myDiskAccess"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "department": to.Ptr("Development"), - // "project": to.Ptr("PrivateEndpoints"), - // }, - // Properties: &armcompute.DiskAccessProperties{ - // PrivateEndpointConnections: []*armcompute.PrivateEndpointConnection{ - // { - // Name: to.Ptr("myDiskAccess.d4914cfa-6bc2-4049-a57c-3d1f622d8eef"), - // Type: to.Ptr("Microsoft.Compute/diskAccesses/PrivateEndpointConnections"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskAccesses/myDiskAccess/privateEndpoinConnections/myDiskAccess.d4914cfa-6bc2-4049-a57c-3d1f622d8eef"), - // Properties: &armcompute.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armcompute.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/privateEndpoints/myPrivateEndpoint"), - // }, - // PrivateLinkServiceConnectionState: &armcompute.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("Auto-Approved"), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr(armcompute.PrivateEndpointServiceConnectionStatusApproved), - // }, - // ProvisioningState: to.Ptr(armcompute.PrivateEndpointConnectionProvisioningStateSucceeded), - // }, - // }}, - // ProvisioningState: to.Ptr("Succeeded"), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-01T04:41:35.079Z"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-10-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDiskAccessesClient().Get(ctx, "myResourceGroup", "myDiskAccess", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DiskAccess = armcompute.DiskAccess{ - // Name: to.Ptr("myDiskAccess"), - // Type: to.Ptr("Microsoft.Compute/diskAccesses"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskAccesses/myDiskAccess"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "department": to.Ptr("Development"), - // "project": to.Ptr("PrivateEndpoints"), - // }, - // Properties: &armcompute.DiskAccessProperties{ - // ProvisioningState: to.Ptr("Succeeded"), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-01T04:41:35.079Z"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-10-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDiskAccessesClient().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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-10-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDiskAccessesClient().NewListByResourceGroupPager("myResourceGroup", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DiskAccessList = armcompute.DiskAccessList{ - // Value: []*armcompute.DiskAccess{ - // { - // Name: to.Ptr("myDiskAccess"), - // Type: to.Ptr("Microsoft.Compute/diskAccesses"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskAccesses/myDiskAccess"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "department": to.Ptr("Development"), - // "project": to.Ptr("PrivateEndpoints"), - // }, - // Properties: &armcompute.DiskAccessProperties{ - // ProvisioningState: to.Ptr("Succeeded"), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-01T04:41:35.079Z"); return t}()), - // }, - // }, - // { - // Name: to.Ptr("myDiskAccess2"), - // Type: to.Ptr("Microsoft.Compute/diskAccesses"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskAccesses/myDiskAccess2"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "department": to.Ptr("Development"), - // "project": to.Ptr("PrivateEndpoints"), - // }, - // Properties: &armcompute.DiskAccessProperties{ - // PrivateEndpointConnections: []*armcompute.PrivateEndpointConnection{ - // { - // Name: to.Ptr("myDiskAccess.d4914cfa-6bc2-4049-a57c-3d1f622d8eef"), - // Type: to.Ptr("Microsoft.Compute/diskAccesses/PrivateEndpointConnections"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskAccesses/myDiskAccess2/privateEndpoinConnections/myDiskAccess2.d4914cfa-6bc2-4049-a57c-3d1f622d8eef"), - // Properties: &armcompute.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armcompute.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/privateEndpoints/myPrivateEndpoint2"), - // }, - // PrivateLinkServiceConnectionState: &armcompute.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("Auto-Approved"), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr(armcompute.PrivateEndpointServiceConnectionStatusApproved), - // }, - // ProvisioningState: to.Ptr(armcompute.PrivateEndpointConnectionProvisioningStateSucceeded), - // }, - // }}, - // ProvisioningState: to.Ptr("Succeeded"), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-01T04:41:35.079Z"); return t}()), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-10-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDiskAccessesClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DiskAccessList = armcompute.DiskAccessList{ - // Value: []*armcompute.DiskAccess{ - // { - // Name: to.Ptr("myDiskAccess"), - // Type: to.Ptr("Microsoft.Compute/diskAccesses"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskAccesses/myDiskAccess"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "department": to.Ptr("Development"), - // "project": to.Ptr("PrivateEndpoints"), - // }, - // Properties: &armcompute.DiskAccessProperties{ - // ProvisioningState: to.Ptr("Succeeded"), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-01T04:41:35.079Z"); return t}()), - // }, - // }, - // { - // Name: to.Ptr("myDiskAccess2"), - // Type: to.Ptr("Microsoft.Compute/diskAccesses"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/mySecondResourceGroup/providers/Microsoft.Compute/diskAccesses/myDiskAccess2"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "department": to.Ptr("Development"), - // "project": to.Ptr("PrivateEndpoints"), - // }, - // Properties: &armcompute.DiskAccessProperties{ - // PrivateEndpointConnections: []*armcompute.PrivateEndpointConnection{ - // { - // Name: to.Ptr("myDiskAccess.d4914cfa-6bc2-4049-a57c-3d1f622d8eef"), - // Type: to.Ptr("Microsoft.Compute/diskAccesses/PrivateEndpointConnections"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/mySecondResourceGroup/providers/Microsoft.Compute/diskAccesses/myDiskAccess2/privateEndpoinConnections/myDiskAccess2.d4914cfa-6bc2-4049-a57c-3d1f622d8eef"), - // Properties: &armcompute.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armcompute.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/mySecondResourceGroup/providers/Microsoft.Network/privateEndpoints/myPrivateEndpoint2"), - // }, - // PrivateLinkServiceConnectionState: &armcompute.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("Auto-Approved"), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr(armcompute.PrivateEndpointServiceConnectionStatusApproved), - // }, - // ProvisioningState: to.Ptr(armcompute.PrivateEndpointConnectionProvisioningStateSucceeded), - // }, - // }}, - // ProvisioningState: to.Ptr("Succeeded"), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-01T04:41:35.079Z"); return t}()), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-10-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDiskAccessesClient().GetPrivateLinkResources(ctx, "myResourceGroup", "myDiskAccess", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PrivateLinkResourceListResult = armcompute.PrivateLinkResourceListResult{ - // Value: []*armcompute.PrivateLinkResource{ - // { - // Name: to.Ptr("disks"), - // Type: to.Ptr("Microsoft.Compute/diskAccesses/privateLinkResources"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskAccesses/myDiskAccess/privateLinkResources/disks"), - // Properties: &armcompute.PrivateLinkResourceProperties{ - // GroupID: to.Ptr("disks"), - // RequiredMembers: []*string{ - // to.Ptr("diskAccess_1")}, - // RequiredZoneNames: []*string{ - // to.Ptr("privatelink.blob.core.windows.net")}, - // }, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-10-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDiskAccessesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PrivateEndpointConnection = armcompute.PrivateEndpointConnection{ - // Name: to.Ptr("myPrivateEndpointConnectionName"), - // Type: to.Ptr("Microsoft.Compute/diskAccesses/PrivateEndpointConnections"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskAccesses/myDiskAccess/privateEndpoinConnections/myPrivateEndpointConnectionName"), - // Properties: &armcompute.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armcompute.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/privateEndpoints/myPrivateEndpoint"), - // }, - // PrivateLinkServiceConnectionState: &armcompute.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("Approving myPrivateEndpointConnection"), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr(armcompute.PrivateEndpointServiceConnectionStatusApproved), - // }, - // ProvisioningState: to.Ptr(armcompute.PrivateEndpointConnectionProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-10-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDiskAccessesClient().GetAPrivateEndpointConnection(ctx, "myResourceGroup", "myDiskAccess", "myPrivateEndpointConnection", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PrivateEndpointConnection = armcompute.PrivateEndpointConnection{ - // Name: to.Ptr("myPrivateEndpointConnection"), - // Type: to.Ptr("Microsoft.Compute/diskAccesses/PrivateEndpointConnections"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskAccesses/myDiskAccess/privateEndpoinConnections/myPrivateEndpointConnection"), - // Properties: &armcompute.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armcompute.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/privateEndpoints/myPrivateEndpoint"), - // }, - // PrivateLinkServiceConnectionState: &armcompute.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("Auto-Approved"), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr(armcompute.PrivateEndpointServiceConnectionStatusApproved), - // }, - // ProvisioningState: to.Ptr(armcompute.PrivateEndpointConnectionProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-10-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDiskAccessesClient().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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-10-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDiskAccessesClient().NewListPrivateEndpointConnectionsPager("myResourceGroup", "myDiskAccess", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.PrivateEndpointConnectionListResult = armcompute.PrivateEndpointConnectionListResult{ - // Value: []*armcompute.PrivateEndpointConnection{ - // { - // Name: to.Ptr("myPrivateEndpointConnection"), - // Type: to.Ptr("Microsoft.Compute/diskAccesses/PrivateEndpointConnections"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskAccesses/myDiskAccess/privateEndpoinConnections/myPrivateEndpointConnection"), - // Properties: &armcompute.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armcompute.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/privateEndpoints/myPrivateEndpoint"), - // }, - // PrivateLinkServiceConnectionState: &armcompute.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("Auto-Approved"), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr(armcompute.PrivateEndpointServiceConnectionStatusApproved), - // }, - // ProvisioningState: to.Ptr(armcompute.PrivateEndpointConnectionProvisioningStateSucceeded), - // }, - // }}, - // } - } -} 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 b52fdae272d5..000000000000 --- a/sdk/resourcemanager/compute/armcompute/diskencryptionsets_client_example_test.go +++ /dev/null @@ -1,660 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package 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/v5" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-10-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDiskEncryptionSetsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DiskEncryptionSet = armcompute.DiskEncryptionSet{ - // Name: to.Ptr("myDiskEncryptionSet"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/myDiskEncryptionSet"), - // 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), - // PreviousKeys: []*armcompute.KeyForDiskEncryptionSet{ - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-10-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDiskEncryptionSetsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DiskEncryptionSet = armcompute.DiskEncryptionSet{ - // Name: to.Ptr("myDiskEncryptionSet"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/myDiskEncryptionSet"), - // 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}": &armcompute.UserAssignedIdentitiesValue{ - // }, - // }, - // }, - // 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"), - // PreviousKeys: []*armcompute.KeyForDiskEncryptionSet{ - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-10-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDiskEncryptionSetsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DiskEncryptionSet = armcompute.DiskEncryptionSet{ - // Name: to.Ptr("myDiskEncryptionSet"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/myDiskEncryptionSet"), - // 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), - // PreviousKeys: []*armcompute.KeyForDiskEncryptionSet{ - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-10-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDiskEncryptionSetsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DiskEncryptionSet = armcompute.DiskEncryptionSet{ - // Name: to.Ptr("myDiskEncryptionSet"), - // Type: to.Ptr("Microsoft.Compute/diskEncryptionSets"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/myDiskEncryptionSet"), - // 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/keyName/KeyVersion2"), - // }, - // EncryptionType: to.Ptr(armcompute.DiskEncryptionSetTypeEncryptionAtRestWithCustomerKey), - // LastKeyRotationTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T04:41:35.079Z"); return t}()), - // ProvisioningState: to.Ptr("Succeeded"), - // RotationToLatestKeyVersionEnabled: to.Ptr(true), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-10-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDiskEncryptionSetsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DiskEncryptionSet = armcompute.DiskEncryptionSet{ - // Name: to.Ptr("myDiskEncryptionSet"), - // Type: to.Ptr("Microsoft.Compute/diskEncryptionSets"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/myDiskEncryptionSet"), - // 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/keyName/keyVersion2"), - // }, - // EncryptionType: to.Ptr(armcompute.DiskEncryptionSetTypeEncryptionAtRestWithCustomerKey), - // LastKeyRotationTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T04:41:35.079Z"); return t}()), - // PreviousKeys: []*armcompute.KeyForDiskEncryptionSet{ - // { - // KeyURL: to.Ptr("https://myvaultdifferentsub.vault-int.azure-int.net/keys/keyName/keyVersion1"), - // }}, - // ProvisioningState: to.Ptr("Succeeded"), - // RotationToLatestKeyVersionEnabled: to.Ptr(true), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-10-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDiskEncryptionSetsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DiskEncryptionSet = armcompute.DiskEncryptionSet{ - // Name: to.Ptr("myDiskEncryptionSet"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "department": to.Ptr("Development"), - // "project": to.Ptr("Encryption"), - // }, - // 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/keyName/keyVersion"), - // SourceVault: &armcompute.SourceVault{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault"), - // }, - // }, - // EncryptionType: to.Ptr(armcompute.DiskEncryptionSetTypeEncryptionAtRestWithCustomerKey), - // LastKeyRotationTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T04:41:35.079Z"); return t}()), - // PreviousKeys: []*armcompute.KeyForDiskEncryptionSet{ - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-10-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDiskEncryptionSetsClient().Get(ctx, "myResourceGroup", "myDiskEncryptionSet", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DiskEncryptionSet = armcompute.DiskEncryptionSet{ - // Name: to.Ptr("myDiskEncryptionSet"), - // Type: to.Ptr("Microsoft.Compute/diskEncryptionSets"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/myDiskEncryptionSet"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "department": to.Ptr("Development"), - // "project": to.Ptr("Encryption"), - // }, - // 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"), - // }, - // }, - // AutoKeyRotationError: &armcompute.APIError{ - // Code: to.Ptr("ManagedServiceIdentityNotFound"), - // Message: to.Ptr("Auto-key rotation was disabled as managed service identity associated with DiskEncryptionSet 'myDiskEncryptionSet' was not found. Please update the resource with correct identity to re-enable auto-key rotation."), - // }, - // EncryptionType: to.Ptr(armcompute.DiskEncryptionSetTypeEncryptionAtRestWithCustomerKey), - // PreviousKeys: []*armcompute.KeyForDiskEncryptionSet{ - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // RotationToLatestKeyVersionEnabled: to.Ptr(true), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-10-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDiskEncryptionSetsClient().Get(ctx, "myResourceGroup", "myDiskEncryptionSet", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DiskEncryptionSet = armcompute.DiskEncryptionSet{ - // Name: to.Ptr("myDiskEncryptionSet"), - // Type: to.Ptr("Microsoft.Compute/diskEncryptionSets"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/myDiskEncryptionSet"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "department": to.Ptr("Development"), - // "project": to.Ptr("Encryption"), - // }, - // 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), - // PreviousKeys: []*armcompute.KeyForDiskEncryptionSet{ - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-10-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDiskEncryptionSetsClient().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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-10-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDiskEncryptionSetsClient().NewListByResourceGroupPager("myResourceGroup", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DiskEncryptionSetList = armcompute.DiskEncryptionSetList{ - // Value: []*armcompute.DiskEncryptionSet{ - // { - // Name: to.Ptr("myDiskEncryptionSet"), - // Type: to.Ptr("Microsoft.Compute/diskEncryptionSets"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/myDiskEncryptionSet"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "department": to.Ptr("Development"), - // "project": to.Ptr("Encryption"), - // }, - // 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), - // PreviousKeys: []*armcompute.KeyForDiskEncryptionSet{ - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // }, - // { - // Name: to.Ptr("myDiskEncryptionSet2"), - // Type: to.Ptr("Microsoft.Compute/diskEncryptionSets"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/myDiskEncryptionSet2"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "department": to.Ptr("Development"), - // "project": to.Ptr("Encryption"), - // }, - // 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/myVMVault2"), - // }, - // }, - // EncryptionType: to.Ptr(armcompute.DiskEncryptionSetTypeEncryptionAtRestWithCustomerKey), - // PreviousKeys: []*armcompute.KeyForDiskEncryptionSet{ - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-10-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDiskEncryptionSetsClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DiskEncryptionSetList = armcompute.DiskEncryptionSetList{ - // Value: []*armcompute.DiskEncryptionSet{ - // { - // Name: to.Ptr("myDiskEncryptionSet"), - // Type: to.Ptr("Microsoft.Compute/diskEncryptionSets"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/myDiskEncryptionSet"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "department": to.Ptr("Development"), - // "project": to.Ptr("Encryption"), - // }, - // 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), - // PreviousKeys: []*armcompute.KeyForDiskEncryptionSet{ - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // }, - // { - // Name: to.Ptr("myDiskEncryptionSet2"), - // Type: to.Ptr("Microsoft.Compute/diskEncryptionSets"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/mySecondResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/myDiskEncryptionSet2"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "department": to.Ptr("Development"), - // "project": to.Ptr("Encryption"), - // }, - // 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/mySecondResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault2"), - // }, - // }, - // EncryptionType: to.Ptr(armcompute.DiskEncryptionSetTypeEncryptionAtRestWithCustomerKey), - // PreviousKeys: []*armcompute.KeyForDiskEncryptionSet{ - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-10-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDiskEncryptionSetsClient().NewListAssociatedResourcesPager("myResourceGroup", "myDiskEncryptionSet", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ResourceURIList = armcompute.ResourceURIList{ - // Value: []*string{ - // to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk"), - // to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot")}, - // } - } -} 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 043dc9a5cc57..000000000000 --- a/sdk/resourcemanager/compute/armcompute/diskrestorepoint_client_example_test.go +++ /dev/null @@ -1,184 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package 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/v5" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-10-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDiskRestorePointClient().Get(ctx, "myResourceGroup", "rpc", "vmrp", "TestDisk45ceb03433006d1baee0_b70cd924-3362-4a80-93c2-9415eaa12745", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DiskRestorePoint = armcompute.DiskRestorePoint{ - // Name: to.Ptr("TestDisk45ceb03433006d1baee0_b70cd924-3362-4a80-93c2-9415eaa12745"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/restorePointCollections/rpc/restorePoints/vmrp/diskRestorePoints/TestDisk45ceb03433006d1baee0_b70cd924-3362-4a80-93c2-9415eaa12745"), - // Properties: &armcompute.DiskRestorePointProperties{ - // FamilyID: to.Ptr("996bf3ce-b6ff-4e86-9db6-dc27ea06cea5"), - // HyperVGeneration: to.Ptr(armcompute.HyperVGenerationV1), - // NetworkAccessPolicy: to.Ptr(armcompute.NetworkAccessPolicyAllowAll), - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // PublicNetworkAccess: to.Ptr(armcompute.PublicNetworkAccessDisabled), - // SourceResourceID: to.Ptr("/subscriptions/d2260d06-e00d-422f-8b63-93df551a59ae/resourceGroups/rg0680fb0c-89f1-41b4-96c0-35733a181558/providers/Microsoft.Compute/disks/TestDisk45ceb03433006d1baee0"), - // SourceUniqueID: to.Ptr("48e058b1-7eea-4968-b532-10a8a1130c13"), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-09-16T04:41:35.079Z"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-10-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDiskRestorePointClient().Get(ctx, "myResourceGroup", "rpc", "vmrp", "TestDisk45ceb03433006d1baee0_b70cd924-3362-4a80-93c2-9415eaa12745", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DiskRestorePoint = armcompute.DiskRestorePoint{ - // Name: to.Ptr("TestDisk45ceb03433006d1baee0_b70cd924-3362-4a80-93c2-9415eaa12745"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/restorePointCollections/rpc/restorePoints/vmrp/diskRestorePoints/TestDisk45ceb03433006d1baee0_b70cd924-3362-4a80-93c2-9415eaa12745"), - // Properties: &armcompute.DiskRestorePointProperties{ - // CompletionPercent: to.Ptr[float32](100), - // FamilyID: to.Ptr("996bf3ce-b6ff-4e86-9db6-dc27ea06cea5"), - // HyperVGeneration: to.Ptr(armcompute.HyperVGenerationV1), - // NetworkAccessPolicy: to.Ptr(armcompute.NetworkAccessPolicyAllowAll), - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // PublicNetworkAccess: to.Ptr(armcompute.PublicNetworkAccessDisabled), - // ReplicationState: to.Ptr("Succeeded"), - // SourceResourceID: to.Ptr("/subscriptions/d2260d06-e00d-422f-8b63-93df551a59ae/resourceGroups/rg0680fb0c-89f1-41b4-96c0-35733a181558/providers/Microsoft.Compute/disks/TestDisk45ceb03433006d1baee0"), - // SourceResourceLocation: to.Ptr("eastus2"), - // SourceUniqueID: to.Ptr("48e058b1-7eea-4968-b532-10a8a1130c13"), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-09-16T04:41:35.079Z"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-10-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDiskRestorePointClient().NewListByRestorePointPager("myResourceGroup", "rpc", "vmrp", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DiskRestorePointList = armcompute.DiskRestorePointList{ - // Value: []*armcompute.DiskRestorePoint{ - // { - // Name: to.Ptr("TestDisk45ceb03433006d1baee0_b70cd924-3362-4a80-93c2-9415eaa12745"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/restorePointCollections/rpc/restorePoints/vmrp/diskRestorePoints/TestDisk45ceb03433006d1baee0_b70cd924-3362-4a80-93c2-9415eaa12745"), - // Properties: &armcompute.DiskRestorePointProperties{ - // FamilyID: to.Ptr("996bf3ce-b6ff-4e86-9db6-dc27ea06cea5"), - // HyperVGeneration: to.Ptr(armcompute.HyperVGenerationV1), - // NetworkAccessPolicy: to.Ptr(armcompute.NetworkAccessPolicyAllowAll), - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // PublicNetworkAccess: to.Ptr(armcompute.PublicNetworkAccessDisabled), - // SourceResourceID: to.Ptr("/subscriptions/d2260d06-e00d-422f-8b63-93df551a59ae/resourceGroups/rg0680fb0c-89f1-41b4-96c0-35733a181558/providers/Microsoft.Compute/disks/TestDisk45ceb03433006d1baee0"), - // SourceUniqueID: to.Ptr("48e058b1-7eea-4968-b532-10a8a1130c13"), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-09-16T04:41:35.079Z"); return t}()), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-10-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDiskRestorePointClient().BeginGrantAccess(ctx, "myResourceGroup", "rpc", "vmrp", "TestDisk45ceb03433006d1baee0_b70cd924-3362-4a80-93c2-9415eaa12745", armcompute.GrantAccessData{ - Access: to.Ptr(armcompute.AccessLevelRead), - DurationInSeconds: to.Ptr[int32](300), - FileFormat: to.Ptr(armcompute.FileFormatVHDX), - }, 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AccessURI = armcompute.AccessURI{ - // AccessSAS: to.Ptr("https://md-gpvmcxzlzxgd.partition.blob.storage.azure.net/xx3cqcx53f0v/abcd?sv=2014-02-14&sr=b&sk=key1&sig=XXX&st=2021-05-24T18:02:34Z&se=2021-05-24T18:19:14Z&sp=r"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-10-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDiskRestorePointClient().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 9a75820a85bc..000000000000 --- a/sdk/resourcemanager/compute/armcompute/disks_client_example_test.go +++ /dev/null @@ -1,2186 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package 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/v5" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-10-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDisksClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Disk = armcompute.Disk{ - // Name: to.Ptr("myDisk"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk"), - // 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), - // ProvisioningState: to.Ptr("Succeeded"), - // SecurityProfile: &armcompute.DiskSecurityProfile{ - // SecureVMDiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"), - // SecurityType: to.Ptr(armcompute.DiskSecurityTypesConfidentialVMDiskEncryptedWithCustomerKey), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-10-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDisksClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Disk = armcompute.Disk{ - // Name: to.Ptr("myDisk"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk"), - // 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), - // ProvisioningState: to.Ptr("Succeeded"), - // PublicNetworkAccess: to.Ptr(armcompute.PublicNetworkAccessEnabled), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-10-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDisksClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Disk = armcompute.Disk{ - // Name: to.Ptr("myDisk"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk"), - // 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}"), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-10-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDisksClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Disk = armcompute.Disk{ - // Name: to.Ptr("myDisk"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk"), - // 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"), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-10-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDisksClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Disk = armcompute.Disk{ - // Name: to.Ptr("myDisk"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk"), - // 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"), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-10-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDisksClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Disk = armcompute.Disk{ - // Name: to.Ptr("myDisk"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk"), - // 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"), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-10-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDisksClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Disk = armcompute.Disk{ - // Name: to.Ptr("myDisk"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk"), - // 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), - // ProvisioningState: to.Ptr("Succeeded"), - // SecurityProfile: &armcompute.DiskSecurityProfile{ - // SecurityType: to.Ptr(armcompute.DiskSecurityTypesConfidentialVMVmguestStateOnlyEncryptedWithPlatformKey), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-10-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDisksClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Disk = armcompute.Disk{ - // Name: to.Ptr("myDisk"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk"), - // 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), - // ProvisioningState: to.Ptr("Succeeded"), - // SecurityProfile: &armcompute.DiskSecurityProfile{ - // SecurityType: to.Ptr(armcompute.DiskSecurityTypesTrustedLaunch), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-10-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDisksClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Disk = armcompute.Disk{ - // Name: to.Ptr("myDisk"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk"), - // 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"), - // }, - // }, - // HyperVGeneration: to.Ptr(armcompute.HyperVGenerationV1), - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // ProvisioningState: to.Ptr("Succeeded"), - // PurchasePlan: &armcompute.DiskPurchasePlan{ - // Name: to.Ptr("{sku}"), - // Product: to.Ptr("{offer}"), - // Publisher: to.Ptr("{publisher}"), - // }, - // SupportedCapabilities: &armcompute.SupportedCapabilities{ - // AcceleratedNetwork: to.Ptr(true), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-10-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDisksClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Disk = armcompute.Disk{ - // Name: to.Ptr("myDisk"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk"), - // 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"), - // }, - // }, - // HyperVGeneration: to.Ptr(armcompute.HyperVGenerationV1), - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // ProvisioningState: to.Ptr("Succeeded"), - // SupportedCapabilities: &armcompute.SupportedCapabilities{ - // AcceleratedNetwork: to.Ptr(true), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-10-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDisksClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Disk = armcompute.Disk{ - // Name: to.Ptr("myDisk"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk"), - // 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"), - // }, - // }, - // HyperVGeneration: to.Ptr(armcompute.HyperVGenerationV1), - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // ProvisioningState: to.Ptr("Succeeded"), - // SupportedCapabilities: &armcompute.SupportedCapabilities{ - // AcceleratedNetwork: to.Ptr(true), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-10-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDisksClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Disk = armcompute.Disk{ - // Name: to.Ptr("myDisk"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk"), - // 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"), - // }, - // }, - // HyperVGeneration: to.Ptr(armcompute.HyperVGenerationV1), - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // ProvisioningState: to.Ptr("Succeeded"), - // SupportedCapabilities: &armcompute.SupportedCapabilities{ - // AcceleratedNetwork: to.Ptr(true), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-10-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDisksClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Disk = armcompute.Disk{ - // Name: to.Ptr("myDisk2"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.DiskProperties{ - // CreationData: &armcompute.CreationData{ - // CreateOption: to.Ptr(armcompute.DiskCreateOptionCopy), - // SourceResourceID: to.Ptr("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk1"), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-10-02/examples/diskExamples/Disk_Create_FromAnElasticSanVolumeSnapshot.json -func ExampleDisksClient_BeginCreateOrUpdate_createAManagedDiskFromElasticSanVolumeSnapshot() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDisksClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myDisk", armcompute.Disk{ - Location: to.Ptr("West US"), - Properties: &armcompute.DiskProperties{ - CreationData: &armcompute.CreationData{ - CreateOption: to.Ptr(armcompute.DiskCreateOptionCopyFromSanSnapshot), - ElasticSanResourceID: to.Ptr("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.ElasticSan/elasticSans/myElasticSan/volumegroups/myElasticSanVolumeGroup/snapshots/myElasticSanVolumeSnapshot"), - }, - }, - }, 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Disk = armcompute.Disk{ - // Name: to.Ptr("myDisk"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.DiskProperties{ - // CreationData: &armcompute.CreationData{ - // CreateOption: to.Ptr(armcompute.DiskCreateOptionCopyFromSanSnapshot), - // ElasticSanResourceID: to.Ptr("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.ElasticSan/elasticSans/myElasticSan/volumegroups/myElasticSanVolumeGroup/snapshots/myElasticSanVolumeSnapshot"), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-10-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDisksClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Disk = armcompute.Disk{ - // Name: to.Ptr("myDisk"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk"), - // 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), - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-10-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDisksClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Disk = armcompute.Disk{ - // Name: to.Ptr("myDisk"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk"), - // 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), - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-10-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDisksClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Disk = armcompute.Disk{ - // Name: to.Ptr("myDisk"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.DiskProperties{ - // CreationData: &armcompute.CreationData{ - // CreateOption: to.Ptr(armcompute.DiskCreateOptionUpload), - // PerformancePlus: to.Ptr(true), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-10-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDisksClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Disk = armcompute.Disk{ - // Name: to.Ptr("myPremiumV2Disk"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.DiskProperties{ - // CreationData: &armcompute.CreationData{ - // CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty), - // }, - // DiskSizeGB: to.Ptr[int32](200), - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // SKU: &armcompute.DiskSKU{ - // Name: to.Ptr(armcompute.DiskStorageAccountTypesPremiumV2LRS), - // Tier: to.Ptr("Premium"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-10-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDisksClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Disk = armcompute.Disk{ - // Name: to.Ptr("myDisk"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk"), - // 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), - // ProvisioningState: to.Ptr("Succeeded"), - // SecurityProfile: &armcompute.DiskSecurityProfile{ - // SecurityType: to.Ptr(armcompute.DiskSecurityTypesTrustedLaunch), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-10-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDisksClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Disk = armcompute.Disk{ - // Name: to.Ptr("myDisk"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.DiskProperties{ - // CreationData: &armcompute.CreationData{ - // CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty), - // }, - // DiskSizeGB: to.Ptr[int32](200), - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // SKU: &armcompute.DiskSKU{ - // Name: to.Ptr(armcompute.DiskStorageAccountTypesPremiumZRS), - // Tier: to.Ptr("Premium"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-10-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDisksClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Disk = armcompute.Disk{ - // Name: to.Ptr("myUltraReadOnlyDisk"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.DiskProperties{ - // CreationData: &armcompute.CreationData{ - // CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty), - // }, - // DiskSizeGB: to.Ptr[int32](200), - // Encryption: &armcompute.Encryption{ - // Type: to.Ptr(armcompute.EncryptionTypeEncryptionAtRestWithPlatformKey), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // SKU: &armcompute.DiskSKU{ - // Name: to.Ptr(armcompute.DiskStorageAccountTypesUltraSSDLRS), - // Tier: to.Ptr("Ultra"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-10-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDisksClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Disk = armcompute.Disk{ - // Name: to.Ptr("myDisk"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.DiskProperties{ - // CreationData: &armcompute.CreationData{ - // CreateOption: to.Ptr(armcompute.DiskCreateOptionUpload), - // UploadSizeBytes: to.Ptr[int64](10737418752), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-10-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDisksClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Disk = armcompute.Disk{ - // Name: to.Ptr("myDisk"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk"), - // 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), - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-10-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDisksClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Disk = armcompute.Disk{ - // Name: to.Ptr("myDisk"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.DiskProperties{ - // CreationData: &armcompute.CreationData{ - // CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty), - // }, - // DiskSizeGB: to.Ptr[int32](200), - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-10-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDisksClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Disk = armcompute.Disk{ - // Name: to.Ptr("myDisk"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk"), - // 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), - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // SKU: &armcompute.DiskSKU{ - // Name: to.Ptr(armcompute.DiskStorageAccountTypesUltraSSDLRS), - // Tier: to.Ptr("Ultra"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-10-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDisksClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Disk = armcompute.Disk{ - // Name: to.Ptr("myDisk"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.DiskProperties{ - // BurstingEnabled: to.Ptr(true), - // CreationData: &armcompute.CreationData{ - // CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty), - // }, - // DiskSizeGB: to.Ptr[int32](1024), - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-10-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDisksClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Disk = armcompute.Disk{ - // Name: to.Ptr("myDisk"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.DiskProperties{ - // CreationData: &armcompute.CreationData{ - // CreateOption: to.Ptr(armcompute.DiskCreateOptionFromImage), - // ImageReference: &armcompute.ImageDiskReference{ - // ID: to.Ptr("/Subscriptions/{subscription-id}/Providers/Microsoft.Compute/Locations/westus/Publishers/test_test_pmc2pc1/ArtifactTypes/VMImage/Offers/marketplace_vm_test/Skus/test_sku/Versions/1.0.0"), - // }, - // }, - // DiskSizeGB: to.Ptr[int32](127), - // HyperVGeneration: to.Ptr(armcompute.HyperVGenerationV1), - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // ProvisioningState: to.Ptr("Succeeded"), - // SupportedCapabilities: &armcompute.SupportedCapabilities{ - // AcceleratedNetwork: to.Ptr(false), - // }, - // }, - // SKU: &armcompute.DiskSKU{ - // Name: to.Ptr(armcompute.DiskStorageAccountTypesStandardLRS), - // Tier: to.Ptr("Standard"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-10-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDisksClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Disk = armcompute.Disk{ - // Name: to.Ptr("myDisk"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.DiskProperties{ - // CreationData: &armcompute.CreationData{ - // CreateOption: to.Ptr(armcompute.DiskCreateOptionFromImage), - // ImageReference: &armcompute.ImageDiskReference{ - // ID: to.Ptr("/Subscriptions/{subscription-id}/Providers/Microsoft.Compute/Locations/westus/Publishers/test_test_pmc2pc1/ArtifactTypes/VMImage/Offers/marketplace_vm_test/Skus/test_sku/Versions/1.0.0"), - // }, - // }, - // DiskSizeGB: to.Ptr[int32](127), - // HyperVGeneration: to.Ptr(armcompute.HyperVGenerationV1), - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // ProvisioningState: to.Ptr("Succeeded"), - // SupportedCapabilities: &armcompute.SupportedCapabilities{ - // Architecture: to.Ptr(armcompute.ArchitectureArm64), - // }, - // }, - // SKU: &armcompute.DiskSKU{ - // Name: to.Ptr(armcompute.DiskStorageAccountTypesStandardLRS), - // Tier: to.Ptr("Standard"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-10-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDisksClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Disk = armcompute.Disk{ - // Name: to.Ptr("myDisk"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.DiskProperties{ - // CreationData: &armcompute.CreationData{ - // CreateOption: to.Ptr(armcompute.DiskCreateOptionFromImage), - // ImageReference: &armcompute.ImageDiskReference{ - // ID: to.Ptr("/Subscriptions/{subscription-id}/Providers/Microsoft.Compute/Locations/westus/Publishers/test_test_pmc2pc1/ArtifactTypes/VMImage/Offers/marketplace_vm_test/Skus/test_sku/Versions/1.0.0"), - // }, - // }, - // DiskSizeGB: to.Ptr[int32](127), - // HyperVGeneration: to.Ptr(armcompute.HyperVGenerationV1), - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // ProvisioningState: to.Ptr("Succeeded"), - // PurchasePlan: &armcompute.DiskPurchasePlan{ - // Name: to.Ptr("myPurchasePlanName"), - // Product: to.Ptr("myPurchasePlanProduct"), - // PromotionCode: to.Ptr("myPurchasePlanPromotionCode"), - // Publisher: to.Ptr("myPurchasePlanPublisher"), - // }, - // }, - // SKU: &armcompute.DiskSKU{ - // Name: to.Ptr(armcompute.DiskStorageAccountTypesStandardLRS), - // Tier: to.Ptr("Standard"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-10-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDisksClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Disk = armcompute.Disk{ - // Name: to.Ptr("myDisk"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.DiskProperties{ - // CreationData: &armcompute.CreationData{ - // CreateOption: to.Ptr(armcompute.DiskCreateOptionImport), - // SourceURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd"), - // }, - // DiskSizeGB: to.Ptr[int32](127), - // HyperVGeneration: to.Ptr(armcompute.HyperVGenerationV1), - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // ProvisioningState: to.Ptr("Succeeded"), - // SupportsHibernation: to.Ptr(true), - // }, - // SKU: &armcompute.DiskSKU{ - // Name: to.Ptr(armcompute.DiskStorageAccountTypesStandardLRS), - // Tier: to.Ptr("Standard"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-10-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDisksClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Disk = armcompute.Disk{ - // Name: to.Ptr("myDisk"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.DiskProperties{ - // CreationData: &armcompute.CreationData{ - // CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // Tier: to.Ptr("P30"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-10-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDisksClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Disk = armcompute.Disk{ - // Name: to.Ptr("myDisk"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.DiskProperties{ - // CreationData: &armcompute.CreationData{ - // CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-10-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDisksClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Disk = armcompute.Disk{ - // Name: to.Ptr("myDisk"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.DiskProperties{ - // CreationData: &armcompute.CreationData{ - // CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty), - // }, - // DiskSizeGB: to.Ptr[int32](200), - // OptimizedForFrequentAttach: to.Ptr(false), - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-10-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDisksClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Disk = armcompute.Disk{ - // Name: to.Ptr("myDisk"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.DiskProperties{ - // CreationData: &armcompute.CreationData{ - // CreateOption: to.Ptr(armcompute.DiskCreateOptionFromImage), - // ImageReference: &armcompute.ImageDiskReference{ - // ID: to.Ptr("/Subscriptions/{subscription-id}/Providers/Microsoft.Compute/Locations/westus/Publishers/marketplacetestfirstparty/ArtifactTypes/VMImage/Offers/nvme_test_062/Skus/test_sku/Versions/1.0.0"), - // }, - // }, - // DiskSizeGB: to.Ptr[int32](127), - // HyperVGeneration: to.Ptr(armcompute.HyperVGenerationV1), - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // ProvisioningState: to.Ptr("Succeeded"), - // SupportedCapabilities: &armcompute.SupportedCapabilities{ - // DiskControllerTypes: to.Ptr("SCSI"), - // }, - // }, - // SKU: &armcompute.DiskSKU{ - // Name: to.Ptr(armcompute.DiskStorageAccountTypesStandardLRS), - // Tier: to.Ptr("Standard"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-10-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDisksClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Disk = armcompute.Disk{ - // Name: to.Ptr("myDisk"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.DiskProperties{ - // CreationData: &armcompute.CreationData{ - // CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty), - // }, - // DiskSizeGB: to.Ptr[int32](200), - // NetworkAccessPolicy: to.Ptr(armcompute.NetworkAccessPolicyAllowAll), - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-10-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDisksClient().Get(ctx, "myResourceGroup", "myManagedDisk", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Disk = armcompute.Disk{ - // Name: to.Ptr("myManagedDisk"), - // Type: to.Ptr("Microsoft.Compute/disks"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "department": to.Ptr("Development"), - // "project": to.Ptr("ManagedDisks"), - // }, - // ManagedBy: to.Ptr("/subscriptions/123caaa-123v-v211-a49f-f88ccac5bf88/resourceGroups/ResourceGroupName/providers/Microsoft.Compute/virtualMachines/TestVM414689371c88843d65ec"), - // Properties: &armcompute.DiskProperties{ - // LastOwnershipUpdateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2016-12-28T04:41:35.079Z"); return t}()), - // CreationData: &armcompute.CreationData{ - // CreateOption: to.Ptr(armcompute.DiskCreateOptionFromImage), - // ImageReference: &armcompute.ImageDiskReference{ - // ID: to.Ptr("/Subscriptions/{subscription-id}/Providers/Microsoft.Compute/Locations/westus/Publishers/test_test_pmc2pc1/ArtifactTypes/VMImage/Offers/marketplace_vm_test/Skus/test_sku/Versions/1.0.0"), - // }, - // }, - // DiskSizeGB: to.Ptr[int32](10), - // Encryption: &armcompute.Encryption{ - // Type: to.Ptr(armcompute.EncryptionTypeEncryptionAtRestWithPlatformKey), - // }, - // EncryptionSettingsCollection: &armcompute.EncryptionSettingsCollection{ - // Enabled: to.Ptr(true), - // EncryptionSettings: []*armcompute.EncryptionSettingsElement{ - // { - // DiskEncryptionKey: &armcompute.KeyVaultAndSecretReference{ - // SecretURL: to.Ptr("https://myvmvault.vault-int.azure-int.net/secrets/{secret}"), - // SourceVault: &armcompute.SourceVault{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault"), - // }, - // }, - // KeyEncryptionKey: &armcompute.KeyVaultAndKeyReference{ - // 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"), - // }, - // }, - // }}, - // }, - // HyperVGeneration: to.Ptr(armcompute.HyperVGenerationV1), - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // ProvisioningState: to.Ptr("Succeeded"), - // PurchasePlan: &armcompute.DiskPurchasePlan{ - // Name: to.Ptr("test_sku"), - // Product: to.Ptr("marketplace_vm_test"), - // Publisher: to.Ptr("test_test_pmc2pc1"), - // }, - // SecurityProfile: &armcompute.DiskSecurityProfile{ - // SecurityType: to.Ptr(armcompute.DiskSecurityTypesTrustedLaunch), - // }, - // SupportedCapabilities: &armcompute.SupportedCapabilities{ - // AcceleratedNetwork: to.Ptr(true), - // }, - // SupportsHibernation: to.Ptr(true), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2016-12-28T04:41:35.079Z"); return t}()), - // }, - // SKU: &armcompute.DiskSKU{ - // Name: to.Ptr(armcompute.DiskStorageAccountTypesStandardLRS), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-10-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDisksClient().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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-10-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDisksClient().NewListByResourceGroupPager("myResourceGroup", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DiskList = armcompute.DiskList{ - // Value: []*armcompute.Disk{ - // { - // Name: to.Ptr("myManagedDisk1"), - // Type: to.Ptr("Microsoft.Compute/disks"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "department": to.Ptr("Development"), - // "project": to.Ptr("ManagedDisks"), - // }, - // Properties: &armcompute.DiskProperties{ - // CreationData: &armcompute.CreationData{ - // CreateOption: to.Ptr(armcompute.DiskCreateOptionCopy), - // SourceResourceID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk"), - // }, - // DiskSizeGB: to.Ptr[int32](200), - // Encryption: &armcompute.Encryption{ - // Type: to.Ptr(armcompute.EncryptionTypeEncryptionAtRestWithPlatformKey), - // }, - // EncryptionSettingsCollection: &armcompute.EncryptionSettingsCollection{ - // Enabled: to.Ptr(true), - // EncryptionSettings: []*armcompute.EncryptionSettingsElement{ - // { - // DiskEncryptionKey: &armcompute.KeyVaultAndSecretReference{ - // SecretURL: to.Ptr("https://myvmvault.vault-int.azure-int.net/secrets/{secret}"), - // SourceVault: &armcompute.SourceVault{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault"), - // }, - // }, - // KeyEncryptionKey: &armcompute.KeyVaultAndKeyReference{ - // 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"), - // }, - // }, - // }}, - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // ProvisioningState: to.Ptr("Succeeded"), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2016-12-28T04:41:35.927Z"); return t}()), - // }, - // }, - // { - // Name: to.Ptr("myManagedDisk2"), - // Type: to.Ptr("Microsoft.Compute/disks"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.DiskProperties{ - // CreationData: &armcompute.CreationData{ - // CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty), - // }, - // DiskSizeGB: to.Ptr[int32](10), - // Encryption: &armcompute.Encryption{ - // Type: to.Ptr(armcompute.EncryptionTypeEncryptionAtRestWithPlatformKey), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // ProvisioningState: to.Ptr("Succeeded"), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2016-12-28T04:41:36.872Z"); return t}()), - // }, - // }, - // { - // Name: to.Ptr("myManagedDisk3"), - // Type: to.Ptr("Microsoft.Compute/disks"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "department": to.Ptr("Development"), - // "project": to.Ptr("ManagedDisks"), - // }, - // 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}"), - // }, - // }, - // DiskSizeGB: to.Ptr[int32](200), - // Encryption: &armcompute.Encryption{ - // Type: to.Ptr(armcompute.EncryptionTypeEncryptionAtRestWithPlatformKey), - // }, - // EncryptionSettingsCollection: &armcompute.EncryptionSettingsCollection{ - // Enabled: to.Ptr(true), - // EncryptionSettings: []*armcompute.EncryptionSettingsElement{ - // { - // DiskEncryptionKey: &armcompute.KeyVaultAndSecretReference{ - // SecretURL: to.Ptr("https://myvmvault.vault-int.azure-int.net/secrets/{secret}"), - // SourceVault: &armcompute.SourceVault{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault"), - // }, - // }, - // KeyEncryptionKey: &armcompute.KeyVaultAndKeyReference{ - // 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"), - // }, - // }, - // }}, - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // ProvisioningState: to.Ptr("Succeeded"), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2016-12-28T04:41:36.397Z"); return t}()), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-10-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDisksClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DiskList = armcompute.DiskList{ - // Value: []*armcompute.Disk{ - // { - // Name: to.Ptr("myManagedDisk1"), - // Type: to.Ptr("Microsoft.Compute/disks"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk1"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "department": to.Ptr("Development"), - // "project": to.Ptr("ManagedDisks"), - // }, - // Properties: &armcompute.DiskProperties{ - // CreationData: &armcompute.CreationData{ - // CreateOption: to.Ptr(armcompute.DiskCreateOptionCopy), - // SourceResourceID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk1"), - // }, - // DiskSizeGB: to.Ptr[int32](200), - // Encryption: &armcompute.Encryption{ - // Type: to.Ptr(armcompute.EncryptionTypeEncryptionAtRestWithPlatformKey), - // }, - // EncryptionSettingsCollection: &armcompute.EncryptionSettingsCollection{ - // Enabled: to.Ptr(true), - // EncryptionSettings: []*armcompute.EncryptionSettingsElement{ - // { - // DiskEncryptionKey: &armcompute.KeyVaultAndSecretReference{ - // SecretURL: to.Ptr("https://myvmvault.vault-int.azure-int.net/secrets/{secret}"), - // SourceVault: &armcompute.SourceVault{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault"), - // }, - // }, - // KeyEncryptionKey: &armcompute.KeyVaultAndKeyReference{ - // 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"), - // }, - // }, - // }}, - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // ProvisioningState: to.Ptr("Succeeded"), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2016-12-28T04:41:35.927Z"); return t}()), - // }, - // }, - // { - // Name: to.Ptr("myManagedDisk2"), - // Type: to.Ptr("Microsoft.Compute/disks"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk2"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.DiskProperties{ - // CreationData: &armcompute.CreationData{ - // CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty), - // }, - // DiskSizeGB: to.Ptr[int32](10), - // Encryption: &armcompute.Encryption{ - // Type: to.Ptr(armcompute.EncryptionTypeEncryptionAtRestWithPlatformKey), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // ProvisioningState: to.Ptr("Succeeded"), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2016-12-28T04:41:36.872Z"); return t}()), - // }, - // }, - // { - // Name: to.Ptr("myManagedDisk3"), - // Type: to.Ptr("Microsoft.Compute/disks"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk3"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "department": to.Ptr("Development"), - // "project": to.Ptr("ManagedDisks"), - // }, - // 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}"), - // }, - // }, - // DiskSizeGB: to.Ptr[int32](200), - // Encryption: &armcompute.Encryption{ - // Type: to.Ptr(armcompute.EncryptionTypeEncryptionAtRestWithPlatformKey), - // }, - // EncryptionSettingsCollection: &armcompute.EncryptionSettingsCollection{ - // Enabled: to.Ptr(true), - // EncryptionSettings: []*armcompute.EncryptionSettingsElement{ - // { - // DiskEncryptionKey: &armcompute.KeyVaultAndSecretReference{ - // SecretURL: to.Ptr("https://myvmvault.vault-int.azure-int.net/secrets/{secret}"), - // SourceVault: &armcompute.SourceVault{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault"), - // }, - // }, - // KeyEncryptionKey: &armcompute.KeyVaultAndKeyReference{ - // 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"), - // }, - // }, - // }}, - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // ProvisioningState: to.Ptr("Succeeded"), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2016-12-28T04:41:36.397Z"); return t}()), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-10-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDisksClient().BeginGrantAccess(ctx, "myResourceGroup", "myDisk", armcompute.GrantAccessData{ - Access: to.Ptr(armcompute.AccessLevelRead), - DurationInSeconds: to.Ptr[int32](300), - FileFormat: to.Ptr(armcompute.FileFormatVHD), - }, 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AccessURI = armcompute.AccessURI{ - // AccessSAS: to.Ptr("https://md-gpvmcxzlzxgd.partition.blob.storage.azure.net/xx3cqcx53f0v/abcd?sv=2014-02-14&sr=b&sk=key1&sig=XXX&st=2021-05-24T18:02:34Z&se=2021-05-24T18:19:14Z&sp=r"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-10-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDisksClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AccessURI = armcompute.AccessURI{ - // AccessSAS: to.Ptr("https://md-gpvmcxzlzxgd.partition.blob.storage.azure.net/xx3cqcx53f0v/abcd?sv=2014-02-14&sr=b&sk=key1&sig=XXX&st=2021-05-24T18:02:34Z&se=2021-05-24T18:19:14Z&sp=r"), - // SecurityDataAccessSAS: to.Ptr("https://md-gpvmcxzlzxgd.partition.blob.storage.azure.net/xx3cqcx53f0v/b9bf5824-6122-49e0-ba22-042f76ccd8a1_vmgs?sv=2014-02-14&sr=b&sk=key1&sig=XXX&st=2021-05-24T18:02:34Z&se=2021-05-24T18:19:14Z&sp=r"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-10-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDisksClient().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.go b/sdk/resourcemanager/compute/armcompute/galleries_client.go index 8fac494c7878..10c88a210791 100644 --- a/sdk/resourcemanager/compute/armcompute/galleries_client.go +++ b/sdk/resourcemanager/compute/armcompute/galleries_client.go @@ -47,7 +47,7 @@ func NewGalleriesClient(subscriptionID string, credential azcore.TokenCredential // BeginCreateOrUpdate - Create or update a Shared Image Gallery. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-08-03 +// Generated from API version 2023-07-03 // - resourceGroupName - The name of the resource group. // - galleryName - The name of the Shared Image Gallery. The allowed characters are alphabets and numbers with dots and periods // allowed in the middle. The maximum length is 80 characters. @@ -74,7 +74,7 @@ func (client *GalleriesClient) BeginCreateOrUpdate(ctx context.Context, resource // CreateOrUpdate - Create or update a Shared Image Gallery. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-08-03 +// Generated from API version 2023-07-03 func (client *GalleriesClient) createOrUpdate(ctx context.Context, resourceGroupName string, galleryName string, gallery Gallery, options *GalleriesClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "GalleriesClient.BeginCreateOrUpdate" @@ -116,7 +116,7 @@ func (client *GalleriesClient) createOrUpdateCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-03") + reqQP.Set("api-version", "2023-07-03") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, gallery); err != nil { @@ -128,7 +128,7 @@ func (client *GalleriesClient) createOrUpdateCreateRequest(ctx context.Context, // BeginDelete - Delete a Shared Image Gallery. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-08-03 +// Generated from API version 2023-07-03 // - resourceGroupName - The name of the resource group. // - galleryName - The name of the Shared Image Gallery to be deleted. // - options - GalleriesClientBeginDeleteOptions contains the optional parameters for the GalleriesClient.BeginDelete method. @@ -152,7 +152,7 @@ func (client *GalleriesClient) BeginDelete(ctx context.Context, resourceGroupNam // Delete - Delete a Shared Image Gallery. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-08-03 +// Generated from API version 2023-07-03 func (client *GalleriesClient) deleteOperation(ctx context.Context, resourceGroupName string, galleryName string, options *GalleriesClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "GalleriesClient.BeginDelete" @@ -194,7 +194,7 @@ func (client *GalleriesClient) deleteCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-03") + reqQP.Set("api-version", "2023-07-03") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -203,7 +203,7 @@ func (client *GalleriesClient) deleteCreateRequest(ctx context.Context, resource // Get - Retrieves information about a Shared Image Gallery. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-08-03 +// Generated from API version 2023-07-03 // - resourceGroupName - The name of the resource group. // - galleryName - The name of the Shared Image Gallery. // - options - GalleriesClientGetOptions contains the optional parameters for the GalleriesClient.Get method. @@ -249,7 +249,7 @@ func (client *GalleriesClient) getCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-03") + reqQP.Set("api-version", "2023-07-03") if options != nil && options.Select != nil { reqQP.Set("$select", string(*options.Select)) } @@ -272,7 +272,7 @@ func (client *GalleriesClient) getHandleResponse(resp *http.Response) (Galleries // NewListPager - List galleries under a subscription. // -// Generated from API version 2022-08-03 +// Generated from API version 2023-07-03 // - options - GalleriesClientListOptions contains the optional parameters for the GalleriesClient.NewListPager method. func (client *GalleriesClient) NewListPager(options *GalleriesClientListOptions) *runtime.Pager[GalleriesClientListResponse] { return runtime.NewPager(runtime.PagingHandler[GalleriesClientListResponse]{ @@ -309,7 +309,7 @@ func (client *GalleriesClient) listCreateRequest(ctx context.Context, options *G return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-03") + reqQP.Set("api-version", "2023-07-03") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -326,7 +326,7 @@ func (client *GalleriesClient) listHandleResponse(resp *http.Response) (Gallerie // NewListByResourceGroupPager - List galleries under a resource group. // -// Generated from API version 2022-08-03 +// Generated from API version 2023-07-03 // - resourceGroupName - The name of the resource group. // - options - GalleriesClientListByResourceGroupOptions contains the optional parameters for the GalleriesClient.NewListByResourceGroupPager // method. @@ -369,7 +369,7 @@ func (client *GalleriesClient) listByResourceGroupCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-03") + reqQP.Set("api-version", "2023-07-03") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -387,7 +387,7 @@ func (client *GalleriesClient) listByResourceGroupHandleResponse(resp *http.Resp // BeginUpdate - Update a Shared Image Gallery. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-08-03 +// Generated from API version 2023-07-03 // - resourceGroupName - The name of the resource group. // - galleryName - The name of the Shared Image Gallery. The allowed characters are alphabets and numbers with dots and periods // allowed in the middle. The maximum length is 80 characters. @@ -413,7 +413,7 @@ func (client *GalleriesClient) BeginUpdate(ctx context.Context, resourceGroupNam // Update - Update a Shared Image Gallery. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-08-03 +// Generated from API version 2023-07-03 func (client *GalleriesClient) update(ctx context.Context, resourceGroupName string, galleryName string, gallery GalleryUpdate, options *GalleriesClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "GalleriesClient.BeginUpdate" @@ -455,7 +455,7 @@ func (client *GalleriesClient) updateCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-03") + reqQP.Set("api-version", "2023-07-03") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, gallery); err != nil { 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 eeb40f5205e4..000000000000 --- a/sdk/resourcemanager/compute/armcompute/galleries_client_example_test.go +++ /dev/null @@ -1,529 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package 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/v5" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-08-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGalleriesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Gallery = armcompute.Gallery{ - // Name: to.Ptr("myGalleryName"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGalleryName"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.GalleryProperties{ - // Description: to.Ptr("This is the gallery description."), - // Identifier: &armcompute.GalleryIdentifier{ - // UniqueName: to.Ptr("{subscription-id}-MYGALLERYNAME"), - // }, - // ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded), - // 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), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-08-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGalleriesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Gallery = armcompute.Gallery{ - // Name: to.Ptr("myGalleryName"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGalleryName"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.GalleryProperties{ - // Description: to.Ptr("This is the gallery description."), - // Identifier: &armcompute.GalleryIdentifier{ - // UniqueName: to.Ptr("{subscription-id}-MYGALLERYNAME"), - // }, - // ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded), - // SharingProfile: &armcompute.SharingProfile{ - // Permissions: to.Ptr(armcompute.GallerySharingPermissionTypesGroups), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-08-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGalleriesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Gallery = armcompute.Gallery{ - // Name: to.Ptr("myGalleryName"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGalleryName"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.GalleryProperties{ - // Description: to.Ptr("This is the gallery description."), - // Identifier: &armcompute.GalleryIdentifier{ - // UniqueName: to.Ptr("{subscription-id}-MYGALLERYNAME"), - // }, - // ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded), - // SoftDeletePolicy: &armcompute.SoftDeletePolicy{ - // IsSoftDeleteEnabled: to.Ptr(true), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-08-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGalleriesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Gallery = armcompute.Gallery{ - // Name: to.Ptr("myGalleryName"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGallery"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.GalleryProperties{ - // Description: to.Ptr("This is the gallery description."), - // Identifier: &armcompute.GalleryIdentifier{ - // UniqueName: to.Ptr("{subscription-id}-MYGALLERYNAME"), - // }, - // ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-08-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGalleriesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Gallery = armcompute.Gallery{ - // Name: to.Ptr("myGalleryName"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.GalleryProperties{ - // Description: to.Ptr("This is the gallery description."), - // Identifier: &armcompute.GalleryIdentifier{ - // UniqueName: to.Ptr("{subscription-id}-MYGALLERYNAME"), - // }, - // ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-08-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewGalleriesClient().Get(ctx, "myResourceGroup", "myGalleryName", &armcompute.GalleriesClientGetOptions{Select: nil, - Expand: nil, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Gallery = armcompute.Gallery{ - // Name: to.Ptr("myGalleryName"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/communityGalleries/myGalleryName"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.GalleryProperties{ - // Description: to.Ptr("This is the gallery description."), - // Identifier: &armcompute.GalleryIdentifier{ - // UniqueName: to.Ptr("{subscription-id}-MYGALLERYNAME"), - // }, - // ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded), - // SharingProfile: &armcompute.SharingProfile{ - // CommunityGalleryInfo: &armcompute.CommunityGalleryInfo{ - // CommunityGalleryEnabled: to.Ptr(true), - // Eula: to.Ptr("eula"), - // PublicNames: []*string{ - // to.Ptr("GalleryPublicName")}, - // PublisherContact: to.Ptr("pir@microsoft.com"), - // PublisherURI: to.Ptr("uri"), - // }, - // Permissions: to.Ptr(armcompute.GallerySharingPermissionTypesCommunity), - // }, - // SharingStatus: &armcompute.SharingStatus{ - // AggregatedState: to.Ptr(armcompute.SharingStateSucceeded), - // Summary: []*armcompute.RegionalSharingStatus{ - // { - // Region: to.Ptr("westus"), - // State: to.Ptr(armcompute.SharingStateSucceeded), - // Details: to.Ptr(""), - // }}, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-08-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewGalleriesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Gallery = armcompute.Gallery{ - // Name: to.Ptr("myGalleryName"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGalleryName"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.GalleryProperties{ - // SharingProfile: &armcompute.SharingProfile{ - // 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")}, - // }}, - // Permissions: to.Ptr(armcompute.GallerySharingPermissionTypesGroups), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-08-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewGalleriesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Gallery = armcompute.Gallery{ - // Name: to.Ptr("myGalleryName"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGalleryName"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.GalleryProperties{ - // SharingProfile: &armcompute.SharingProfile{ - // 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")}, - // }}, - // Permissions: to.Ptr(armcompute.GallerySharingPermissionTypesGroups), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-08-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewGalleriesClient().Get(ctx, "myResourceGroup", "myGalleryName", &armcompute.GalleriesClientGetOptions{Select: nil, - Expand: nil, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Gallery = armcompute.Gallery{ - // Name: to.Ptr("myGalleryName"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGalleryName"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.GalleryProperties{ - // Description: to.Ptr("This is the gallery description."), - // Identifier: &armcompute.GalleryIdentifier{ - // UniqueName: to.Ptr("{subscription-id}-MYGALLERYNAME"), - // }, - // ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-08-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGalleriesClient().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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-08-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewGalleriesClient().NewListByResourceGroupPager("myResourceGroup", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.GalleryList = armcompute.GalleryList{ - // Value: []*armcompute.Gallery{ - // { - // Name: to.Ptr("myGalleryName"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGalleryName"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.GalleryProperties{ - // Description: to.Ptr("This is the gallery description."), - // Identifier: &armcompute.GalleryIdentifier{ - // UniqueName: to.Ptr("{subscription-id}-MYGALLERYNAME"), - // }, - // ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-08-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewGalleriesClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.GalleryList = armcompute.GalleryList{ - // Value: []*armcompute.Gallery{ - // { - // Name: to.Ptr("myGalleryName"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGalleryName"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.GalleryProperties{ - // Description: to.Ptr("This is the gallery description."), - // Identifier: &armcompute.GalleryIdentifier{ - // UniqueName: to.Ptr("{subscription-id}-MYGALLERYNAME"), - // }, - // ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/compute/armcompute/galleryapplications_client.go b/sdk/resourcemanager/compute/armcompute/galleryapplications_client.go index 1ebec623b454..cd5d6f3ecfe6 100644 --- a/sdk/resourcemanager/compute/armcompute/galleryapplications_client.go +++ b/sdk/resourcemanager/compute/armcompute/galleryapplications_client.go @@ -47,7 +47,7 @@ func NewGalleryApplicationsClient(subscriptionID string, credential azcore.Token // BeginCreateOrUpdate - Create or update a gallery Application Definition. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-08-03 +// Generated from API version 2023-07-03 // - resourceGroupName - The name of the resource group. // - galleryName - The name of the Shared Application Gallery in which the Application Definition is to be created. // - galleryApplicationName - The name of the gallery Application Definition to be created or updated. The allowed characters @@ -76,7 +76,7 @@ func (client *GalleryApplicationsClient) BeginCreateOrUpdate(ctx context.Context // CreateOrUpdate - Create or update a gallery Application Definition. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-08-03 +// Generated from API version 2023-07-03 func (client *GalleryApplicationsClient) createOrUpdate(ctx context.Context, resourceGroupName string, galleryName string, galleryApplicationName string, galleryApplication GalleryApplication, options *GalleryApplicationsClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "GalleryApplicationsClient.BeginCreateOrUpdate" @@ -122,7 +122,7 @@ func (client *GalleryApplicationsClient) createOrUpdateCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-03") + reqQP.Set("api-version", "2023-07-03") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, galleryApplication); err != nil { @@ -134,7 +134,7 @@ func (client *GalleryApplicationsClient) createOrUpdateCreateRequest(ctx context // BeginDelete - Delete a gallery Application. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-08-03 +// Generated from API version 2023-07-03 // - resourceGroupName - The name of the resource group. // - galleryName - The name of the Shared Application Gallery in which the Application Definition is to be deleted. // - galleryApplicationName - The name of the gallery Application Definition to be deleted. @@ -160,7 +160,7 @@ func (client *GalleryApplicationsClient) BeginDelete(ctx context.Context, resour // Delete - Delete a gallery Application. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-08-03 +// Generated from API version 2023-07-03 func (client *GalleryApplicationsClient) deleteOperation(ctx context.Context, resourceGroupName string, galleryName string, galleryApplicationName string, options *GalleryApplicationsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "GalleryApplicationsClient.BeginDelete" @@ -206,7 +206,7 @@ func (client *GalleryApplicationsClient) deleteCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-03") + reqQP.Set("api-version", "2023-07-03") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -215,7 +215,7 @@ func (client *GalleryApplicationsClient) deleteCreateRequest(ctx context.Context // Get - Retrieves information about a gallery Application Definition. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-08-03 +// Generated from API version 2023-07-03 // - resourceGroupName - The name of the resource group. // - galleryName - The name of the Shared Application Gallery from which the Application Definitions are to be retrieved. // - galleryApplicationName - The name of the gallery Application Definition to be retrieved. @@ -266,7 +266,7 @@ func (client *GalleryApplicationsClient) getCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-03") + reqQP.Set("api-version", "2023-07-03") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -283,7 +283,7 @@ func (client *GalleryApplicationsClient) getHandleResponse(resp *http.Response) // NewListByGalleryPager - List gallery Application Definitions in a gallery. // -// Generated from API version 2022-08-03 +// Generated from API version 2023-07-03 // - resourceGroupName - The name of the resource group. // - galleryName - The name of the Shared Application Gallery from which Application Definitions are to be listed. // - options - GalleryApplicationsClientListByGalleryOptions contains the optional parameters for the GalleryApplicationsClient.NewListByGalleryPager @@ -331,7 +331,7 @@ func (client *GalleryApplicationsClient) listByGalleryCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-03") + reqQP.Set("api-version", "2023-07-03") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -349,7 +349,7 @@ func (client *GalleryApplicationsClient) listByGalleryHandleResponse(resp *http. // BeginUpdate - Update a gallery Application Definition. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-08-03 +// Generated from API version 2023-07-03 // - resourceGroupName - The name of the resource group. // - galleryName - The name of the Shared Application Gallery in which the Application Definition is to be updated. // - galleryApplicationName - The name of the gallery Application Definition to be updated. The allowed characters are alphabets @@ -378,7 +378,7 @@ func (client *GalleryApplicationsClient) BeginUpdate(ctx context.Context, resour // Update - Update a gallery Application Definition. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-08-03 +// Generated from API version 2023-07-03 func (client *GalleryApplicationsClient) update(ctx context.Context, resourceGroupName string, galleryName string, galleryApplicationName string, galleryApplication GalleryApplicationUpdate, options *GalleryApplicationsClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "GalleryApplicationsClient.BeginUpdate" @@ -424,7 +424,7 @@ func (client *GalleryApplicationsClient) updateCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-03") + reqQP.Set("api-version", "2023-07-03") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, galleryApplication); err != nil { 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 f6cc5e19d65f..000000000000 --- a/sdk/resourcemanager/compute/armcompute/galleryapplications_client_example_test.go +++ /dev/null @@ -1,287 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package 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/v5" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-08-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGalleryApplicationsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.GalleryApplication = armcompute.GalleryApplication{ - // Name: to.Ptr("myGalleryApplicationName"), - // Type: to.Ptr("Microsoft.Compute/galleries"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGalleryName/applications/myGalleryApplicationName"), - // 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), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-08-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGalleryApplicationsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.GalleryApplication = armcompute.GalleryApplication{ - // Name: to.Ptr("myGalleryApplicationName"), - // Type: to.Ptr("Microsoft.Compute/galleries"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGalleryName/applications/myGalleryApplicationName"), - // 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), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-08-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewGalleryApplicationsClient().Get(ctx, "myResourceGroup", "myGalleryName", "myGalleryApplicationName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.GalleryApplication = armcompute.GalleryApplication{ - // Name: to.Ptr("myGalleryApplicationName"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGalleryName/applications/myGalleryApplicationName"), - // 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), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-08-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGalleryApplicationsClient().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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-08-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewGalleryApplicationsClient().NewListByGalleryPager("myResourceGroup", "myGalleryName", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.GalleryApplicationList = armcompute.GalleryApplicationList{ - // Value: []*armcompute.GalleryApplication{ - // { - // Name: to.Ptr("myGalleryApplicationName"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGalleryName/applications/myGalleryApplicationName"), - // 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), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/compute/armcompute/galleryapplicationversions_client.go b/sdk/resourcemanager/compute/armcompute/galleryapplicationversions_client.go index 3d885cb93e0c..06571af3d467 100644 --- a/sdk/resourcemanager/compute/armcompute/galleryapplicationversions_client.go +++ b/sdk/resourcemanager/compute/armcompute/galleryapplicationversions_client.go @@ -47,7 +47,7 @@ func NewGalleryApplicationVersionsClient(subscriptionID string, credential azcor // BeginCreateOrUpdate - Create or update a gallery Application Version. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-08-03 +// Generated from API version 2023-07-03 // - resourceGroupName - The name of the resource group. // - galleryName - The name of the Shared Application Gallery in which the Application Definition resides. // - galleryApplicationName - The name of the gallery Application Definition in which the Application Version is to be created. @@ -77,7 +77,7 @@ func (client *GalleryApplicationVersionsClient) BeginCreateOrUpdate(ctx context. // CreateOrUpdate - Create or update a gallery Application Version. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-08-03 +// Generated from API version 2023-07-03 func (client *GalleryApplicationVersionsClient) createOrUpdate(ctx context.Context, resourceGroupName string, galleryName string, galleryApplicationName string, galleryApplicationVersionName string, galleryApplicationVersion GalleryApplicationVersion, options *GalleryApplicationVersionsClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "GalleryApplicationVersionsClient.BeginCreateOrUpdate" @@ -127,7 +127,7 @@ func (client *GalleryApplicationVersionsClient) createOrUpdateCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-03") + reqQP.Set("api-version", "2023-07-03") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, galleryApplicationVersion); err != nil { @@ -139,7 +139,7 @@ func (client *GalleryApplicationVersionsClient) createOrUpdateCreateRequest(ctx // BeginDelete - Delete a gallery Application Version. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-08-03 +// Generated from API version 2023-07-03 // - resourceGroupName - The name of the resource group. // - galleryName - The name of the Shared Application Gallery in which the Application Definition resides. // - galleryApplicationName - The name of the gallery Application Definition in which the Application Version resides. @@ -166,7 +166,7 @@ func (client *GalleryApplicationVersionsClient) BeginDelete(ctx context.Context, // Delete - Delete a gallery Application Version. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-08-03 +// Generated from API version 2023-07-03 func (client *GalleryApplicationVersionsClient) deleteOperation(ctx context.Context, resourceGroupName string, galleryName string, galleryApplicationName string, galleryApplicationVersionName string, options *GalleryApplicationVersionsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "GalleryApplicationVersionsClient.BeginDelete" @@ -216,7 +216,7 @@ func (client *GalleryApplicationVersionsClient) deleteCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-03") + reqQP.Set("api-version", "2023-07-03") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -225,7 +225,7 @@ func (client *GalleryApplicationVersionsClient) deleteCreateRequest(ctx context. // Get - Retrieves information about a gallery Application Version. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-08-03 +// Generated from API version 2023-07-03 // - resourceGroupName - The name of the resource group. // - galleryName - The name of the Shared Application Gallery in which the Application Definition resides. // - galleryApplicationName - The name of the gallery Application Definition in which the Application Version resides. @@ -285,7 +285,7 @@ func (client *GalleryApplicationVersionsClient) getCreateRequest(ctx context.Con if options != nil && options.Expand != nil { reqQP.Set("$expand", string(*options.Expand)) } - reqQP.Set("api-version", "2022-08-03") + reqQP.Set("api-version", "2023-07-03") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -302,7 +302,7 @@ func (client *GalleryApplicationVersionsClient) getHandleResponse(resp *http.Res // NewListByGalleryApplicationPager - List gallery Application Versions in a gallery Application Definition. // -// Generated from API version 2022-08-03 +// Generated from API version 2023-07-03 // - resourceGroupName - The name of the resource group. // - galleryName - The name of the Shared Application Gallery in which the Application Definition resides. // - galleryApplicationName - The name of the Shared Application Gallery Application Definition from which the Application Versions @@ -356,7 +356,7 @@ func (client *GalleryApplicationVersionsClient) listByGalleryApplicationCreateRe return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-03") + reqQP.Set("api-version", "2023-07-03") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -374,7 +374,7 @@ func (client *GalleryApplicationVersionsClient) listByGalleryApplicationHandleRe // BeginUpdate - Update a gallery Application Version. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-08-03 +// Generated from API version 2023-07-03 // - resourceGroupName - The name of the resource group. // - galleryName - The name of the Shared Application Gallery in which the Application Definition resides. // - galleryApplicationName - The name of the gallery Application Definition in which the Application Version is to be updated. @@ -404,7 +404,7 @@ func (client *GalleryApplicationVersionsClient) BeginUpdate(ctx context.Context, // Update - Update a gallery Application Version. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-08-03 +// Generated from API version 2023-07-03 func (client *GalleryApplicationVersionsClient) update(ctx context.Context, resourceGroupName string, galleryName string, galleryApplicationName string, galleryApplicationVersionName string, galleryApplicationVersion GalleryApplicationVersionUpdate, options *GalleryApplicationVersionsClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "GalleryApplicationVersionsClient.BeginUpdate" @@ -454,7 +454,7 @@ func (client *GalleryApplicationVersionsClient) updateCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-03") + reqQP.Set("api-version", "2023-07-03") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, galleryApplicationVersion); err != nil { 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 9e7d31ed0a1f..000000000000 --- a/sdk/resourcemanager/compute/armcompute/galleryapplicationversions_client_example_test.go +++ /dev/null @@ -1,474 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package 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/v5" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-08-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGalleryApplicationVersionsClient().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:00.000Z"); 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.GalleryApplicationVersion = armcompute.GalleryApplicationVersion{ - // Name: to.Ptr("1.0.0"), - // Type: to.Ptr("Microsoft.Compute/galleries/applications/versions"), - // ID: to.Ptr("/subscriptions/01523d7c-60da-455e-adef-521b547922c4/resourceGroups/galleryPsTestRg98/providers/Microsoft.Compute/galleries/galleryPsTestGallery6165/applications/galleryPsTestGalleryApplication7825/versions/1.0.0"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.GalleryApplicationVersionProperties{ - // ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded), - // PublishingProfile: &armcompute.GalleryApplicationVersionPublishingProfile{ - // EndOfLifeDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-07-01T07:00:00.000Z"); return t}()), - // ExcludeFromLatest: to.Ptr(false), - // PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-06-21T17:13:57.597Z"); 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), - // }}, - // AdvancedSettings: map[string]*string{ - // "timeout": to.Ptr("300"), - // "user": to.Ptr("root"), - // }, - // 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"), - // }}, - // EnableHealthCheck: to.Ptr(false), - // ManageActions: &armcompute.UserArtifactManage{ - // Install: to.Ptr("powershell -command \"Expand-Archive -Path package.zip -DestinationPath C:\\package\""), - // Remove: to.Ptr("del C:\\package "), - // }, - // Settings: &armcompute.UserArtifactSettings{ - // ConfigFileName: to.Ptr("configuration.cfg"), - // PackageFileName: to.Ptr("package.zip"), - // }, - // Source: &armcompute.UserArtifactSource{ - // MediaLink: to.Ptr("https://mystorageaccount.blob.core.windows.net/mycontainer/package.zip?{sasKey}"), - // }, - // }, - // SafetyProfile: &armcompute.GalleryApplicationVersionSafetyProfile{ - // AllowDeletionOfReplicatedLocations: to.Ptr(false), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-08-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGalleryApplicationVersionsClient().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:00.000Z"); 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.GalleryApplicationVersion = armcompute.GalleryApplicationVersion{ - // Name: to.Ptr("1.0.0"), - // Type: to.Ptr("Microsoft.Compute/galleries/applications/versions"), - // ID: to.Ptr("/subscriptions/01523d7c-60da-455e-adef-521b547922c4/resourceGroups/galleryPsTestRg98/providers/Microsoft.Compute/galleries/galleryPsTestGallery6165/applications/galleryPsTestGalleryApplication7825/versions/1.0.0"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.GalleryApplicationVersionProperties{ - // ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded), - // PublishingProfile: &armcompute.GalleryApplicationVersionPublishingProfile{ - // EndOfLifeDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-07-01T07:00:00.000Z"); return t}()), - // ExcludeFromLatest: to.Ptr(false), - // PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-06-21T17:13:57.597Z"); 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), - // }}, - // EnableHealthCheck: to.Ptr(false), - // 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), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-08-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewGalleryApplicationVersionsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.GalleryApplicationVersion = armcompute.GalleryApplicationVersion{ - // Name: to.Ptr("1.0.0"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGalleryName/applications/myGalleryApplicationName/versions/1.0.0"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.GalleryApplicationVersionProperties{ - // ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded), - // PublishingProfile: &armcompute.GalleryApplicationVersionPublishingProfile{ - // EndOfLifeDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-07-01T07:00:00.000Z"); return t}()), - // ExcludeFromLatest: to.Ptr(false), - // PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-06-21T17:13:57.597Z"); 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), - // }}, - // AdvancedSettings: map[string]*string{ - // "timeout": to.Ptr("300"), - // "user": to.Ptr("root"), - // }, - // 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"), - // }}, - // EnableHealthCheck: to.Ptr(false), - // ManageActions: &armcompute.UserArtifactManage{ - // Install: to.Ptr("powershell -command \"Expand-Archive -Path package.zip -DestinationPath C:\\package\""), - // Remove: to.Ptr("del C:\\package "), - // }, - // Settings: &armcompute.UserArtifactSettings{ - // ConfigFileName: to.Ptr("configuration.cfg"), - // PackageFileName: to.Ptr("package.zip"), - // }, - // Source: &armcompute.UserArtifactSource{ - // MediaLink: to.Ptr("https://mystorageaccount.blob.core.windows.net/mycontainer/package.zip?{sasKey}"), - // }, - // }, - // ReplicationStatus: &armcompute.ReplicationStatus{ - // AggregatedState: to.Ptr(armcompute.AggregatedReplicationStateCompleted), - // Summary: []*armcompute.RegionalReplicationStatus{ - // { - // Progress: to.Ptr[int32](100), - // Region: to.Ptr("West US"), - // State: to.Ptr(armcompute.ReplicationStateCompleted), - // Details: to.Ptr(""), - // }}, - // }, - // SafetyProfile: &armcompute.GalleryApplicationVersionSafetyProfile{ - // AllowDeletionOfReplicatedLocations: to.Ptr(false), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-08-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewGalleryApplicationVersionsClient().Get(ctx, "myResourceGroup", "myGalleryName", "myGalleryApplicationName", "1.0.0", &armcompute.GalleryApplicationVersionsClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.GalleryApplicationVersion = armcompute.GalleryApplicationVersion{ - // Name: to.Ptr("1.0.0"), - // Type: to.Ptr("Microsoft.Compute/galleries/applications/versions"), - // ID: to.Ptr("/subscriptions/01523d7c-60da-455e-adef-521b547922c4/resourceGroups/galleryPsTestRg98/providers/Microsoft.Compute/galleries/galleryPsTestGallery6165/applications/galleryPsTestGalleryApplication7825/versions/1.0.0"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.GalleryApplicationVersionProperties{ - // ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded), - // PublishingProfile: &armcompute.GalleryApplicationVersionPublishingProfile{ - // EndOfLifeDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-07-01T07:00:00.000Z"); return t}()), - // ExcludeFromLatest: to.Ptr(false), - // PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-06-21T17:13:57.597Z"); 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"), - // }}, - // EnableHealthCheck: to.Ptr(false), - // 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), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-08-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGalleryApplicationVersionsClient().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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-08-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewGalleryApplicationVersionsClient().NewListByGalleryApplicationPager("myResourceGroup", "myGalleryName", "myGalleryApplicationName", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.GalleryApplicationVersionList = armcompute.GalleryApplicationVersionList{ - // Value: []*armcompute.GalleryApplicationVersion{ - // { - // Name: to.Ptr("1.0.0"), - // Type: to.Ptr("Microsoft.Compute/galleries/applications/versions"), - // ID: to.Ptr("/subscriptions/01523d7c-60da-455e-adef-521b547922c4/resourceGroups/galleryPsTestRg98/providers/Microsoft.Compute/galleries/galleryPsTestGallery6165/applications/galleryPsTestGalleryApplication7825/versions/1.0.0"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.GalleryApplicationVersionProperties{ - // ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded), - // PublishingProfile: &armcompute.GalleryApplicationVersionPublishingProfile{ - // EndOfLifeDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-07-01T07:00:00.000Z"); return t}()), - // ExcludeFromLatest: to.Ptr(false), - // PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-06-21T17:13:57.597Z"); 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"), - // }}, - // EnableHealthCheck: to.Ptr(false), - // 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), - // }, - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/compute/armcompute/galleryimages_client.go b/sdk/resourcemanager/compute/armcompute/galleryimages_client.go index 6a684b3ed613..8be1a5784a01 100644 --- a/sdk/resourcemanager/compute/armcompute/galleryimages_client.go +++ b/sdk/resourcemanager/compute/armcompute/galleryimages_client.go @@ -47,7 +47,7 @@ func NewGalleryImagesClient(subscriptionID string, credential azcore.TokenCreden // BeginCreateOrUpdate - Create or update a gallery image definition. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-08-03 +// Generated from API version 2023-07-03 // - resourceGroupName - The name of the resource group. // - galleryName - The name of the Shared Image Gallery in which the Image Definition is to be created. // - galleryImageName - The name of the gallery image definition to be created or updated. The allowed characters are alphabets @@ -76,7 +76,7 @@ func (client *GalleryImagesClient) BeginCreateOrUpdate(ctx context.Context, reso // CreateOrUpdate - Create or update a gallery image definition. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-08-03 +// Generated from API version 2023-07-03 func (client *GalleryImagesClient) createOrUpdate(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string, galleryImage GalleryImage, options *GalleryImagesClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "GalleryImagesClient.BeginCreateOrUpdate" @@ -122,7 +122,7 @@ func (client *GalleryImagesClient) createOrUpdateCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-03") + reqQP.Set("api-version", "2023-07-03") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, galleryImage); err != nil { @@ -134,7 +134,7 @@ func (client *GalleryImagesClient) createOrUpdateCreateRequest(ctx context.Conte // BeginDelete - Delete a gallery image. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-08-03 +// Generated from API version 2023-07-03 // - resourceGroupName - The name of the resource group. // - galleryName - The name of the Shared Image Gallery in which the Image Definition is to be deleted. // - galleryImageName - The name of the gallery image definition to be deleted. @@ -160,7 +160,7 @@ func (client *GalleryImagesClient) BeginDelete(ctx context.Context, resourceGrou // Delete - Delete a gallery image. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-08-03 +// Generated from API version 2023-07-03 func (client *GalleryImagesClient) deleteOperation(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string, options *GalleryImagesClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "GalleryImagesClient.BeginDelete" @@ -206,7 +206,7 @@ func (client *GalleryImagesClient) deleteCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-03") + reqQP.Set("api-version", "2023-07-03") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -215,7 +215,7 @@ func (client *GalleryImagesClient) deleteCreateRequest(ctx context.Context, reso // Get - Retrieves information about a gallery image definition. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-08-03 +// Generated from API version 2023-07-03 // - resourceGroupName - The name of the resource group. // - galleryName - The name of the Shared Image Gallery from which the Image Definitions are to be retrieved. // - galleryImageName - The name of the gallery image definition to be retrieved. @@ -266,7 +266,7 @@ func (client *GalleryImagesClient) getCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-03") + reqQP.Set("api-version", "2023-07-03") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -283,7 +283,7 @@ func (client *GalleryImagesClient) getHandleResponse(resp *http.Response) (Galle // NewListByGalleryPager - List gallery image definitions in a gallery. // -// Generated from API version 2022-08-03 +// Generated from API version 2023-07-03 // - resourceGroupName - The name of the resource group. // - galleryName - The name of the Shared Image Gallery from which Image Definitions are to be listed. // - options - GalleryImagesClientListByGalleryOptions contains the optional parameters for the GalleryImagesClient.NewListByGalleryPager @@ -331,7 +331,7 @@ func (client *GalleryImagesClient) listByGalleryCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-03") + reqQP.Set("api-version", "2023-07-03") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -349,7 +349,7 @@ func (client *GalleryImagesClient) listByGalleryHandleResponse(resp *http.Respon // BeginUpdate - Update a gallery image definition. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-08-03 +// Generated from API version 2023-07-03 // - resourceGroupName - The name of the resource group. // - galleryName - The name of the Shared Image Gallery in which the Image Definition is to be updated. // - galleryImageName - The name of the gallery image definition to be updated. The allowed characters are alphabets and numbers @@ -377,7 +377,7 @@ func (client *GalleryImagesClient) BeginUpdate(ctx context.Context, resourceGrou // Update - Update a gallery image definition. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-08-03 +// Generated from API version 2023-07-03 func (client *GalleryImagesClient) update(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string, galleryImage GalleryImageUpdate, options *GalleryImagesClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "GalleryImagesClient.BeginUpdate" @@ -423,7 +423,7 @@ func (client *GalleryImagesClient) updateCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-03") + reqQP.Set("api-version", "2023-07-03") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, galleryImage); err != nil { 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 7913a3dc3994..000000000000 --- a/sdk/resourcemanager/compute/armcompute/galleryimages_client_example_test.go +++ /dev/null @@ -1,222 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package 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/v5" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-08-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGalleryImagesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.GalleryImage = armcompute.GalleryImage{ - // Name: to.Ptr("myGalleryImageName"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGallery/Images/myGalleryImageName"), - // 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), - // ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-08-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGalleryImagesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.GalleryImage = armcompute.GalleryImage{ - // Name: to.Ptr("myGalleryImageName"), - // 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), - // ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-08-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewGalleryImagesClient().Get(ctx, "myResourceGroup", "myGalleryName", "myGalleryImageName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.GalleryImage = armcompute.GalleryImage{ - // Name: to.Ptr("myGalleryImageName"), - // ID: to.Ptr("/providers/Microsoft.Compute/galleries/myGallery/Images/myGalleryImageName"), - // 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), - // ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-08-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGalleryImagesClient().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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-08-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewGalleryImagesClient().NewListByGalleryPager("myResourceGroup", "myGalleryName", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.GalleryImageList = armcompute.GalleryImageList{ - // Value: []*armcompute.GalleryImage{ - // { - // Name: to.Ptr("myGalleryImageName"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/locations/westus/Galleries/myGalleryName/Images/myGalleryImageName"), - // 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), - // ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/compute/armcompute/galleryimageversions_client.go b/sdk/resourcemanager/compute/armcompute/galleryimageversions_client.go index 05f3cf3526be..b16e42ed74a0 100644 --- a/sdk/resourcemanager/compute/armcompute/galleryimageversions_client.go +++ b/sdk/resourcemanager/compute/armcompute/galleryimageversions_client.go @@ -47,7 +47,7 @@ func NewGalleryImageVersionsClient(subscriptionID string, credential azcore.Toke // BeginCreateOrUpdate - Create or update a gallery image version. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-08-03 +// Generated from API version 2023-07-03 // - resourceGroupName - The name of the resource group. // - galleryName - The name of the Shared Image Gallery in which the Image Definition resides. // - galleryImageName - The name of the gallery image definition in which the Image Version is to be created. @@ -77,7 +77,7 @@ func (client *GalleryImageVersionsClient) BeginCreateOrUpdate(ctx context.Contex // CreateOrUpdate - Create or update a gallery image version. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-08-03 +// Generated from API version 2023-07-03 func (client *GalleryImageVersionsClient) createOrUpdate(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string, galleryImageVersionName string, galleryImageVersion GalleryImageVersion, options *GalleryImageVersionsClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "GalleryImageVersionsClient.BeginCreateOrUpdate" @@ -127,7 +127,7 @@ func (client *GalleryImageVersionsClient) createOrUpdateCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-03") + reqQP.Set("api-version", "2023-07-03") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, galleryImageVersion); err != nil { @@ -139,7 +139,7 @@ func (client *GalleryImageVersionsClient) createOrUpdateCreateRequest(ctx contex // BeginDelete - Delete a gallery image version. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-08-03 +// Generated from API version 2023-07-03 // - resourceGroupName - The name of the resource group. // - galleryName - The name of the Shared Image Gallery in which the Image Definition resides. // - galleryImageName - The name of the gallery image definition in which the Image Version resides. @@ -166,7 +166,7 @@ func (client *GalleryImageVersionsClient) BeginDelete(ctx context.Context, resou // Delete - Delete a gallery image version. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-08-03 +// Generated from API version 2023-07-03 func (client *GalleryImageVersionsClient) deleteOperation(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string, galleryImageVersionName string, options *GalleryImageVersionsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "GalleryImageVersionsClient.BeginDelete" @@ -216,7 +216,7 @@ func (client *GalleryImageVersionsClient) deleteCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-03") + reqQP.Set("api-version", "2023-07-03") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -225,7 +225,7 @@ func (client *GalleryImageVersionsClient) deleteCreateRequest(ctx context.Contex // Get - Retrieves information about a gallery image version. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-08-03 +// Generated from API version 2023-07-03 // - resourceGroupName - The name of the resource group. // - galleryName - The name of the Shared Image Gallery in which the Image Definition resides. // - galleryImageName - The name of the gallery image definition in which the Image Version resides. @@ -285,7 +285,7 @@ func (client *GalleryImageVersionsClient) getCreateRequest(ctx context.Context, if options != nil && options.Expand != nil { reqQP.Set("$expand", string(*options.Expand)) } - reqQP.Set("api-version", "2022-08-03") + reqQP.Set("api-version", "2023-07-03") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -302,7 +302,7 @@ func (client *GalleryImageVersionsClient) getHandleResponse(resp *http.Response) // NewListByGalleryImagePager - List gallery image versions in a gallery image definition. // -// Generated from API version 2022-08-03 +// Generated from API version 2023-07-03 // - resourceGroupName - The name of the resource group. // - galleryName - The name of the Shared Image Gallery in which the Image Definition resides. // - galleryImageName - The name of the Shared Image Gallery Image Definition from which the Image Versions are to be listed. @@ -355,7 +355,7 @@ func (client *GalleryImageVersionsClient) listByGalleryImageCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-03") + reqQP.Set("api-version", "2023-07-03") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -373,7 +373,7 @@ func (client *GalleryImageVersionsClient) listByGalleryImageHandleResponse(resp // BeginUpdate - Update a gallery image version. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-08-03 +// Generated from API version 2023-07-03 // - resourceGroupName - The name of the resource group. // - galleryName - The name of the Shared Image Gallery in which the Image Definition resides. // - galleryImageName - The name of the gallery image definition in which the Image Version is to be updated. @@ -403,7 +403,7 @@ func (client *GalleryImageVersionsClient) BeginUpdate(ctx context.Context, resou // Update - Update a gallery image version. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-08-03 +// Generated from API version 2023-07-03 func (client *GalleryImageVersionsClient) update(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string, galleryImageVersionName string, galleryImageVersion GalleryImageVersionUpdate, options *GalleryImageVersionsClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "GalleryImageVersionsClient.BeginUpdate" @@ -453,7 +453,7 @@ func (client *GalleryImageVersionsClient) updateCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-03") + reqQP.Set("api-version", "2023-07-03") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, galleryImageVersion); err != nil { 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 04d879ca6f9c..000000000000 --- a/sdk/resourcemanager/compute/armcompute/galleryimageversions_client_example_test.go +++ /dev/null @@ -1,2053 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package 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/v5" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-08-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGalleryImageVersionsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.GalleryImageVersion = armcompute.GalleryImageVersion{ - // Name: to.Ptr("1.0.0"), - // ID: to.Ptr("/providers/Microsoft.Compute/locations/westus/Galleries/myGalleryName/Images/myGalleryImageName/Versions/1.0.0"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.GalleryImageVersionProperties{ - // ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded), - // PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{ - // PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-01T00:00:00.000Z"); return t}()), - // ReplicaCount: to.Ptr[int32](1), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - // 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), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - // }, - // { - // 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), - // PolicyViolations: []*armcompute.PolicyViolation{ - // { - // Category: to.Ptr(armcompute.PolicyViolationCategoryImageFlaggedUnsafe), - // Details: to.Ptr("This is the policy violation details."), - // }}, - // ReportedForPolicyViolation: to.Ptr(true), - // }, - // StorageProfile: &armcompute.GalleryImageVersionStorageProfile{ - // DataDiskImages: []*armcompute.GalleryDataDiskImage{ - // { - // HostCaching: to.Ptr(armcompute.HostCachingNone), - // SizeInGB: to.Ptr[int32](10), - // Lun: to.Ptr[int32](1), - // }}, - // OSDiskImage: &armcompute.GalleryOSDiskImage{ - // HostCaching: to.Ptr(armcompute.HostCachingReadOnly), - // SizeInGB: to.Ptr[int32](10), - // }, - // Source: &armcompute.GalleryArtifactVersionFullSource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/virtualMachines/{vmName}"), - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-08-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGalleryImageVersionsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.GalleryImageVersion = armcompute.GalleryImageVersion{ - // Name: to.Ptr("1.0.0"), - // ID: to.Ptr("/providers/Microsoft.Compute/locations/westus/Galleries/myGalleryName/Images/myGalleryImageName/Versions/1.0.0"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.GalleryImageVersionProperties{ - // ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded), - // PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{ - // PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-01T00:00:00.000Z"); return t}()), - // ReplicaCount: to.Ptr[int32](1), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - // 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), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - // }, - // { - // 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), - // PolicyViolations: []*armcompute.PolicyViolation{ - // { - // Category: to.Ptr(armcompute.PolicyViolationCategoryImageFlaggedUnsafe), - // Details: to.Ptr("This is the policy violation details."), - // }}, - // ReportedForPolicyViolation: to.Ptr(true), - // }, - // StorageProfile: &armcompute.GalleryImageVersionStorageProfile{ - // DataDiskImages: []*armcompute.GalleryDataDiskImage{ - // { - // HostCaching: to.Ptr(armcompute.HostCachingNone), - // SizeInGB: to.Ptr[int32](10), - // Lun: to.Ptr[int32](1), - // }}, - // OSDiskImage: &armcompute.GalleryOSDiskImage{ - // HostCaching: to.Ptr(armcompute.HostCachingReadOnly), - // SizeInGB: to.Ptr[int32](10), - // }, - // Source: &armcompute.GalleryArtifactVersionFullSource{ - // CommunityGalleryImageID: to.Ptr("/communityGalleries/{communityGalleryName}/images/{communityGalleryImageName}"), - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-08-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGalleryImageVersionsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.GalleryImageVersion = armcompute.GalleryImageVersion{ - // Name: to.Ptr("1.0.0"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/locations/westus/Galleries/myGalleryName/Images/myGalleryImageName/Versions/1.0.0"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.GalleryImageVersionProperties{ - // ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded), - // PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{ - // PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-01T00:00:00.000Z"); return t}()), - // ReplicaCount: to.Ptr[int32](1), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - // 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), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - // }, - // { - // 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), - // PolicyViolations: []*armcompute.PolicyViolation{ - // { - // Category: to.Ptr(armcompute.PolicyViolationCategoryImageFlaggedUnsafe), - // Details: to.Ptr("This is the policy violation details."), - // }}, - // ReportedForPolicyViolation: to.Ptr(true), - // }, - // StorageProfile: &armcompute.GalleryImageVersionStorageProfile{ - // DataDiskImages: []*armcompute.GalleryDataDiskImage{ - // { - // HostCaching: to.Ptr(armcompute.HostCachingNone), - // SizeInGB: to.Ptr[int32](10), - // Lun: to.Ptr[int32](1), - // }}, - // OSDiskImage: &armcompute.GalleryOSDiskImage{ - // HostCaching: to.Ptr(armcompute.HostCachingReadOnly), - // SizeInGB: to.Ptr[int32](10), - // }, - // Source: &armcompute.GalleryArtifactVersionFullSource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/images/{imageName}"), - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-08-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGalleryImageVersionsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.GalleryImageVersion = armcompute.GalleryImageVersion{ - // Name: to.Ptr("1.0.0"), - // ID: to.Ptr("/providers/Microsoft.Compute/locations/westus/Galleries/myGalleryName/Images/myGalleryImageName/Versions/1.0.0"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.GalleryImageVersionProperties{ - // ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded), - // PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{ - // PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-01T00:00:00.000Z"); return t}()), - // ReplicaCount: to.Ptr[int32](1), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - // 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), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - // }, - // { - // 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), - // PolicyViolations: []*armcompute.PolicyViolation{ - // { - // Category: to.Ptr(armcompute.PolicyViolationCategoryImageFlaggedUnsafe), - // Details: to.Ptr("This is the policy violation details."), - // }}, - // ReportedForPolicyViolation: to.Ptr(true), - // }, - // StorageProfile: &armcompute.GalleryImageVersionStorageProfile{ - // DataDiskImages: []*armcompute.GalleryDataDiskImage{ - // { - // HostCaching: to.Ptr(armcompute.HostCachingNone), - // SizeInGB: to.Ptr[int32](10), - // 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), - // SizeInGB: to.Ptr[int32](10), - // Source: &armcompute.GalleryDiskImageSource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/snapshots/{osSnapshotName}"), - // }, - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-08-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGalleryImageVersionsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.GalleryImageVersion = armcompute.GalleryImageVersion{ - // Name: to.Ptr("1.0.0"), - // ID: to.Ptr("/providers/Microsoft.Compute/locations/westus/Galleries/myGalleryName/Images/myGalleryImageName/Versions/1.0.0"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.GalleryImageVersionProperties{ - // ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded), - // PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{ - // PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-01T00:00:00.000Z"); return t}()), - // ReplicaCount: to.Ptr[int32](1), - // ReplicationMode: to.Ptr(armcompute.ReplicationModeShallow), - // 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), - // }}, - // }, - // SafetyProfile: &armcompute.GalleryImageVersionSafetyProfile{ - // AllowDeletionOfReplicatedLocations: to.Ptr(false), - // PolicyViolations: []*armcompute.PolicyViolation{ - // { - // Category: to.Ptr(armcompute.PolicyViolationCategoryImageFlaggedUnsafe), - // Details: to.Ptr("This is the policy violation details."), - // }}, - // ReportedForPolicyViolation: to.Ptr(true), - // }, - // StorageProfile: &armcompute.GalleryImageVersionStorageProfile{ - // DataDiskImages: []*armcompute.GalleryDataDiskImage{ - // { - // HostCaching: to.Ptr(armcompute.HostCachingNone), - // SizeInGB: to.Ptr[int32](10), - // Lun: to.Ptr[int32](1), - // }}, - // OSDiskImage: &armcompute.GalleryOSDiskImage{ - // HostCaching: to.Ptr(armcompute.HostCachingReadOnly), - // SizeInGB: to.Ptr[int32](10), - // }, - // Source: &armcompute.GalleryArtifactVersionFullSource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/images/{imageName}"), - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-08-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGalleryImageVersionsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.GalleryImageVersion = armcompute.GalleryImageVersion{ - // Name: to.Ptr("1.0.0"), - // ID: to.Ptr("/providers/Microsoft.Compute/locations/westus/Galleries/myGalleryName/Images/myGalleryImageName/Versions/1.0.0"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.GalleryImageVersionProperties{ - // ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded), - // PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{ - // PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-01T00:00:00.000Z"); return t}()), - // ReplicaCount: to.Ptr[int32](1), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - // 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), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - // }, - // { - // 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), - // PolicyViolations: []*armcompute.PolicyViolation{ - // { - // Category: to.Ptr(armcompute.PolicyViolationCategoryImageFlaggedUnsafe), - // Details: to.Ptr("This is the policy violation details."), - // }}, - // ReportedForPolicyViolation: to.Ptr(true), - // }, - // StorageProfile: &armcompute.GalleryImageVersionStorageProfile{ - // DataDiskImages: []*armcompute.GalleryDataDiskImage{ - // { - // HostCaching: to.Ptr(armcompute.HostCachingNone), - // SizeInGB: to.Ptr[int32](10), - // Lun: to.Ptr[int32](1), - // }}, - // OSDiskImage: &armcompute.GalleryOSDiskImage{ - // HostCaching: to.Ptr(armcompute.HostCachingReadOnly), - // SizeInGB: to.Ptr[int32](10), - // }, - // Source: &armcompute.GalleryArtifactVersionFullSource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/galleries/{galleryName}/images/{imageDefinitionName}/versions/{versionName}"), - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-08-03/examples/galleryExamples/GalleryImageVersion_Create_WithVHD_UefiSettings.json -func ExampleGalleryImageVersionsClient_BeginCreateOrUpdate_createOrUpdateASimpleGalleryImageVersionUsingVhdAsASourceWithCustomUefiKeys() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGalleryImageVersionsClient().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), - }, - SecurityProfile: &armcompute.ImageVersionSecurityProfile{ - UefiSettings: &armcompute.GalleryImageVersionUefiSettings{ - AdditionalSignatures: &armcompute.UefiKeySignatures{ - Db: []*armcompute.UefiKey{ - { - Type: to.Ptr(armcompute.UefiKeyTypeX509), - Value: []*string{ - to.Ptr("")}, - }}, - Dbx: []*armcompute.UefiKey{ - { - Type: to.Ptr(armcompute.UefiKeyTypeX509), - Value: []*string{ - to.Ptr("")}, - }}, - Kek: []*armcompute.UefiKey{ - { - Type: to.Ptr(armcompute.UefiKeyTypeSHA256), - Value: []*string{ - to.Ptr("")}, - }}, - }, - SignatureTemplateNames: []*armcompute.UefiSignatureTemplateName{ - to.Ptr(armcompute.UefiSignatureTemplateNameMicrosoftUefiCertificateAuthorityTemplate)}, - }, - }, - StorageProfile: &armcompute.GalleryImageVersionStorageProfile{ - DataDiskImages: []*armcompute.GalleryDataDiskImage{ - { - HostCaching: to.Ptr(armcompute.HostCachingNone), - Source: &armcompute.GalleryDiskImageSource{ - StorageAccountID: 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{ - StorageAccountID: 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.GalleryImageVersion = armcompute.GalleryImageVersion{ - // Name: to.Ptr("1.0.0"), - // ID: to.Ptr("/providers/Microsoft.Compute/locations/westus/Galleries/myGalleryName/Images/myGalleryImageName/Versions/1.0.0"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.GalleryImageVersionProperties{ - // ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded), - // PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{ - // PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-01T00:00:00.000Z"); return t}()), - // ReplicaCount: to.Ptr[int32](1), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - // 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), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - // }, - // { - // 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), - // PolicyViolations: []*armcompute.PolicyViolation{ - // { - // Category: to.Ptr(armcompute.PolicyViolationCategoryImageFlaggedUnsafe), - // Details: to.Ptr("This is the policy violation details."), - // }}, - // ReportedForPolicyViolation: to.Ptr(true), - // }, - // SecurityProfile: &armcompute.ImageVersionSecurityProfile{ - // UefiSettings: &armcompute.GalleryImageVersionUefiSettings{ - // AdditionalSignatures: &armcompute.UefiKeySignatures{ - // Db: []*armcompute.UefiKey{ - // { - // Type: to.Ptr(armcompute.UefiKeyTypeX509), - // Value: []*string{ - // to.Ptr("")}, - // }}, - // Dbx: []*armcompute.UefiKey{ - // { - // Type: to.Ptr(armcompute.UefiKeyTypeX509), - // Value: []*string{ - // to.Ptr("")}, - // }}, - // Kek: []*armcompute.UefiKey{ - // { - // Type: to.Ptr(armcompute.UefiKeyTypeSHA256), - // Value: []*string{ - // to.Ptr("")}, - // }}, - // }, - // SignatureTemplateNames: []*armcompute.UefiSignatureTemplateName{ - // to.Ptr(armcompute.UefiSignatureTemplateNameMicrosoftUefiCertificateAuthorityTemplate)}, - // }, - // }, - // StorageProfile: &armcompute.GalleryImageVersionStorageProfile{ - // DataDiskImages: []*armcompute.GalleryDataDiskImage{ - // { - // HostCaching: to.Ptr(armcompute.HostCachingNone), - // Source: &armcompute.GalleryDiskImageSource{ - // StorageAccountID: 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{ - // StorageAccountID: 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"), - // }, - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-08-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGalleryImageVersionsClient().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{ - StorageAccountID: 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{ - StorageAccountID: 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.GalleryImageVersion = armcompute.GalleryImageVersion{ - // Name: to.Ptr("1.0.0"), - // ID: to.Ptr("/providers/Microsoft.Compute/locations/westus/Galleries/myGalleryName/Images/myGalleryImageName/Versions/1.0.0"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.GalleryImageVersionProperties{ - // ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded), - // PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{ - // PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-01T00:00:00.000Z"); return t}()), - // ReplicaCount: to.Ptr[int32](1), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - // 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), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - // }, - // { - // 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), - // PolicyViolations: []*armcompute.PolicyViolation{ - // { - // Category: to.Ptr(armcompute.PolicyViolationCategoryImageFlaggedUnsafe), - // Details: to.Ptr("This is the policy violation details."), - // }}, - // ReportedForPolicyViolation: to.Ptr(true), - // }, - // StorageProfile: &armcompute.GalleryImageVersionStorageProfile{ - // DataDiskImages: []*armcompute.GalleryDataDiskImage{ - // { - // HostCaching: to.Ptr(armcompute.HostCachingNone), - // Source: &armcompute.GalleryDiskImageSource{ - // StorageAccountID: 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{ - // StorageAccountID: 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"), - // }, - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-08-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGalleryImageVersionsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.GalleryImageVersion = armcompute.GalleryImageVersion{ - // Name: to.Ptr("1.0.0"), - // ID: to.Ptr("/providers/Microsoft.Compute/locations/westus/Galleries/myGalleryName/Images/myGalleryImageName/Versions/1.0.0"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.GalleryImageVersionProperties{ - // ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded), - // PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{ - // PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-01T00:00:00.000Z"); return t}()), - // ReplicaCount: to.Ptr[int32](1), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - // TargetExtendedLocations: []*armcompute.GalleryTargetExtendedLocation{ - // { - // 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](0), - // }}, - // OSDiskImage: &armcompute.OSDiskImageEncryption{ - // DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"), - // }, - // }, - // ExtendedLocation: &armcompute.GalleryExtendedLocation{ - // Name: to.Ptr("microsoftlosangeles1"), - // Type: to.Ptr(armcompute.GalleryExtendedLocationTypeEdgeZone), - // }, - // ExtendedLocationReplicaCount: to.Ptr[int32](1), - // StorageAccountType: to.Ptr(armcompute.EdgeZoneStorageAccountType("StandardSSD_LRS(default)")), - // }, - // { - // 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](0), - // }}, - // OSDiskImage: &armcompute.OSDiskImageEncryption{ - // DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"), - // }, - // }, - // ExtendedLocation: &armcompute.GalleryExtendedLocation{ - // Name: to.Ptr("microsoftnewyork1"), - // Type: to.Ptr(armcompute.GalleryExtendedLocationTypeEdgeZone), - // }, - // ExtendedLocationReplicaCount: to.Ptr[int32](1), - // StorageAccountType: to.Ptr(armcompute.EdgeZoneStorageAccountType("StandardSSD_LRS(default)")), - // }}, - // 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), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - // }, - // { - // 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), - // PolicyViolations: []*armcompute.PolicyViolation{ - // { - // Category: to.Ptr(armcompute.PolicyViolationCategoryImageFlaggedUnsafe), - // Details: to.Ptr("This is the policy violation details."), - // }}, - // ReportedForPolicyViolation: to.Ptr(true), - // }, - // StorageProfile: &armcompute.GalleryImageVersionStorageProfile{ - // DataDiskImages: []*armcompute.GalleryDataDiskImage{ - // { - // HostCaching: to.Ptr(armcompute.HostCachingNone), - // SizeInGB: to.Ptr[int32](10), - // Lun: to.Ptr[int32](1), - // }}, - // OSDiskImage: &armcompute.GalleryOSDiskImage{ - // HostCaching: to.Ptr(armcompute.HostCachingReadOnly), - // SizeInGB: to.Ptr[int32](10), - // }, - // Source: &armcompute.GalleryArtifactVersionFullSource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/images/{imageName}"), - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-08-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGalleryImageVersionsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.GalleryImageVersion = armcompute.GalleryImageVersion{ - // Name: to.Ptr("1.0.0"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.GalleryImageVersionProperties{ - // ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded), - // PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{ - // PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-01T00:00:00.000Z"); return t}()), - // ReplicaCount: to.Ptr[int32](1), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - // 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/myDiskEncryptionSet"), - // 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), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - // }, - // { - // Name: to.Ptr("East US"), - // ExcludeFromLatest: to.Ptr(false), - // RegionalReplicaCount: to.Ptr[int32](2), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardZRS), - // }}, - // }, - // StorageProfile: &armcompute.GalleryImageVersionStorageProfile{ - // DataDiskImages: []*armcompute.GalleryDataDiskImage{ - // { - // HostCaching: to.Ptr(armcompute.HostCachingNone), - // SizeInGB: to.Ptr[int32](10), - // Lun: to.Ptr[int32](1), - // }}, - // OSDiskImage: &armcompute.GalleryOSDiskImage{ - // HostCaching: to.Ptr(armcompute.HostCachingReadOnly), - // SizeInGB: to.Ptr[int32](10), - // }, - // Source: &armcompute.GalleryArtifactVersionFullSource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/images/{imageName}"), - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-08-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGalleryImageVersionsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.GalleryImageVersion = armcompute.GalleryImageVersion{ - // Name: to.Ptr("1.0.0"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.GalleryImageVersionProperties{ - // ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded), - // PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{ - // PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-01T00:00:00.000Z"); return t}()), - // ReplicaCount: to.Ptr[int32](1), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - // 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/myDiskEncryptionSet"), - // 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), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - // }, - // { - // Name: to.Ptr("East US"), - // ExcludeFromLatest: to.Ptr(false), - // RegionalReplicaCount: to.Ptr[int32](2), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardZRS), - // }}, - // }, - // StorageProfile: &armcompute.GalleryImageVersionStorageProfile{ - // DataDiskImages: []*armcompute.GalleryDataDiskImage{ - // { - // HostCaching: to.Ptr(armcompute.HostCachingNone), - // SizeInGB: to.Ptr[int32](10), - // Lun: to.Ptr[int32](1), - // }}, - // OSDiskImage: &armcompute.GalleryOSDiskImage{ - // HostCaching: to.Ptr(armcompute.HostCachingReadOnly), - // SizeInGB: to.Ptr[int32](10), - // }, - // Source: &armcompute.GalleryArtifactVersionFullSource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/images/{imageName}"), - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-08-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewGalleryImageVersionsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.GalleryImageVersion = armcompute.GalleryImageVersion{ - // Name: to.Ptr("1.0.0"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/locations/westus/Galleries/myGalleryName/Images/myGalleryImageName/Versions/1.0.0"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.GalleryImageVersionProperties{ - // ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded), - // PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{ - // PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-01T00:00:00.000Z"); return t}()), - // ReplicaCount: to.Ptr[int32](1), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - // 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](0), - // }, - // { - // DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myDiskEncryptionSet"), - // 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), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - // }, - // { - // Name: to.Ptr("East US"), - // ExcludeFromLatest: to.Ptr(false), - // RegionalReplicaCount: to.Ptr[int32](2), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - // }}, - // }, - // ReplicationStatus: &armcompute.ReplicationStatus{ - // AggregatedState: to.Ptr(armcompute.AggregatedReplicationStateCompleted), - // Summary: []*armcompute.RegionalReplicationStatus{ - // { - // Progress: to.Ptr[int32](100), - // Region: to.Ptr("West US"), - // State: to.Ptr(armcompute.ReplicationStateCompleted), - // Details: to.Ptr(""), - // }, - // { - // Progress: to.Ptr[int32](100), - // Region: to.Ptr("East US"), - // State: to.Ptr(armcompute.ReplicationStateCompleted), - // Details: to.Ptr(""), - // }}, - // }, - // SafetyProfile: &armcompute.GalleryImageVersionSafetyProfile{ - // AllowDeletionOfReplicatedLocations: to.Ptr(false), - // PolicyViolations: []*armcompute.PolicyViolation{ - // { - // Category: to.Ptr(armcompute.PolicyViolationCategoryImageFlaggedUnsafe), - // Details: to.Ptr("This is the policy violation details."), - // }}, - // ReportedForPolicyViolation: to.Ptr(true), - // }, - // StorageProfile: &armcompute.GalleryImageVersionStorageProfile{ - // DataDiskImages: []*armcompute.GalleryDataDiskImage{ - // { - // HostCaching: to.Ptr(armcompute.HostCachingNone), - // SizeInGB: to.Ptr[int32](10), - // Lun: to.Ptr[int32](1), - // }}, - // OSDiskImage: &armcompute.GalleryOSDiskImage{ - // HostCaching: to.Ptr(armcompute.HostCachingReadOnly), - // SizeInGB: to.Ptr[int32](10), - // }, - // Source: &armcompute.GalleryArtifactVersionFullSource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/images/{imageName}"), - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-08-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewGalleryImageVersionsClient().Get(ctx, "myResourceGroup", "myGalleryName", "myGalleryImageName", "1.0.0", &armcompute.GalleryImageVersionsClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.GalleryImageVersion = armcompute.GalleryImageVersion{ - // Name: to.Ptr("1.0.0"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/locations/westus/Galleries/myGalleryName/Images/myGalleryImageName/Versions/1.0.0"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.GalleryImageVersionProperties{ - // ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded), - // PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{ - // PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-01T00:00:00.000Z"); return t}()), - // ReplicaCount: to.Ptr[int32](1), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - // 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/myDiskEncryptionSet"), - // 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), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - // }, - // { - // Name: to.Ptr("East US"), - // ExcludeFromLatest: to.Ptr(false), - // RegionalReplicaCount: to.Ptr[int32](2), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - // }}, - // }, - // SafetyProfile: &armcompute.GalleryImageVersionSafetyProfile{ - // AllowDeletionOfReplicatedLocations: to.Ptr(false), - // PolicyViolations: []*armcompute.PolicyViolation{ - // { - // Category: to.Ptr(armcompute.PolicyViolationCategoryImageFlaggedUnsafe), - // Details: to.Ptr("This is the policy violation details."), - // }}, - // ReportedForPolicyViolation: to.Ptr(true), - // }, - // StorageProfile: &armcompute.GalleryImageVersionStorageProfile{ - // DataDiskImages: []*armcompute.GalleryDataDiskImage{ - // { - // HostCaching: to.Ptr(armcompute.HostCachingNone), - // SizeInGB: to.Ptr[int32](10), - // Source: &armcompute.GalleryDiskImageSource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/snapshots/{diskSnapshotName}"), - // }, - // Lun: to.Ptr[int32](1), - // }}, - // OSDiskImage: &armcompute.GalleryOSDiskImage{ - // HostCaching: to.Ptr(armcompute.HostCachingReadOnly), - // SizeInGB: to.Ptr[int32](10), - // Source: &armcompute.GalleryDiskImageSource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/snapshots/{snapshotName}"), - // }, - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-08-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewGalleryImageVersionsClient().Get(ctx, "myResourceGroup", "myGalleryName", "myGalleryImageName", "1.0.0", &armcompute.GalleryImageVersionsClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.GalleryImageVersion = armcompute.GalleryImageVersion{ - // Name: to.Ptr("1.0.0"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/locations/westus/Galleries/myGalleryName/Images/myGalleryImageName/Versions/1.0.0"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.GalleryImageVersionProperties{ - // ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded), - // PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{ - // PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-01T00:00:00.000Z"); return t}()), - // ReplicaCount: to.Ptr[int32](1), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - // 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/myDiskEncryptionSet"), - // 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), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - // }, - // { - // Name: to.Ptr("East US"), - // ExcludeFromLatest: to.Ptr(false), - // RegionalReplicaCount: to.Ptr[int32](2), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - // }}, - // }, - // SafetyProfile: &armcompute.GalleryImageVersionSafetyProfile{ - // AllowDeletionOfReplicatedLocations: to.Ptr(false), - // PolicyViolations: []*armcompute.PolicyViolation{ - // { - // Category: to.Ptr(armcompute.PolicyViolationCategoryImageFlaggedUnsafe), - // Details: to.Ptr("This is the policy violation details."), - // }}, - // ReportedForPolicyViolation: to.Ptr(true), - // }, - // StorageProfile: &armcompute.GalleryImageVersionStorageProfile{ - // DataDiskImages: []*armcompute.GalleryDataDiskImage{ - // { - // HostCaching: to.Ptr(armcompute.HostCachingNone), - // Source: &armcompute.GalleryDiskImageSource{ - // StorageAccountID: 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{ - // StorageAccountID: 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"), - // }, - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-08-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewGalleryImageVersionsClient().Get(ctx, "myResourceGroup", "myGalleryName", "myGalleryImageName", "1.0.0", &armcompute.GalleryImageVersionsClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.GalleryImageVersion = armcompute.GalleryImageVersion{ - // Name: to.Ptr("1.0.0"), - // ID: to.Ptr("/providers/Microsoft.Compute/locations/westus/Galleries/myGalleryName/Images/myGalleryImageName/Versions/1.0.0"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.GalleryImageVersionProperties{ - // ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded), - // PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{ - // PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-01T00:00:00.000Z"); return t}()), - // ReplicaCount: to.Ptr[int32](1), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - // 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](0), - // }, - // { - // DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myDiskEncryptionSet"), - // 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), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - // }, - // { - // Name: to.Ptr("East US"), - // ExcludeFromLatest: to.Ptr(false), - // RegionalReplicaCount: to.Ptr[int32](2), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - // }}, - // }, - // SafetyProfile: &armcompute.GalleryImageVersionSafetyProfile{ - // AllowDeletionOfReplicatedLocations: to.Ptr(false), - // PolicyViolations: []*armcompute.PolicyViolation{ - // { - // Category: to.Ptr(armcompute.PolicyViolationCategoryImageFlaggedUnsafe), - // Details: to.Ptr("This is the policy violation details."), - // }}, - // ReportedForPolicyViolation: to.Ptr(true), - // }, - // StorageProfile: &armcompute.GalleryImageVersionStorageProfile{ - // DataDiskImages: []*armcompute.GalleryDataDiskImage{ - // { - // HostCaching: to.Ptr(armcompute.HostCachingNone), - // SizeInGB: to.Ptr[int32](10), - // Lun: to.Ptr[int32](1), - // }}, - // OSDiskImage: &armcompute.GalleryOSDiskImage{ - // HostCaching: to.Ptr(armcompute.HostCachingReadOnly), - // SizeInGB: to.Ptr[int32](10), - // }, - // Source: &armcompute.GalleryArtifactVersionFullSource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/images/{imageName}"), - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-08-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGalleryImageVersionsClient().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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-08-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewGalleryImageVersionsClient().NewListByGalleryImagePager("myResourceGroup", "myGalleryName", "myGalleryImageName", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.GalleryImageVersionList = armcompute.GalleryImageVersionList{ - // Value: []*armcompute.GalleryImageVersion{ - // { - // Name: to.Ptr("1.0.0"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/locations/westus/Galleries/myGalleryName/Images/myGalleryImageName/Versions/1.0.0"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.GalleryImageVersionProperties{ - // ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded), - // PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{ - // PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-01T00:00:00.000Z"); return t}()), - // ReplicaCount: to.Ptr[int32](1), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - // 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](0), - // }, - // { - // DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myDiskEncryptionSet"), - // 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), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - // }, - // { - // Name: to.Ptr("East US"), - // ExcludeFromLatest: to.Ptr(false), - // RegionalReplicaCount: to.Ptr[int32](2), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - // }}, - // }, - // SafetyProfile: &armcompute.GalleryImageVersionSafetyProfile{ - // AllowDeletionOfReplicatedLocations: to.Ptr(false), - // PolicyViolations: []*armcompute.PolicyViolation{ - // { - // Category: to.Ptr(armcompute.PolicyViolationCategoryImageFlaggedUnsafe), - // Details: to.Ptr("This is the policy violation details."), - // }}, - // ReportedForPolicyViolation: to.Ptr(true), - // }, - // StorageProfile: &armcompute.GalleryImageVersionStorageProfile{ - // DataDiskImages: []*armcompute.GalleryDataDiskImage{ - // { - // HostCaching: to.Ptr(armcompute.HostCachingNone), - // SizeInGB: to.Ptr[int32](10), - // Lun: to.Ptr[int32](1), - // }}, - // OSDiskImage: &armcompute.GalleryOSDiskImage{ - // HostCaching: to.Ptr(armcompute.HostCachingReadOnly), - // SizeInGB: to.Ptr[int32](10), - // }, - // Source: &armcompute.GalleryArtifactVersionFullSource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/images/{imageName}"), - // }, - // }, - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/compute/armcompute/gallerysharingprofile_client.go b/sdk/resourcemanager/compute/armcompute/gallerysharingprofile_client.go index 28d024e9727e..0ccc5ce9fd60 100644 --- a/sdk/resourcemanager/compute/armcompute/gallerysharingprofile_client.go +++ b/sdk/resourcemanager/compute/armcompute/gallerysharingprofile_client.go @@ -47,7 +47,7 @@ func NewGallerySharingProfileClient(subscriptionID string, credential azcore.Tok // BeginUpdate - Update sharing profile of a gallery. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-08-03 +// Generated from API version 2023-07-03 // - resourceGroupName - The name of the resource group. // - galleryName - The name of the Shared Image Gallery. // - sharingUpdate - Parameters supplied to the update gallery sharing profile. @@ -73,7 +73,7 @@ func (client *GallerySharingProfileClient) BeginUpdate(ctx context.Context, reso // Update - Update sharing profile of a gallery. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-08-03 +// Generated from API version 2023-07-03 func (client *GallerySharingProfileClient) update(ctx context.Context, resourceGroupName string, galleryName string, sharingUpdate SharingUpdate, options *GallerySharingProfileClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "GallerySharingProfileClient.BeginUpdate" @@ -115,7 +115,7 @@ func (client *GallerySharingProfileClient) updateCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-03") + reqQP.Set("api-version", "2023-07-03") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, sharingUpdate); err != nil { 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 c4a07674324a..000000000000 --- a/sdk/resourcemanager/compute/armcompute/gallerysharingprofile_client_example_test.go +++ /dev/null @@ -1,130 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package 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/v5" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-08-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGallerySharingProfileClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SharingUpdate = 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), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-08-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGallerySharingProfileClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SharingUpdate = armcompute.SharingUpdate{ - // OperationType: to.Ptr(armcompute.SharingUpdateOperationTypesReset), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-08-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGallerySharingProfileClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SharingUpdate = armcompute.SharingUpdate{ - // OperationType: to.Ptr(armcompute.SharingUpdateOperationTypesEnableCommunity), - // } -} diff --git a/sdk/resourcemanager/compute/armcompute/go.mod b/sdk/resourcemanager/compute/armcompute/go.mod index 2531ce2e0538..3204870836a1 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.9.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.4.0 github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.0 github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/v2 v2.0.0 github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.1.1 @@ -12,6 +11,7 @@ require ( ) require ( + github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.4.0 // indirect github.com/AzureAD/microsoft-authentication-library-for-go v1.1.1 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/dnaeon/go-vcr v1.2.0 // indirect 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 13dbbb641a15..000000000000 --- a/sdk/resourcemanager/compute/armcompute/images_client_example_test.go +++ /dev/null @@ -1,946 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package 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/v5" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewImagesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Image = armcompute.Image{ - // Name: to.Ptr("myImage"), - // Type: to.Ptr("Microsoft.Compute/images"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/disk/providers/Microsoft.Compute/images/myImage"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.ImageProperties{ - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.ImageStorageProfile{ - // DataDisks: []*armcompute.ImageDataDisk{ - // }, - // OSDisk: &armcompute.ImageOSDisk{ - // BlobURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // 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), - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewImagesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Image = armcompute.Image{ - // Name: to.Ptr("myImage"), - // Type: to.Ptr("Microsoft.Compute/images"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/disk/providers/Microsoft.Compute/images/myImage"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.ImageProperties{ - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.ImageStorageProfile{ - // DataDisks: []*armcompute.ImageDataDisk{ - // }, - // OSDisk: &armcompute.ImageOSDisk{ - // BlobURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // OSState: to.Ptr(armcompute.OperatingSystemStateTypesGeneralized), - // OSType: to.Ptr(armcompute.OperatingSystemTypesLinux), - // }, - // ZoneResilient: to.Ptr(true), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewImagesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Image = armcompute.Image{ - // Name: to.Ptr("myImage"), - // Type: to.Ptr("Microsoft.Compute/images"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/disk/providers/Microsoft.Compute/images/myImage"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.ImageProperties{ - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.ImageStorageProfile{ - // DataDisks: []*armcompute.ImageDataDisk{ - // }, - // OSDisk: &armcompute.ImageOSDisk{ - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // 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), - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewImagesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Image = armcompute.Image{ - // Name: to.Ptr("myImage"), - // Type: to.Ptr("Microsoft.Compute/images"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/disk/providers/Microsoft.Compute/images/myImage"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.ImageProperties{ - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.ImageStorageProfile{ - // DataDisks: []*armcompute.ImageDataDisk{ - // }, - // OSDisk: &armcompute.ImageOSDisk{ - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // 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), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewImagesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Image = armcompute.Image{ - // Name: to.Ptr("myImage"), - // Type: to.Ptr("Microsoft.Compute/images"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/disk/providers/Microsoft.Compute/images/myImage"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.ImageProperties{ - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.ImageStorageProfile{ - // DataDisks: []*armcompute.ImageDataDisk{ - // }, - // OSDisk: &armcompute.ImageOSDisk{ - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // 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), - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewImagesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Image = armcompute.Image{ - // Name: to.Ptr("myImage"), - // Type: to.Ptr("Microsoft.Compute/images"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/disk/providers/Microsoft.Compute/images/myImage"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.ImageProperties{ - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.ImageStorageProfile{ - // DataDisks: []*armcompute.ImageDataDisk{ - // }, - // OSDisk: &armcompute.ImageOSDisk{ - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // 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), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewImagesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Image = armcompute.Image{ - // Name: to.Ptr("myImage"), - // Type: to.Ptr("Microsoft.Compute/images"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/disk/providers/Microsoft.Compute/images/myImage"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.ImageProperties{ - // ProvisioningState: to.Ptr("Succeeded"), - // SourceVirtualMachine: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // }, - // StorageProfile: &armcompute.ImageStorageProfile{ - // DataDisks: []*armcompute.ImageDataDisk{ - // }, - // OSDisk: &armcompute.ImageOSDisk{ - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // ManagedDisk: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myVM_OsDisk_1_6dc293b7d811433196903acf92665022"), - // }, - // OSState: to.Ptr(armcompute.OperatingSystemStateTypesGeneralized), - // OSType: to.Ptr(armcompute.OperatingSystemTypesLinux), - // }, - // ZoneResilient: to.Ptr(false), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewImagesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Image = armcompute.Image{ - // Name: to.Ptr("myImage"), - // Type: to.Ptr("Microsoft.Compute/images"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/disk/providers/Microsoft.Compute/images/myImage"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.ImageProperties{ - // ProvisioningState: to.Ptr("Succeeded"), - // 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"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // OSState: to.Ptr(armcompute.OperatingSystemStateTypesGeneralized), - // OSType: to.Ptr(armcompute.OperatingSystemTypesLinux), - // }, - // ZoneResilient: to.Ptr(false), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewImagesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Image = armcompute.Image{ - // Name: to.Ptr("myImage"), - // Type: to.Ptr("Microsoft.Compute/images"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/disk/providers/Microsoft.Compute/images/myImage"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.ImageProperties{ - // ProvisioningState: to.Ptr("Succeeded"), - // 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{ - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // 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), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewImagesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Image = armcompute.Image{ - // Name: to.Ptr("myImage"), - // Type: to.Ptr("Microsoft.Compute/images"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/disk/providers/Microsoft.Compute/images/myImage"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.ImageProperties{ - // ProvisioningState: to.Ptr("Succeeded"), - // 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{ - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // 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), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewImagesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Image = armcompute.Image{ - // Name: to.Ptr("myImage"), - // Type: to.Ptr("Microsoft.Compute/images"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/images/myImage"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "department": to.Ptr("HR"), - // }, - // Properties: &armcompute.ImageProperties{ - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.ImageStorageProfile{ - // DataDisks: []*armcompute.ImageDataDisk{ - // { - // BlobURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/dataimages/dataimage.vhd"), - // ManagedDisk: &armcompute.SubResource{ - // ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk2"), - // }, - // Snapshot: &armcompute.SubResource{ - // ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot2"), - // }, - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // Lun: to.Ptr[int32](1), - // }}, - // OSDisk: &armcompute.ImageOSDisk{ - // BlobURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd"), - // DiskSizeGB: to.Ptr[int32](20), - // ManagedDisk: &armcompute.SubResource{ - // ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk1"), - // }, - // Snapshot: &armcompute.SubResource{ - // ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot1"), - // }, - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // OSState: to.Ptr(armcompute.OperatingSystemStateTypesGeneralized), - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // ZoneResilient: to.Ptr(true), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/imageExamples/Images_Delete_MaximumSet_Gen.json -func ExampleImagesClient_BeginDelete_imageDeleteMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewImagesClient().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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/imageExamples/Images_Delete_MinimumSet_Gen.json -func ExampleImagesClient_BeginDelete_imageDeleteMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewImagesClient().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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewImagesClient().Get(ctx, "myResourceGroup", "myImage", &armcompute.ImagesClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Image = armcompute.Image{ - // Name: to.Ptr("myImage"), - // Type: to.Ptr("Microsoft.Compute/images"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/images/myImage"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.ImageProperties{ - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.ImageStorageProfile{ - // DataDisks: []*armcompute.ImageDataDisk{ - // { - // BlobURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/dataimages/dataimage.vhd"), - // ManagedDisk: &armcompute.SubResource{ - // ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk2"), - // }, - // Snapshot: &armcompute.SubResource{ - // ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot2"), - // }, - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // Lun: to.Ptr[int32](1), - // }}, - // OSDisk: &armcompute.ImageOSDisk{ - // BlobURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd"), - // DiskSizeGB: to.Ptr[int32](20), - // ManagedDisk: &armcompute.SubResource{ - // ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk1"), - // }, - // Snapshot: &armcompute.SubResource{ - // ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot1"), - // }, - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // OSState: to.Ptr(armcompute.OperatingSystemStateTypesGeneralized), - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // ZoneResilient: to.Ptr(true), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewImagesClient().NewListByResourceGroupPager("myResourceGroup", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ImageListResult = armcompute.ImageListResult{ - // Value: []*armcompute.Image{ - // { - // Name: to.Ptr("myImage"), - // Type: to.Ptr("Microsoft.Compute/images"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/images/myImage"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.ImageProperties{ - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.ImageStorageProfile{ - // DataDisks: []*armcompute.ImageDataDisk{ - // { - // BlobURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/dataimages/dataimage.vhd"), - // ManagedDisk: &armcompute.SubResource{ - // ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk2"), - // }, - // Snapshot: &armcompute.SubResource{ - // ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot2"), - // }, - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // Lun: to.Ptr[int32](1), - // }}, - // OSDisk: &armcompute.ImageOSDisk{ - // BlobURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd"), - // ManagedDisk: &armcompute.SubResource{ - // ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk1"), - // }, - // Snapshot: &armcompute.SubResource{ - // ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot1"), - // }, - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // OSState: to.Ptr(armcompute.OperatingSystemStateTypesGeneralized), - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewImagesClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ImageListResult = armcompute.ImageListResult{ - // Value: []*armcompute.Image{ - // { - // Name: to.Ptr("myImage"), - // Type: to.Ptr("Microsoft.Compute/images"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/images/myImage"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.ImageProperties{ - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.ImageStorageProfile{ - // DataDisks: []*armcompute.ImageDataDisk{ - // { - // BlobURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/dataimages/dataimage.vhd"), - // ManagedDisk: &armcompute.SubResource{ - // ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk2"), - // }, - // Snapshot: &armcompute.SubResource{ - // ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot2"), - // }, - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // Lun: to.Ptr[int32](1), - // }}, - // OSDisk: &armcompute.ImageOSDisk{ - // BlobURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd"), - // ManagedDisk: &armcompute.SubResource{ - // ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk1"), - // }, - // Snapshot: &armcompute.SubResource{ - // ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot1"), - // }, - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // OSState: to.Ptr(armcompute.OperatingSystemStateTypesGeneralized), - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }, - // }, - // }}, - // } - } -} 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 9ad17774a16b..000000000000 --- a/sdk/resourcemanager/compute/armcompute/loganalytics_client_example_test.go +++ /dev/null @@ -1,93 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package 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/v5" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewLogAnalyticsClient().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.862Z"); return t }()), - GroupByResourceName: to.Ptr(true), - ToTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-23T01:54:06.862Z"); 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.LogAnalyticsOperationResult = armcompute.LogAnalyticsOperationResult{ - // Properties: &armcompute.LogAnalyticsOutput{ - // Output: to.Ptr("https://crptestar4227.blob.core.windows.net:443/sascontainer/RequestRateByInterval_20180121-0154_20180123-0154.csv"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewLogAnalyticsClient().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.862Z"); 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.862Z"); 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.LogAnalyticsOperationResult = armcompute.LogAnalyticsOperationResult{ - // Properties: &armcompute.LogAnalyticsOutput{ - // Output: to.Ptr("https://crptestar4227.blob.core.windows.net:443/sascontainer/ThrottledRequests_20180121-0154_20180123-0154.csv"), - // }, - // } -} diff --git a/sdk/resourcemanager/compute/armcompute/models.go b/sdk/resourcemanager/compute/armcompute/models.go index ffba7145d36b..6f755a27ee04 100644 --- a/sdk/resourcemanager/compute/armcompute/models.go +++ b/sdk/resourcemanager/compute/armcompute/models.go @@ -2385,13 +2385,17 @@ type GalleryArtifactVersionFullSource struct { // The resource Id of the source Community Gallery Image. Only required when using Community Gallery Image as a source. CommunityGalleryImageID *string - // The id of the gallery artifact version source. Can specify a disk uri, snapshot uri, user image or storage account resource. + // The id of the gallery artifact version source. ID *string + + // The resource Id of the source virtual machine. Only required when capturing a virtual machine to source this Gallery Image + // Version. + VirtualMachineID *string } // GalleryArtifactVersionSource - The gallery artifact version source. type GalleryArtifactVersionSource struct { - // The id of the gallery artifact version source. Can specify a disk uri, snapshot uri, user image or storage account resource. + // The id of the gallery artifact version source. ID *string } @@ -2426,7 +2430,7 @@ type GalleryDiskImage struct { // GalleryDiskImageSource - The source for the disk image. type GalleryDiskImageSource struct { - // The id of the gallery artifact version source. Can specify a disk uri, snapshot uri, user image or storage account resource. + // The id of the gallery artifact version source. ID *string // The Storage Account Id that contains the vhd blob being used as a source for this artifact version. diff --git a/sdk/resourcemanager/compute/armcompute/models_serde.go b/sdk/resourcemanager/compute/armcompute/models_serde.go index 077f40dd3e0c..4960f80831e5 100644 --- a/sdk/resourcemanager/compute/armcompute/models_serde.go +++ b/sdk/resourcemanager/compute/armcompute/models_serde.go @@ -5492,6 +5492,7 @@ func (g GalleryArtifactVersionFullSource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "communityGalleryImageId", g.CommunityGalleryImageID) populate(objectMap, "id", g.ID) + populate(objectMap, "virtualMachineId", g.VirtualMachineID) return json.Marshal(objectMap) } @@ -5510,6 +5511,9 @@ func (g *GalleryArtifactVersionFullSource) UnmarshalJSON(data []byte) error { case "id": err = unpopulate(val, "ID", &g.ID) delete(rawMsg, key) + case "virtualMachineId": + err = unpopulate(val, "VirtualMachineID", &g.VirtualMachineID) + delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", g, err) 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 a87fff63fc56..000000000000 --- a/sdk/resourcemanager/compute/armcompute/operations_client_example_test.go +++ /dev/null @@ -1,83 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package 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/v5" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewOperationsClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.OperationListResult = armcompute.OperationListResult{ - // Value: []*armcompute.OperationValue{ - // { - // Name: to.Ptr("aaaaaaaaaaaa"), - // Display: &armcompute.OperationValueDisplay{ - // Description: to.Ptr("aaaaaaaaaaaaaaaaaaaaaa"), - // Operation: to.Ptr("aaaaaaaaaaaaaaaaaaaaaa"), - // Provider: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // Resource: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // }, - // Origin: to.Ptr("aaaaa"), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewOperationsClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.OperationListResult = armcompute.OperationListResult{ - // } - } -} 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 528337f27f5b..000000000000 --- a/sdk/resourcemanager/compute/armcompute/proximityplacementgroups_client_example_test.go +++ /dev/null @@ -1,277 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package 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/v5" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewProximityPlacementGroupsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ProximityPlacementGroup = armcompute.ProximityPlacementGroup{ - // Name: to.Ptr("myProximityPlacementGroup"), - // Type: to.Ptr("Microsoft.Compute/proximityPlacementGroups"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/proximityPlacementGroups/myProximityPlacementGroup"), - // 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")}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewProximityPlacementGroupsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ProximityPlacementGroup = armcompute.ProximityPlacementGroup{ - // Name: to.Ptr("myProximityPlacementGroup"), - // Type: to.Ptr("Microsoft.Compute/proximityPlacementGroups"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/proximityPlacementGroups/myProximityPlacementGroup"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.ProximityPlacementGroupProperties{ - // ProximityPlacementGroupType: to.Ptr(armcompute.ProximityPlacementGroupTypeStandard), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewProximityPlacementGroupsClient().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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewProximityPlacementGroupsClient().Get(ctx, "myResourceGroup", "myProximityPlacementGroup", &armcompute.ProximityPlacementGroupsClientGetOptions{IncludeColocationStatus: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ProximityPlacementGroup = armcompute.ProximityPlacementGroup{ - // Name: to.Ptr("myProximityPlacementGroup"), - // Type: to.Ptr("Microsoft.Compute/proximityPlacementGroups"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/proximityPlacementGroups/myProximityPlacementGroup"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.ProximityPlacementGroupProperties{ - // AvailabilitySets: []*armcompute.SubResourceWithColocationStatus{ - // { - // ID: to.Ptr("string"), - // }}, - // Intent: &armcompute.ProximityPlacementGroupPropertiesIntent{ - // VMSizes: []*string{ - // to.Ptr("Basic_A0"), - // to.Ptr("Basic_A2")}, - // }, - // ProximityPlacementGroupType: to.Ptr(armcompute.ProximityPlacementGroupTypeStandard), - // VirtualMachineScaleSets: []*armcompute.SubResourceWithColocationStatus{ - // { - // ID: to.Ptr("string"), - // }}, - // VirtualMachines: []*armcompute.SubResourceWithColocationStatus{ - // { - // ID: to.Ptr("string"), - // }}, - // }, - // Zones: []*string{ - // to.Ptr("1")}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewProximityPlacementGroupsClient().NewListBySubscriptionPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ProximityPlacementGroupListResult = armcompute.ProximityPlacementGroupListResult{ - // Value: []*armcompute.ProximityPlacementGroup{ - // { - // Name: to.Ptr("myProximityPlacementGroup"), - // Type: to.Ptr("Microsoft.Compute/proximityPlacementGroups"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/proximityPlacementGroups/myProximityPlacementGroup"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.ProximityPlacementGroupProperties{ - // AvailabilitySets: []*armcompute.SubResourceWithColocationStatus{ - // { - // ID: to.Ptr("string"), - // }}, - // Intent: &armcompute.ProximityPlacementGroupPropertiesIntent{ - // VMSizes: []*string{ - // to.Ptr("Basic_A0"), - // to.Ptr("Basic_A2")}, - // }, - // ProximityPlacementGroupType: to.Ptr(armcompute.ProximityPlacementGroupTypeStandard), - // VirtualMachineScaleSets: []*armcompute.SubResourceWithColocationStatus{ - // { - // ID: to.Ptr("string"), - // }}, - // VirtualMachines: []*armcompute.SubResourceWithColocationStatus{ - // { - // ID: to.Ptr("string"), - // }}, - // }, - // Zones: []*string{ - // to.Ptr("1")}, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewProximityPlacementGroupsClient().NewListByResourceGroupPager("myResourceGroup", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ProximityPlacementGroupListResult = armcompute.ProximityPlacementGroupListResult{ - // Value: []*armcompute.ProximityPlacementGroup{ - // { - // Name: to.Ptr("myProximityPlacementGroup"), - // Type: to.Ptr("Microsoft.Compute/proximityPlacementGroups"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/proximityPlacementGroups/myProximityPlacementGroup"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.ProximityPlacementGroupProperties{ - // AvailabilitySets: []*armcompute.SubResourceWithColocationStatus{ - // { - // ID: to.Ptr("string"), - // }}, - // Intent: &armcompute.ProximityPlacementGroupPropertiesIntent{ - // VMSizes: []*string{ - // to.Ptr("Basic_A0"), - // to.Ptr("Basic_A2")}, - // }, - // ProximityPlacementGroupType: to.Ptr(armcompute.ProximityPlacementGroupTypeStandard), - // VirtualMachineScaleSets: []*armcompute.SubResourceWithColocationStatus{ - // { - // ID: to.Ptr("string"), - // }}, - // VirtualMachines: []*armcompute.SubResourceWithColocationStatus{ - // { - // ID: to.Ptr("string"), - // }}, - // }, - // Zones: []*string{ - // to.Ptr("1")}, - // }}, - // } - } -} 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 e7ec8339cee0..000000000000 --- a/sdk/resourcemanager/compute/armcompute/resourceskus_client_example_test.go +++ /dev/null @@ -1,612 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package 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/v5" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewResourceSKUsClient().NewListPager(&armcompute.ResourceSKUsClientListOptions{Filter: nil, - IncludeExtendedLocations: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ResourceSKUsResult = armcompute.ResourceSKUsResult{ - // Value: []*armcompute.ResourceSKU{ - // { - // Name: to.Ptr("Standard_A0"), - // Capabilities: []*armcompute.ResourceSKUCapabilities{ - // { - // Name: to.Ptr("MaxResourceVolumeMB"), - // Value: to.Ptr("20480"), - // }, - // { - // Name: to.Ptr("OSVhdSizeMB"), - // Value: to.Ptr("1047552"), - // }, - // { - // Name: to.Ptr("vCPUs"), - // Value: to.Ptr("1"), - // }, - // { - // Name: to.Ptr("HyperVGenerations"), - // Value: to.Ptr("V1"), - // }, - // { - // Name: to.Ptr("MemoryGB"), - // Value: to.Ptr("0.75"), - // }, - // { - // Name: to.Ptr("MaxDataDiskCount"), - // Value: to.Ptr("1"), - // }, - // { - // Name: to.Ptr("LowPriorityCapable"), - // Value: to.Ptr("False"), - // }, - // { - // Name: to.Ptr("PremiumIO"), - // Value: to.Ptr("False"), - // }, - // { - // Name: to.Ptr("vCPUsAvailable"), - // Value: to.Ptr("1"), - // }, - // { - // Name: to.Ptr("ACUs"), - // Value: to.Ptr("50"), - // }, - // { - // Name: to.Ptr("vCPUsPerCore"), - // Value: to.Ptr("1"), - // }, - // { - // Name: to.Ptr("EphemeralOSDiskSupported"), - // Value: to.Ptr("False"), - // }, - // { - // Name: to.Ptr("AcceleratedNetworkingEnabled"), - // Value: to.Ptr("False"), - // }, - // { - // Name: to.Ptr("RdmaEnabled"), - // Value: to.Ptr("False"), - // }, - // { - // Name: to.Ptr("MaxNetworkInterfaces"), - // Value: to.Ptr("2"), - // }}, - // Family: to.Ptr("standardA0_A7Family"), - // LocationInfo: []*armcompute.ResourceSKULocationInfo{ - // { - // Location: to.Ptr("westus"), - // ZoneDetails: []*armcompute.ResourceSKUZoneDetails{ - // { - // Name: []*string{ - // to.Ptr("2")}, - // Capabilities: []*armcompute.ResourceSKUCapabilities{ - // { - // Name: to.Ptr("UltraSSDAvailable"), - // Value: to.Ptr("True"), - // }}, - // }}, - // Zones: []*string{ - // to.Ptr("2"), - // to.Ptr("1")}, - // }}, - // Locations: []*string{ - // to.Ptr("westus")}, - // ResourceType: to.Ptr("virtualMachines"), - // Size: to.Ptr("A0"), - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("Standard_A1"), - // Capabilities: []*armcompute.ResourceSKUCapabilities{ - // { - // Name: to.Ptr("MaxResourceVolumeMB"), - // Value: to.Ptr("71680"), - // }, - // { - // Name: to.Ptr("OSVhdSizeMB"), - // Value: to.Ptr("1047552"), - // }, - // { - // Name: to.Ptr("vCPUs"), - // Value: to.Ptr("1"), - // }, - // { - // Name: to.Ptr("HyperVGenerations"), - // Value: to.Ptr("V1"), - // }, - // { - // Name: to.Ptr("MemoryGB"), - // Value: to.Ptr("1.75"), - // }, - // { - // Name: to.Ptr("MaxDataDiskCount"), - // Value: to.Ptr("2"), - // }, - // { - // Name: to.Ptr("LowPriorityCapable"), - // Value: to.Ptr("True"), - // }, - // { - // Name: to.Ptr("PremiumIO"), - // Value: to.Ptr("False"), - // }, - // { - // Name: to.Ptr("vCPUsAvailable"), - // Value: to.Ptr("1"), - // }, - // { - // Name: to.Ptr("ACUs"), - // Value: to.Ptr("100"), - // }, - // { - // Name: to.Ptr("vCPUsPerCore"), - // Value: to.Ptr("1"), - // }, - // { - // Name: to.Ptr("EphemeralOSDiskSupported"), - // Value: to.Ptr("False"), - // }, - // { - // Name: to.Ptr("AcceleratedNetworkingEnabled"), - // Value: to.Ptr("False"), - // }, - // { - // Name: to.Ptr("RdmaEnabled"), - // Value: to.Ptr("False"), - // }, - // { - // Name: to.Ptr("MaxNetworkInterfaces"), - // Value: to.Ptr("2"), - // }}, - // Family: to.Ptr("standardA0_A7Family"), - // LocationInfo: []*armcompute.ResourceSKULocationInfo{ - // { - // Location: to.Ptr("westus"), - // Zones: []*string{ - // to.Ptr("1"), - // to.Ptr("2"), - // to.Ptr("3")}, - // }}, - // Locations: []*string{ - // to.Ptr("westus")}, - // ResourceType: to.Ptr("virtualMachines"), - // Size: to.Ptr("A1"), - // Tier: to.Ptr("Standard"), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewResourceSKUsClient().NewListPager(&armcompute.ResourceSKUsClientListOptions{Filter: to.Ptr("location eq 'westus'"), - IncludeExtendedLocations: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ResourceSKUsResult = armcompute.ResourceSKUsResult{ - // Value: []*armcompute.ResourceSKU{ - // { - // Name: to.Ptr("Standard_A0"), - // Capabilities: []*armcompute.ResourceSKUCapabilities{ - // { - // Name: to.Ptr("MaxResourceVolumeMB"), - // Value: to.Ptr("20480"), - // }, - // { - // Name: to.Ptr("OSVhdSizeMB"), - // Value: to.Ptr("1047552"), - // }, - // { - // Name: to.Ptr("vCPUs"), - // Value: to.Ptr("1"), - // }, - // { - // Name: to.Ptr("HyperVGenerations"), - // Value: to.Ptr("V1"), - // }, - // { - // Name: to.Ptr("MemoryGB"), - // Value: to.Ptr("0.75"), - // }, - // { - // Name: to.Ptr("MaxDataDiskCount"), - // Value: to.Ptr("1"), - // }, - // { - // Name: to.Ptr("LowPriorityCapable"), - // Value: to.Ptr("False"), - // }, - // { - // Name: to.Ptr("PremiumIO"), - // Value: to.Ptr("False"), - // }, - // { - // Name: to.Ptr("vCPUsAvailable"), - // Value: to.Ptr("1"), - // }, - // { - // Name: to.Ptr("ACUs"), - // Value: to.Ptr("50"), - // }, - // { - // Name: to.Ptr("vCPUsPerCore"), - // Value: to.Ptr("1"), - // }, - // { - // Name: to.Ptr("EphemeralOSDiskSupported"), - // Value: to.Ptr("False"), - // }, - // { - // Name: to.Ptr("AcceleratedNetworkingEnabled"), - // Value: to.Ptr("False"), - // }, - // { - // Name: to.Ptr("RdmaEnabled"), - // Value: to.Ptr("False"), - // }, - // { - // Name: to.Ptr("MaxNetworkInterfaces"), - // Value: to.Ptr("2"), - // }}, - // Family: to.Ptr("standardA0_A7Family"), - // LocationInfo: []*armcompute.ResourceSKULocationInfo{ - // { - // Location: to.Ptr("westus"), - // ZoneDetails: []*armcompute.ResourceSKUZoneDetails{ - // { - // Name: []*string{ - // to.Ptr("2")}, - // Capabilities: []*armcompute.ResourceSKUCapabilities{ - // { - // Name: to.Ptr("UltraSSDAvailable"), - // Value: to.Ptr("True"), - // }}, - // }}, - // Zones: []*string{ - // to.Ptr("2"), - // to.Ptr("1")}, - // }}, - // Locations: []*string{ - // to.Ptr("westus")}, - // ResourceType: to.Ptr("virtualMachines"), - // Size: to.Ptr("A0"), - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("Standard_A1"), - // Capabilities: []*armcompute.ResourceSKUCapabilities{ - // { - // Name: to.Ptr("MaxResourceVolumeMB"), - // Value: to.Ptr("71680"), - // }, - // { - // Name: to.Ptr("OSVhdSizeMB"), - // Value: to.Ptr("1047552"), - // }, - // { - // Name: to.Ptr("vCPUs"), - // Value: to.Ptr("1"), - // }, - // { - // Name: to.Ptr("HyperVGenerations"), - // Value: to.Ptr("V1"), - // }, - // { - // Name: to.Ptr("MemoryGB"), - // Value: to.Ptr("1.75"), - // }, - // { - // Name: to.Ptr("MaxDataDiskCount"), - // Value: to.Ptr("2"), - // }, - // { - // Name: to.Ptr("LowPriorityCapable"), - // Value: to.Ptr("True"), - // }, - // { - // Name: to.Ptr("PremiumIO"), - // Value: to.Ptr("False"), - // }, - // { - // Name: to.Ptr("vCPUsAvailable"), - // Value: to.Ptr("1"), - // }, - // { - // Name: to.Ptr("ACUs"), - // Value: to.Ptr("100"), - // }, - // { - // Name: to.Ptr("vCPUsPerCore"), - // Value: to.Ptr("1"), - // }, - // { - // Name: to.Ptr("EphemeralOSDiskSupported"), - // Value: to.Ptr("False"), - // }, - // { - // Name: to.Ptr("AcceleratedNetworkingEnabled"), - // Value: to.Ptr("False"), - // }, - // { - // Name: to.Ptr("RdmaEnabled"), - // Value: to.Ptr("False"), - // }, - // { - // Name: to.Ptr("MaxNetworkInterfaces"), - // Value: to.Ptr("2"), - // }}, - // Family: to.Ptr("standardA0_A7Family"), - // LocationInfo: []*armcompute.ResourceSKULocationInfo{ - // { - // Location: to.Ptr("westus"), - // Zones: []*string{ - // to.Ptr("1"), - // to.Ptr("2"), - // to.Ptr("3")}, - // }}, - // Locations: []*string{ - // to.Ptr("westus")}, - // ResourceType: to.Ptr("virtualMachines"), - // Size: to.Ptr("A1"), - // Tier: to.Ptr("Standard"), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewResourceSKUsClient().NewListPager(&armcompute.ResourceSKUsClientListOptions{Filter: nil, - IncludeExtendedLocations: to.Ptr("true"), - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ResourceSKUsResult = armcompute.ResourceSKUsResult{ - // Value: []*armcompute.ResourceSKU{ - // { - // Name: to.Ptr("Standard_A0"), - // Capabilities: []*armcompute.ResourceSKUCapabilities{ - // { - // Name: to.Ptr("MaxResourceVolumeMB"), - // Value: to.Ptr("20480"), - // }, - // { - // Name: to.Ptr("OSVhdSizeMB"), - // Value: to.Ptr("1047552"), - // }, - // { - // Name: to.Ptr("vCPUs"), - // Value: to.Ptr("1"), - // }, - // { - // Name: to.Ptr("HyperVGenerations"), - // Value: to.Ptr("V1"), - // }, - // { - // Name: to.Ptr("MemoryGB"), - // Value: to.Ptr("0.75"), - // }, - // { - // Name: to.Ptr("MaxDataDiskCount"), - // Value: to.Ptr("1"), - // }, - // { - // Name: to.Ptr("LowPriorityCapable"), - // Value: to.Ptr("False"), - // }, - // { - // Name: to.Ptr("PremiumIO"), - // Value: to.Ptr("False"), - // }, - // { - // Name: to.Ptr("vCPUsAvailable"), - // Value: to.Ptr("1"), - // }, - // { - // Name: to.Ptr("ACUs"), - // Value: to.Ptr("50"), - // }, - // { - // Name: to.Ptr("vCPUsPerCore"), - // Value: to.Ptr("1"), - // }, - // { - // Name: to.Ptr("EphemeralOSDiskSupported"), - // Value: to.Ptr("False"), - // }, - // { - // Name: to.Ptr("AcceleratedNetworkingEnabled"), - // Value: to.Ptr("False"), - // }, - // { - // Name: to.Ptr("RdmaEnabled"), - // Value: to.Ptr("False"), - // }, - // { - // Name: to.Ptr("MaxNetworkInterfaces"), - // Value: to.Ptr("2"), - // }}, - // Family: to.Ptr("standardA0_A7Family"), - // LocationInfo: []*armcompute.ResourceSKULocationInfo{ - // { - // Location: to.Ptr("westus"), - // ZoneDetails: []*armcompute.ResourceSKUZoneDetails{ - // { - // Name: []*string{ - // to.Ptr("2")}, - // Capabilities: []*armcompute.ResourceSKUCapabilities{ - // { - // Name: to.Ptr("UltraSSDAvailable"), - // Value: to.Ptr("True"), - // }}, - // }}, - // Zones: []*string{ - // to.Ptr("2"), - // to.Ptr("1")}, - // }}, - // Locations: []*string{ - // to.Ptr("westus")}, - // ResourceType: to.Ptr("virtualMachines"), - // Size: to.Ptr("A0"), - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("Standard_A1"), - // Capabilities: []*armcompute.ResourceSKUCapabilities{ - // { - // Name: to.Ptr("MaxResourceVolumeMB"), - // Value: to.Ptr("71680"), - // }, - // { - // Name: to.Ptr("OSVhdSizeMB"), - // Value: to.Ptr("1047552"), - // }, - // { - // Name: to.Ptr("vCPUs"), - // Value: to.Ptr("1"), - // }, - // { - // Name: to.Ptr("HyperVGenerations"), - // Value: to.Ptr("V1"), - // }, - // { - // Name: to.Ptr("MemoryGB"), - // Value: to.Ptr("1.75"), - // }, - // { - // Name: to.Ptr("MaxDataDiskCount"), - // Value: to.Ptr("2"), - // }, - // { - // Name: to.Ptr("LowPriorityCapable"), - // Value: to.Ptr("True"), - // }, - // { - // Name: to.Ptr("PremiumIO"), - // Value: to.Ptr("False"), - // }, - // { - // Name: to.Ptr("vCPUsAvailable"), - // Value: to.Ptr("1"), - // }, - // { - // Name: to.Ptr("ACUs"), - // Value: to.Ptr("100"), - // }, - // { - // Name: to.Ptr("vCPUsPerCore"), - // Value: to.Ptr("1"), - // }, - // { - // Name: to.Ptr("EphemeralOSDiskSupported"), - // Value: to.Ptr("False"), - // }, - // { - // Name: to.Ptr("AcceleratedNetworkingEnabled"), - // Value: to.Ptr("False"), - // }, - // { - // Name: to.Ptr("RdmaEnabled"), - // Value: to.Ptr("False"), - // }, - // { - // Name: to.Ptr("MaxNetworkInterfaces"), - // Value: to.Ptr("2"), - // }}, - // Family: to.Ptr("standardA0_A7Family"), - // LocationInfo: []*armcompute.ResourceSKULocationInfo{ - // { - // Location: to.Ptr("westus"), - // Zones: []*string{ - // to.Ptr("1"), - // to.Ptr("2"), - // to.Ptr("3")}, - // }, - // { - // Type: to.Ptr(armcompute.ExtendedLocationTypeEdgeZone), - // ExtendedLocations: []*string{ - // to.Ptr("Las Vegas"), - // to.Ptr("Seattle"), - // to.Ptr("Portland")}, - // Location: to.Ptr("westus"), - // }}, - // Locations: []*string{ - // to.Ptr("westus")}, - // ResourceType: to.Ptr("virtualMachines"), - // Size: to.Ptr("A1"), - // Tier: to.Ptr("Standard"), - // }}, - // } - } -} 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 29f30cb6032e..000000000000 --- a/sdk/resourcemanager/compute/armcompute/restorepointcollections_client_example_test.go +++ /dev/null @@ -1,636 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package 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/v5" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRestorePointCollectionsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RestorePointCollection = armcompute.RestorePointCollection{ - // Name: to.Ptr("myRpc"), - // Type: to.Ptr("Microsoft.Compute/restorePointCollections"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/restorePointCollections/myRpc"), - // Location: to.Ptr("norwayeast"), - // Tags: map[string]*string{ - // "myTag1": to.Ptr("tagValue1"), - // }, - // Properties: &armcompute.RestorePointCollectionProperties{ - // ProvisioningState: to.Ptr("Succeeded"), - // RestorePointCollectionID: to.Ptr("638f052b-a7c2-450c-89e7-6a3b8f1d6a7c"), - // Source: &armcompute.RestorePointCollectionSourceProperties{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // Location: to.Ptr("eastus"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRestorePointCollectionsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RestorePointCollection = armcompute.RestorePointCollection{ - // Name: to.Ptr("myRpc"), - // Type: to.Ptr("Microsoft.Compute/restorePointCollections"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/restorePointCollections/myRpc"), - // Location: to.Ptr("norwayeast"), - // Tags: map[string]*string{ - // "myTag1": to.Ptr("tagValue1"), - // }, - // Properties: &armcompute.RestorePointCollectionProperties{ - // ProvisioningState: to.Ptr("Succeeded"), - // RestorePointCollectionID: to.Ptr("638f052b-a7c2-450c-89e7-6a3b8f1d6a7c"), - // Source: &armcompute.RestorePointCollectionSourceProperties{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // Location: to.Ptr("eastus"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/restorePointExamples/RestorePointCollection_Update_MaximumSet_Gen.json -func ExampleRestorePointCollectionsClient_Update_restorePointCollectionUpdateMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRestorePointCollectionsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RestorePointCollection = armcompute.RestorePointCollection{ - // Name: to.Ptr("myRpc"), - // Type: to.Ptr("Microsoft.Compute/restorePointCollections"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/restorePointCollections/myRpc"), - // Location: to.Ptr("norwayeast"), - // Tags: map[string]*string{ - // }, - // Properties: &armcompute.RestorePointCollectionProperties{ - // ProvisioningState: to.Ptr("Succeeded"), - // RestorePointCollectionID: to.Ptr("638f052b-a7c2-450c-89e7-6a3b8f1d6a7c"), - // RestorePoints: []*armcompute.RestorePoint{ - // { - // Name: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // Type: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaa"), - // ID: to.Ptr("aaaaaaaaaaa"), - // Properties: &armcompute.RestorePointProperties{ - // ConsistencyMode: to.Ptr(armcompute.ConsistencyModeTypesCrashConsistent), - // ExcludeDisks: []*armcompute.APIEntityReference{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/restorePointCollections/rpcName/restorePoints/restorePointName/diskRestorePoints/testingexcludedisk_OsDisk_1_74cdaedcea50483d9833c96adefa100f_22b4bdfe-6c54-4f72-84d8-85d8860f0c57"), - // }}, - // ProvisioningState: to.Ptr("Succeeded"), - // SourceMetadata: &armcompute.RestorePointSourceMetadata{ - // DiagnosticsProfile: &armcompute.DiagnosticsProfile{ - // BootDiagnostics: &armcompute.BootDiagnostics{ - // Enabled: to.Ptr(true), - // StorageURI: to.Ptr("aaaaaaaaaaaaaaaaaaa"), - // }, - // }, - // HardwareProfile: &armcompute.HardwareProfile{ - // VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardB1S), - // VMSizeProperties: &armcompute.VMSizeProperties{ - // VCPUsAvailable: to.Ptr[int32](9), - // VCPUsPerCore: to.Ptr[int32](12), - // }, - // }, - // LicenseType: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // Location: to.Ptr("westus"), - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("admin"), - // AllowExtensionOperations: to.Ptr(true), - // ComputerName: to.Ptr("computerName"), - // CustomData: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // 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{ - // { - // 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), - // EnableHotpatching: to.Ptr(true), - // PatchMode: to.Ptr(armcompute.WindowsVMGuestPatchModeManual), - // }, - // ProvisionVMAgent: to.Ptr(true), - // TimeZone: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // WinRM: &armcompute.WinRMConfiguration{ - // Listeners: []*armcompute.WinRMListener{ - // { - // CertificateURL: to.Ptr("aaaaaaaaaaaaaaaaaaaaaa"), - // Protocol: to.Ptr(armcompute.ProtocolTypesHTTP), - // }}, - // }, - // }, - // }, - // 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.RestorePointSourceVMStorageProfile{ - // DataDisks: []*armcompute.RestorePointSourceVMDataDisk{ - // { - // Name: to.Ptr("testingexcludedisk_DataDisk_1"), - // Caching: to.Ptr(armcompute.CachingTypesNone), - // DiskRestorePoint: &armcompute.DiskRestorePointAttributes{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/restorePointCollections/rpcName/restorePoints/restorePointName/diskRestorePoints/testingexcludedisk_DataDisk_1_68785190-1acb-4d5e-a8ae-705b45f3dca5"), - // }, - // DiskSizeGB: to.Ptr[int32](24), - // Lun: to.Ptr[int32](1), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/testingexcludedisk_DataDisk_1"), - // DiskEncryptionSet: &armcompute.DiskEncryptionSetParameters{ - // ID: to.Ptr("aaaaaaaaaaaa"), - // }, - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // }}, - // DiskControllerType: to.Ptr(armcompute.DiskControllerTypesNVMe), - // OSDisk: &armcompute.RestorePointSourceVMOSDisk{ - // Name: to.Ptr("testingexcludedisk_OsDisk_1_74cdaedcea50483d9833c96adefa100f"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // DiskRestorePoint: &armcompute.DiskRestorePointAttributes{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/restorePointCollections/rpcName/restorePoints/restorePointName/diskRestorePoints/testingexcludedisk_OsDisk_1_74cdaedcea50483d9833c96adefa100f_22b4bdfe-6c54-4f72-84d8-85d8860f0c57"), - // }, - // DiskSizeGB: to.Ptr[int32](3), - // 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}"), - // }, - // }, - // }, - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/testingexcludedisk_OsDisk_1_74cdaedcea50483d9833c96adefa100f"), - // DiskEncryptionSet: &armcompute.DiskEncryptionSetParameters{ - // ID: to.Ptr("aaaaaaaaaaaa"), - // }, - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypeWindows), - // }, - // }, - // VMID: to.Ptr("76d6541e-80bd-4dc1-932b-3cae4cfb80e7"), - // }, - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.593Z"); return t}()), - // }, - // }}, - // Source: &armcompute.RestorePointCollectionSourceProperties{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // Location: to.Ptr("eastus"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/restorePointExamples/RestorePointCollection_Update_MinimumSet_Gen.json -func ExampleRestorePointCollectionsClient_Update_restorePointCollectionUpdateMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRestorePointCollectionsClient().Update(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaa", armcompute.RestorePointCollectionUpdate{}, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RestorePointCollection = armcompute.RestorePointCollection{ - // Location: to.Ptr("norwayeast"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/restorePointExamples/RestorePointCollection_Delete_MaximumSet_Gen.json -func ExampleRestorePointCollectionsClient_BeginDelete_restorePointCollectionDeleteMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewRestorePointCollectionsClient().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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/restorePointExamples/RestorePointCollection_Delete_MinimumSet_Gen.json -func ExampleRestorePointCollectionsClient_BeginDelete_restorePointCollectionDeleteMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewRestorePointCollectionsClient().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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRestorePointCollectionsClient().Get(ctx, "myResourceGroup", "myRpc", &armcompute.RestorePointCollectionsClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RestorePointCollection = armcompute.RestorePointCollection{ - // Name: to.Ptr("myRpc"), - // Type: to.Ptr("Microsoft.Compute/restorePointCollections"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/restorePointCollections/myRpc"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "myTag1": to.Ptr("tagValue1"), - // }, - // Properties: &armcompute.RestorePointCollectionProperties{ - // ProvisioningState: to.Ptr("Succeeded"), - // RestorePointCollectionID: to.Ptr("59f04a5d-f783-4200-a1bd-d3f464e8c4b4"), - // Source: &armcompute.RestorePointCollectionSourceProperties{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/restorePointCollections/myRpc"), - // Location: to.Ptr("eastus"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRestorePointCollectionsClient().Get(ctx, "myResourceGroup", "rpcName", &armcompute.RestorePointCollectionsClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RestorePointCollection = armcompute.RestorePointCollection{ - // Name: to.Ptr("rpcName"), - // Type: to.Ptr("Microsoft.Compute/restorePointCollections"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/restorePointCollections/rpcName"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "myTag1": to.Ptr("tagValue1"), - // }, - // Properties: &armcompute.RestorePointCollectionProperties{ - // ProvisioningState: to.Ptr("Succeeded"), - // RestorePointCollectionID: to.Ptr("59f04a5d-f783-4200-a1bd-d3f464e8c4b4"), - // RestorePoints: []*armcompute.RestorePoint{ - // { - // Name: to.Ptr("restorePointName"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/restorePointCollections/rpcName/restorePoints/restorePointName"), - // Properties: &armcompute.RestorePointProperties{ - // ConsistencyMode: to.Ptr(armcompute.ConsistencyModeTypesApplicationConsistent), - // ExcludeDisks: []*armcompute.APIEntityReference{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/vm8768_disk2_fe6ffde4f69b491ca33fb984d5bcd89f"), - // }}, - // ProvisioningState: to.Ptr("Succeeded"), - // SourceMetadata: &armcompute.RestorePointSourceMetadata{ - // DiagnosticsProfile: &armcompute.DiagnosticsProfile{ - // BootDiagnostics: &armcompute.BootDiagnostics{ - // Enabled: to.Ptr(true), - // }, - // }, - // HardwareProfile: &armcompute.HardwareProfile{ - // VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardB1S), - // }, - // Location: to.Ptr("westus"), - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("admin"), - // AllowExtensionOperations: to.Ptr(true), - // ComputerName: to.Ptr("computerName"), - // RequireGuestProvisionSignal: to.Ptr(true), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // StorageProfile: &armcompute.RestorePointSourceVMStorageProfile{ - // DataDisks: []*armcompute.RestorePointSourceVMDataDisk{ - // { - // Name: to.Ptr("testingexcludedisk_DataDisk_1"), - // Caching: to.Ptr(armcompute.CachingTypesNone), - // DiskRestorePoint: &armcompute.DiskRestorePointAttributes{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/restorePointCollections/rpcName/restorePoints/restorePointName/diskRestorePoints/testingexcludedisk_DataDisk_1_68785190-1acb-4d5e-a8ae-705b45f3dca5"), - // }, - // Lun: to.Ptr[int32](1), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/testingexcludedisk_DataDisk_1"), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // }}, - // DiskControllerType: to.Ptr(armcompute.DiskControllerTypesNVMe), - // OSDisk: &armcompute.RestorePointSourceVMOSDisk{ - // Name: to.Ptr("testingexcludedisk_OsDisk_1_74cdaedcea50483d9833c96adefa100f"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // DiskRestorePoint: &armcompute.DiskRestorePointAttributes{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/restorePointCollections/rpcName/restorePoints/restorePointName/diskRestorePoints/testingexcludedisk_OsDisk_1_74cdaedcea50483d9833c96adefa100f_22b4bdfe-6c54-4f72-84d8-85d8860f0c57"), - // }, - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/testingexcludedisk_OsDisk_1_74cdaedcea50483d9833c96adefa100f"), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypeWindows), - // }, - // }, - // VMID: to.Ptr("76d6541e-80bd-4dc1-932b-3cae4cfb80e7"), - // }, - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-27T20:35:05.840Z"); return t}()), - // }, - // }}, - // Source: &armcompute.RestorePointCollectionSourceProperties{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // Location: to.Ptr("eastus"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewRestorePointCollectionsClient().NewListPager("myResourceGroup", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.RestorePointCollectionListResult = armcompute.RestorePointCollectionListResult{ - // Value: []*armcompute.RestorePointCollection{ - // { - // Name: to.Ptr("restorePointCollection1"), - // Type: to.Ptr("Microsoft.Compute/restorePointCollections"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/restorePointCollections/restorePointCollection1"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "myTag1": to.Ptr("tagValue1"), - // }, - // Properties: &armcompute.RestorePointCollectionProperties{ - // ProvisioningState: to.Ptr("Succeeded"), - // RestorePointCollectionID: to.Ptr("59f04a5d-f783-4200-a1bd-d3f464e8c4b4"), - // Source: &armcompute.RestorePointCollectionSourceProperties{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/restorePointCollections/restorePointCollection1"), - // Location: to.Ptr("westus"), - // }, - // }, - // }, - // { - // Name: to.Ptr("restorePointCollection2"), - // Type: to.Ptr("Microsoft.Compute/restorePointCollections"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/restorePointCollections/restorePointCollection2"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "myTag1": to.Ptr("tagValue1"), - // }, - // Properties: &armcompute.RestorePointCollectionProperties{ - // ProvisioningState: to.Ptr("Succeeded"), - // RestorePointCollectionID: to.Ptr("2875c590-e337-4102-9668-4f5b7e3f98a4"), - // Source: &armcompute.RestorePointCollectionSourceProperties{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/restorePointCollections/restorePointCollection2"), - // Location: to.Ptr("westus"), - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewRestorePointCollectionsClient().NewListAllPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.RestorePointCollectionListResult = armcompute.RestorePointCollectionListResult{ - // Value: []*armcompute.RestorePointCollection{ - // { - // Name: to.Ptr("restorePointCollection1"), - // Type: to.Ptr("Microsoft.Compute/restorePointCollections"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/resourceGroup1/providers/Microsoft.Compute/restorePointCollections/restorePointCollection1"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "myTag1": to.Ptr("tagValue1"), - // }, - // Properties: &armcompute.RestorePointCollectionProperties{ - // ProvisioningState: to.Ptr("Succeeded"), - // RestorePointCollectionID: to.Ptr("59f04a5d-f783-4200-a1bd-d3f464e8c4b4"), - // Source: &armcompute.RestorePointCollectionSourceProperties{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/VM_Test"), - // Location: to.Ptr("westus"), - // }, - // }, - // }, - // { - // Name: to.Ptr("restorePointCollection2"), - // Type: to.Ptr("Microsoft.Compute/restorePointCollections"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/resourceGroup2/providers/Microsoft.Compute/restorePointCollections/restorePointCollection2"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "myTag1": to.Ptr("tagValue1"), - // }, - // Properties: &armcompute.RestorePointCollectionProperties{ - // ProvisioningState: to.Ptr("Succeeded"), - // RestorePointCollectionID: to.Ptr("2875c590-e337-4102-9668-4f5b7e3f98a4"), - // Source: &armcompute.RestorePointCollectionSourceProperties{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/VM_Prod"), - // Location: to.Ptr("westus"), - // }, - // }, - // }}, - // } - } -} 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 098d39793933..000000000000 --- a/sdk/resourcemanager/compute/armcompute/restorepoints_client_example_test.go +++ /dev/null @@ -1,317 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package 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/v5" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewRestorePointsClient().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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewRestorePointsClient().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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/restorePointExamples/RestorePoint_Delete_MaximumSet_Gen.json -func ExampleRestorePointsClient_BeginDelete_restorePointDeleteMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewRestorePointsClient().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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/restorePointExamples/RestorePoint_Delete_MinimumSet_Gen.json -func ExampleRestorePointsClient_BeginDelete_restorePointDeleteMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewRestorePointsClient().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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRestorePointsClient().Get(ctx, "myResourceGroup", "rpcName", "rpName", &armcompute.RestorePointsClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RestorePoint = armcompute.RestorePoint{ - // Name: to.Ptr("rpName"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/restorePointCollections/rpcName/restorePoints/rpName"), - // Properties: &armcompute.RestorePointProperties{ - // ConsistencyMode: to.Ptr(armcompute.ConsistencyModeTypesApplicationConsistent), - // ExcludeDisks: []*armcompute.APIEntityReference{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/vm8768_disk2_fe6ffde4f69b491ca33fb984d5bcd89f"), - // }}, - // ProvisioningState: to.Ptr("Succeeded"), - // SourceMetadata: &armcompute.RestorePointSourceMetadata{ - // DiagnosticsProfile: &armcompute.DiagnosticsProfile{ - // BootDiagnostics: &armcompute.BootDiagnostics{ - // Enabled: to.Ptr(true), - // }, - // }, - // HardwareProfile: &armcompute.HardwareProfile{ - // VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardB1S), - // }, - // Location: to.Ptr("westus"), - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("admin"), - // AllowExtensionOperations: to.Ptr(true), - // ComputerName: to.Ptr("computerName"), - // RequireGuestProvisionSignal: to.Ptr(true), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // StorageProfile: &armcompute.RestorePointSourceVMStorageProfile{ - // DataDisks: []*armcompute.RestorePointSourceVMDataDisk{ - // { - // Name: to.Ptr("testingexcludedisk_DataDisk_1"), - // Caching: to.Ptr(armcompute.CachingTypesNone), - // DiskRestorePoint: &armcompute.DiskRestorePointAttributes{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/userdata/providers/Microsoft.Compute/restorePointCollections/mynewrpc/restorePoints/restorepointtwo/diskRestorePoints/testingexcludedisk_DataDisk_1_68785190-1acb-4d5e-a8ae-705b45f3dca5"), - // }, - // Lun: to.Ptr[int32](1), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/userdata/providers/Microsoft.Compute/disks/testingexcludedisk_DataDisk_1"), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // }}, - // DiskControllerType: to.Ptr(armcompute.DiskControllerTypesNVMe), - // OSDisk: &armcompute.RestorePointSourceVMOSDisk{ - // Name: to.Ptr("testingexcludedisk_OsDisk_1_74cdaedcea50483d9833c96adefa100f"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // DiskRestorePoint: &armcompute.DiskRestorePointAttributes{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/restorePointCollections/rpcName/restorePoints/rpName/diskRestorePoints/testingexcludedisk_OsDisk_1_74cdaedcea50483d9833c96adefa100f_22b4bdfe-6c54-4f72-84d8-85d8860f0c57"), - // }, - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/testingexcludedisk_OsDisk_1_74cdaedcea50483d9833c96adefa100f"), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypeWindows), - // }, - // }, - // VMID: to.Ptr("76d6541e-80bd-4dc1-932b-3cae4cfb80e7"), - // }, - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-27T20:35:05.840Z"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRestorePointsClient().Get(ctx, "myResourceGroup", "rpcName", "rpName", &armcompute.RestorePointsClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RestorePoint = armcompute.RestorePoint{ - // Name: to.Ptr("rpName"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/restorePointCollections/rpcName/restorePoints/rpName"), - // Properties: &armcompute.RestorePointProperties{ - // ConsistencyMode: to.Ptr(armcompute.ConsistencyModeTypesApplicationConsistent), - // ExcludeDisks: []*armcompute.APIEntityReference{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/vm8768_disk2_fe6ffde4f69b491ca33fb984d5bcd89f"), - // }}, - // InstanceView: &armcompute.RestorePointInstanceView{ - // DiskRestorePoints: []*armcompute.DiskRestorePointInstanceView{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/restorePointCollections/rpcName/restorePoints/rpName/diskRestorePoints/testingexcludedisk_OsDisk_1_74cdaedcea50483d9833c96adefa100f_22b4bdfe-6c54-4f72-84d8-85d8860f0c57"), - // ReplicationStatus: &armcompute.DiskRestorePointReplicationStatus{ - // CompletionPercent: to.Ptr[int32](100), - // Status: &armcompute.InstanceViewStatus{ - // Code: to.Ptr("ReplicationState/succeeded"), - // DisplayStatus: to.Ptr("Succeeded"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // }, - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/userdata/providers/Microsoft.Compute/restorePointCollections/mynewrpc/restorePoints/restorepointtwo/diskRestorePoints/testingexcludedisk_DataDisk_1_68785190-1acb-4d5e-a8ae-705b45f3dca5"), - // ReplicationStatus: &armcompute.DiskRestorePointReplicationStatus{ - // CompletionPercent: to.Ptr[int32](100), - // Status: &armcompute.InstanceViewStatus{ - // Code: to.Ptr("ReplicationState/succeeded"), - // DisplayStatus: to.Ptr("Succeeded"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // }, - // }, - // }}, - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("ReplicationState/succeeded"), - // DisplayStatus: to.Ptr("Succeeded"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // }}, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // SourceMetadata: &armcompute.RestorePointSourceMetadata{ - // DiagnosticsProfile: &armcompute.DiagnosticsProfile{ - // BootDiagnostics: &armcompute.BootDiagnostics{ - // Enabled: to.Ptr(true), - // }, - // }, - // HardwareProfile: &armcompute.HardwareProfile{ - // VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardB1S), - // }, - // Location: to.Ptr("westus"), - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("admin"), - // AllowExtensionOperations: to.Ptr(true), - // ComputerName: to.Ptr("computerName"), - // RequireGuestProvisionSignal: to.Ptr(true), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // StorageProfile: &armcompute.RestorePointSourceVMStorageProfile{ - // DataDisks: []*armcompute.RestorePointSourceVMDataDisk{ - // { - // Name: to.Ptr("testingexcludedisk_DataDisk_1"), - // Caching: to.Ptr(armcompute.CachingTypesNone), - // DiskRestorePoint: &armcompute.DiskRestorePointAttributes{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/userdata/providers/Microsoft.Compute/restorePointCollections/mynewrpc/restorePoints/restorepointtwo/diskRestorePoints/testingexcludedisk_DataDisk_1_68785190-1acb-4d5e-a8ae-705b45f3dca5"), - // }, - // Lun: to.Ptr[int32](1), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/userdata/providers/Microsoft.Compute/disks/testingexcludedisk_DataDisk_1"), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // }}, - // DiskControllerType: to.Ptr(armcompute.DiskControllerTypesNVMe), - // OSDisk: &armcompute.RestorePointSourceVMOSDisk{ - // Name: to.Ptr("testingexcludedisk_OsDisk_1_74cdaedcea50483d9833c96adefa100f"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // DiskRestorePoint: &armcompute.DiskRestorePointAttributes{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/restorePointCollections/rpcName/restorePoints/rpName/diskRestorePoints/testingexcludedisk_OsDisk_1_74cdaedcea50483d9833c96adefa100f_22b4bdfe-6c54-4f72-84d8-85d8860f0c57"), - // }, - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/testingexcludedisk_OsDisk_1_74cdaedcea50483d9833c96adefa100f"), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypeWindows), - // }, - // }, - // VMID: to.Ptr("76d6541e-80bd-4dc1-932b-3cae4cfb80e7"), - // }, - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-27T20:35:05.840Z"); return t}()), - // }, - // } -} diff --git a/sdk/resourcemanager/compute/armcompute/sharedgalleries_client.go b/sdk/resourcemanager/compute/armcompute/sharedgalleries_client.go index 4bf2d09608d5..ee8172bae84c 100644 --- a/sdk/resourcemanager/compute/armcompute/sharedgalleries_client.go +++ b/sdk/resourcemanager/compute/armcompute/sharedgalleries_client.go @@ -47,7 +47,7 @@ func NewSharedGalleriesClient(subscriptionID string, credential azcore.TokenCred // Get - Get a shared gallery by subscription id or tenant id. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-08-03 +// Generated from API version 2023-07-03 // - location - Resource location. // - galleryUniqueName - The unique name of the Shared Gallery. // - options - SharedGalleriesClientGetOptions contains the optional parameters for the SharedGalleriesClient.Get method. @@ -93,7 +93,7 @@ func (client *SharedGalleriesClient) getCreateRequest(ctx context.Context, locat return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-03") + reqQP.Set("api-version", "2023-07-03") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -110,7 +110,7 @@ func (client *SharedGalleriesClient) getHandleResponse(resp *http.Response) (Sha // NewListPager - List shared galleries by subscription id or tenant id. // -// Generated from API version 2022-08-03 +// Generated from API version 2023-07-03 // - location - Resource location. // - options - SharedGalleriesClientListOptions contains the optional parameters for the SharedGalleriesClient.NewListPager // method. @@ -153,7 +153,7 @@ func (client *SharedGalleriesClient) listCreateRequest(ctx context.Context, loca return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-03") + reqQP.Set("api-version", "2023-07-03") if options != nil && options.SharedTo != nil { reqQP.Set("sharedTo", string(*options.SharedTo)) } 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 7f3b1f781dfb..000000000000 --- a/sdk/resourcemanager/compute/armcompute/sharedgalleries_client_example_test.go +++ /dev/null @@ -1,90 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package 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/v5" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-08-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewSharedGalleriesClient().NewListPager("myLocation", &armcompute.SharedGalleriesClientListOptions{SharedTo: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.SharedGalleryList = armcompute.SharedGalleryList{ - // Value: []*armcompute.SharedGallery{ - // { - // Name: to.Ptr("galleryUniqueName"), - // Location: to.Ptr("myLocation"), - // Identifier: &armcompute.SharedGalleryIdentifier{ - // UniqueID: to.Ptr("/SharedGalleries/galleryUniqueName"), - // }, - // Properties: &armcompute.SharedGalleryProperties{ - // ArtifactTags: map[string]*string{ - // "ShareTag-Official1PGallery": to.Ptr("Official1PGallery"), - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-08-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSharedGalleriesClient().Get(ctx, "myLocation", "galleryUniqueName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SharedGallery = armcompute.SharedGallery{ - // Name: to.Ptr("myGalleryName"), - // Location: to.Ptr("myLocation"), - // Identifier: &armcompute.SharedGalleryIdentifier{ - // UniqueID: to.Ptr("/SharedGalleries/galleryUniqueName"), - // }, - // Properties: &armcompute.SharedGalleryProperties{ - // ArtifactTags: map[string]*string{ - // "ShareTag-Official1PGallery": to.Ptr("Official1PGallery"), - // }, - // }, - // } -} diff --git a/sdk/resourcemanager/compute/armcompute/sharedgalleryimages_client.go b/sdk/resourcemanager/compute/armcompute/sharedgalleryimages_client.go index ad549b1406e1..8f0ef79cfe0e 100644 --- a/sdk/resourcemanager/compute/armcompute/sharedgalleryimages_client.go +++ b/sdk/resourcemanager/compute/armcompute/sharedgalleryimages_client.go @@ -47,7 +47,7 @@ func NewSharedGalleryImagesClient(subscriptionID string, credential azcore.Token // Get - Get a shared gallery image by subscription id or tenant id. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-08-03 +// Generated from API version 2023-07-03 // - location - Resource location. // - galleryUniqueName - The unique name of the Shared Gallery. // - galleryImageName - The name of the Shared Gallery Image Definition from which the Image Versions are to be listed. @@ -98,7 +98,7 @@ func (client *SharedGalleryImagesClient) getCreateRequest(ctx context.Context, l return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-03") + reqQP.Set("api-version", "2023-07-03") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -115,7 +115,7 @@ func (client *SharedGalleryImagesClient) getHandleResponse(resp *http.Response) // NewListPager - List shared gallery images by subscription id or tenant id. // -// Generated from API version 2022-08-03 +// Generated from API version 2023-07-03 // - location - Resource location. // - galleryUniqueName - The unique name of the Shared Gallery. // - options - SharedGalleryImagesClientListOptions contains the optional parameters for the SharedGalleryImagesClient.NewListPager @@ -163,7 +163,7 @@ func (client *SharedGalleryImagesClient) listCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-03") + reqQP.Set("api-version", "2023-07-03") if options != nil && options.SharedTo != nil { reqQP.Set("sharedTo", string(*options.SharedTo)) } 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 a93096e2ee90..000000000000 --- a/sdk/resourcemanager/compute/armcompute/sharedgalleryimages_client_example_test.go +++ /dev/null @@ -1,107 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -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/v5" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-08-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewSharedGalleryImagesClient().NewListPager("myLocation", "galleryUniqueName", &armcompute.SharedGalleryImagesClientListOptions{SharedTo: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.SharedGalleryImageList = armcompute.SharedGalleryImageList{ - // Value: []*armcompute.SharedGalleryImage{ - // { - // Name: to.Ptr("myGalleryImageName"), - // Location: to.Ptr("myLocation"), - // Identifier: &armcompute.SharedGalleryIdentifier{ - // UniqueID: to.Ptr("/SharedGalleries/galleryUniqueName/Images/myGalleryImageName"), - // }, - // Properties: &armcompute.SharedGalleryImageProperties{ - // ArtifactTags: map[string]*string{ - // "ShareTag-Official1PGallery": to.Ptr("Official1PGallery"), - // }, - // 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), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-08-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSharedGalleryImagesClient().Get(ctx, "myLocation", "galleryUniqueName", "myGalleryImageName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SharedGalleryImage = armcompute.SharedGalleryImage{ - // Name: to.Ptr("myGalleryImageName"), - // Location: to.Ptr("myLocation"), - // Identifier: &armcompute.SharedGalleryIdentifier{ - // UniqueID: to.Ptr("/SharedGalleries/galleryUniqueName/Images/myGalleryImageName"), - // }, - // Properties: &armcompute.SharedGalleryImageProperties{ - // ArtifactTags: map[string]*string{ - // "ShareTag-Official1PGallery": to.Ptr("Official1PGallery"), - // }, - // Eula: to.Ptr("https://www.microsoft.com/en-us/"), - // 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), - // }, - // } -} diff --git a/sdk/resourcemanager/compute/armcompute/sharedgalleryimageversions_client.go b/sdk/resourcemanager/compute/armcompute/sharedgalleryimageversions_client.go index 5c64dc844214..729b0e3c5d54 100644 --- a/sdk/resourcemanager/compute/armcompute/sharedgalleryimageversions_client.go +++ b/sdk/resourcemanager/compute/armcompute/sharedgalleryimageversions_client.go @@ -47,7 +47,7 @@ func NewSharedGalleryImageVersionsClient(subscriptionID string, credential azcor // Get - Get a shared gallery image version by subscription id or tenant id. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-08-03 +// Generated from API version 2023-07-03 // - location - Resource location. // - galleryUniqueName - The unique name of the Shared Gallery. // - galleryImageName - The name of the Shared Gallery Image Definition from which the Image Versions are to be listed. @@ -106,7 +106,7 @@ func (client *SharedGalleryImageVersionsClient) getCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-03") + reqQP.Set("api-version", "2023-07-03") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -123,7 +123,7 @@ func (client *SharedGalleryImageVersionsClient) getHandleResponse(resp *http.Res // NewListPager - List shared gallery image versions by subscription id or tenant id. // -// Generated from API version 2022-08-03 +// Generated from API version 2023-07-03 // - location - Resource location. // - galleryUniqueName - The unique name of the Shared Gallery. // - galleryImageName - The name of the Shared Gallery Image Definition from which the Image Versions are to be listed. @@ -176,7 +176,7 @@ func (client *SharedGalleryImageVersionsClient) listCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-03") + reqQP.Set("api-version", "2023-07-03") if options != nil && options.SharedTo != nil { reqQP.Set("sharedTo", string(*options.SharedTo)) } 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 6d1151c7e0ed..000000000000 --- a/sdk/resourcemanager/compute/armcompute/sharedgalleryimageversions_client_example_test.go +++ /dev/null @@ -1,108 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package 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/v5" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-08-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewSharedGalleryImageVersionsClient().NewListPager("myLocation", "galleryUniqueName", "myGalleryImageName", &armcompute.SharedGalleryImageVersionsClientListOptions{SharedTo: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.SharedGalleryImageVersionList = armcompute.SharedGalleryImageVersionList{ - // Value: []*armcompute.SharedGalleryImageVersion{ - // { - // Name: to.Ptr("myGalleryImageVersionName"), - // Location: to.Ptr("myLocation"), - // Identifier: &armcompute.SharedGalleryIdentifier{ - // UniqueID: to.Ptr("/SharedGalleries/galleryUniqueName/Images/myGalleryImageName/Versions/myGalleryImageVersionName"), - // }, - // Properties: &armcompute.SharedGalleryImageVersionProperties{ - // ArtifactTags: map[string]*string{ - // "ShareTag-Official1PGallery": to.Ptr("Official1PGallery"), - // }, - // EndOfLifeDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-20T09:12:28.000Z"); return t}()), - // ExcludeFromLatest: to.Ptr(false), - // PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-03-20T09:12:28.000Z"); return t}()), - // StorageProfile: &armcompute.SharedGalleryImageVersionStorageProfile{ - // OSDiskImage: &armcompute.SharedGalleryOSDiskImage{ - // DiskSizeGB: to.Ptr[int32](29), - // HostCaching: to.Ptr(armcompute.SharedGalleryHostCachingNone), - // }, - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-08-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSharedGalleryImageVersionsClient().Get(ctx, "myLocation", "galleryUniqueName", "myGalleryImageName", "myGalleryImageVersionName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SharedGalleryImageVersion = armcompute.SharedGalleryImageVersion{ - // Name: to.Ptr("myGalleryImageVersionName"), - // Location: to.Ptr("myLocation"), - // Identifier: &armcompute.SharedGalleryIdentifier{ - // UniqueID: to.Ptr("/SharedGalleries/galleryUniqueName/Images/myGalleryImageName/Versions/myGalleryImageVersionName"), - // }, - // Properties: &armcompute.SharedGalleryImageVersionProperties{ - // ArtifactTags: map[string]*string{ - // "ShareTag-Official1PGallery": to.Ptr("Official1PGallery"), - // }, - // EndOfLifeDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-20T09:12:28.000Z"); return t}()), - // ExcludeFromLatest: to.Ptr(false), - // PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-03-20T09:12:28.000Z"); return t}()), - // StorageProfile: &armcompute.SharedGalleryImageVersionStorageProfile{ - // OSDiskImage: &armcompute.SharedGalleryOSDiskImage{ - // DiskSizeGB: to.Ptr[int32](29), - // HostCaching: to.Ptr(armcompute.SharedGalleryHostCachingNone), - // }, - // }, - // }, - // } -} 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 22ebeab66b9b..000000000000 --- a/sdk/resourcemanager/compute/armcompute/snapshots_client_example_test.go +++ /dev/null @@ -1,792 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package 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/v5" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-10-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSnapshotsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Snapshot = armcompute.Snapshot{ - // Name: to.Ptr("mySnapshot1"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot"), - // 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"), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-10-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSnapshotsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Snapshot = armcompute.Snapshot{ - // Name: to.Ptr("mySnapshot1"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot"), - // 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"), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-10-02/examples/snapshotExamples/Snapshot_Create_FromAnElasticSanVolumeSnapshot.json -func ExampleSnapshotsClient_BeginCreateOrUpdate_createASnapshotFromAnElasticSanVolumeSnapshot() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSnapshotsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "mySnapshot", armcompute.Snapshot{ - Location: to.Ptr("West US"), - Properties: &armcompute.SnapshotProperties{ - CreationData: &armcompute.CreationData{ - CreateOption: to.Ptr(armcompute.DiskCreateOptionCopyFromSanSnapshot), - ElasticSanResourceID: to.Ptr("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.ElasticSan/elasticSans/myElasticSan/volumegroups/myElasticSanVolumeGroup/snapshots/myElasticSanVolumeSnapshot"), - }, - }, - }, 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Snapshot = armcompute.Snapshot{ - // Name: to.Ptr("mySnapshot"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.SnapshotProperties{ - // CreationData: &armcompute.CreationData{ - // CreateOption: to.Ptr(armcompute.DiskCreateOptionCopyFromSanSnapshot), - // ElasticSanResourceID: to.Ptr("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.ElasticSan/elasticSans/myElasticSan/volumegroups/myElasticSanVolumeGroup/snapshots/myElasticSanVolumeSnapshot"), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-10-02/examples/snapshotExamples/Snapshot_Create_EnhancedProvisionedBandwidthCopySpeed.json -func ExampleSnapshotsClient_BeginCreateOrUpdate_createASnapshotFromAnExistingSnapshotInTheSameOrADifferentSubscriptionInADifferentRegionWithQuickerCopySpeed() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSnapshotsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "mySnapshot2", armcompute.Snapshot{ - Location: to.Ptr("West US"), - Properties: &armcompute.SnapshotProperties{ - CreationData: &armcompute.CreationData{ - CreateOption: to.Ptr(armcompute.DiskCreateOptionCopyStart), - ProvisionedBandwidthCopySpeed: to.Ptr(armcompute.ProvisionedBandwidthCopyOptionEnhanced), - 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Snapshot = armcompute.Snapshot{ - // Name: to.Ptr("mySnapshot2"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot2"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.SnapshotProperties{ - // CreationData: &armcompute.CreationData{ - // CreateOption: to.Ptr(armcompute.DiskCreateOptionCopyStart), - // ProvisionedBandwidthCopySpeed: to.Ptr(armcompute.ProvisionedBandwidthCopyOptionEnhanced), - // SourceResourceID: to.Ptr("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot1"), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-10-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSnapshotsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Snapshot = armcompute.Snapshot{ - // Name: to.Ptr("mySnapshot2"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot2"), - // 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"), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-10-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSnapshotsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Snapshot = armcompute.Snapshot{ - // Name: to.Ptr("mySnapshot2"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot2"), - // 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"), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-10-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSnapshotsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Snapshot = armcompute.Snapshot{ - // Name: to.Ptr("mySnapshot"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "department": to.Ptr("Development"), - // "project": to.Ptr("UpdateSnapshots"), - // }, - // Properties: &armcompute.SnapshotProperties{ - // CreationData: &armcompute.CreationData{ - // CreateOption: to.Ptr(armcompute.DiskCreateOptionCopy), - // SourceResourceID: to.Ptr("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot1"), - // }, - // DiskSizeGB: to.Ptr[int32](20), - // ProvisioningState: to.Ptr("Succeeded"), - // SupportedCapabilities: &armcompute.SupportedCapabilities{ - // AcceleratedNetwork: to.Ptr(false), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-10-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSnapshotsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Snapshot = armcompute.Snapshot{ - // Name: to.Ptr("mySnapshot"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "department": to.Ptr("Development"), - // "project": to.Ptr("UpdateSnapshots"), - // }, - // Properties: &armcompute.SnapshotProperties{ - // CreationData: &armcompute.CreationData{ - // CreateOption: to.Ptr(armcompute.DiskCreateOptionCopy), - // SourceResourceID: to.Ptr("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot1"), - // }, - // DiskSizeGB: to.Ptr[int32](20), - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-10-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSnapshotsClient().Get(ctx, "myResourceGroup", "mySnapshot", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Snapshot = armcompute.Snapshot{ - // Name: to.Ptr("mySnapshot"), - // Type: to.Ptr("Microsoft.Compute/snapshots"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "department": to.Ptr("Development"), - // "project": to.Ptr("Snapshots"), - // }, - // Properties: &armcompute.SnapshotProperties{ - // CreationData: &armcompute.CreationData{ - // CreateOption: to.Ptr(armcompute.DiskCreateOptionCopy), - // SourceResourceID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk"), - // SourceUniqueID: to.Ptr("d633885d-d102-4481-901e-5b2413d1a7be"), - // }, - // DiskSizeGB: to.Ptr[int32](100), - // Encryption: &armcompute.Encryption{ - // Type: to.Ptr(armcompute.EncryptionTypeEncryptionAtRestWithPlatformKey), - // }, - // EncryptionSettingsCollection: &armcompute.EncryptionSettingsCollection{ - // Enabled: to.Ptr(true), - // EncryptionSettings: []*armcompute.EncryptionSettingsElement{ - // { - // DiskEncryptionKey: &armcompute.KeyVaultAndSecretReference{ - // SecretURL: to.Ptr("https://myvmvault.vault-int.azure-int.net/secrets/{secret}"), - // SourceVault: &armcompute.SourceVault{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault"), - // }, - // }, - // KeyEncryptionKey: &armcompute.KeyVaultAndKeyReference{ - // 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"), - // }, - // }, - // }}, - // }, - // HyperVGeneration: to.Ptr(armcompute.HyperVGenerationV1), - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // ProvisioningState: to.Ptr("Succeeded"), - // PurchasePlan: &armcompute.DiskPurchasePlan{ - // Name: to.Ptr("test_sku"), - // Product: to.Ptr("marketplace_vm_test"), - // Publisher: to.Ptr("test_test_pmc2pc1"), - // }, - // SupportedCapabilities: &armcompute.SupportedCapabilities{ - // AcceleratedNetwork: to.Ptr(true), - // }, - // SupportsHibernation: to.Ptr(true), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2016-12-28T04:41:35.079Z"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-10-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSnapshotsClient().Get(ctx, "myResourceGroup", "myIncrementalSnapshot", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Snapshot = armcompute.Snapshot{ - // Name: to.Ptr("myIncrementalSnapshot"), - // Type: to.Ptr("Microsoft.Compute/snapshots"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/myIncrementalSnapshot"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "department": to.Ptr("Development"), - // "project": to.Ptr("Snapshots"), - // }, - // Properties: &armcompute.SnapshotProperties{ - // CreationData: &armcompute.CreationData{ - // CreateOption: to.Ptr(armcompute.DiskCreateOptionCopy), - // SourceResourceID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk"), - // SourceUniqueID: to.Ptr("d633885d-d102-4481-901e-5b2413d1a7be"), - // }, - // DiskSizeBytes: to.Ptr[int64](10737418240), - // DiskSizeGB: to.Ptr[int32](100), - // DiskState: to.Ptr(armcompute.DiskState("0")), - // Encryption: &armcompute.Encryption{ - // Type: to.Ptr(armcompute.EncryptionTypeEncryptionAtRestWithPlatformKey), - // }, - // EncryptionSettingsCollection: &armcompute.EncryptionSettingsCollection{ - // Enabled: to.Ptr(true), - // EncryptionSettings: []*armcompute.EncryptionSettingsElement{ - // { - // DiskEncryptionKey: &armcompute.KeyVaultAndSecretReference{ - // SecretURL: to.Ptr("https://myvmvault.vault-int.azure-int.net/secrets/{secret}"), - // SourceVault: &armcompute.SourceVault{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault"), - // }, - // }, - // KeyEncryptionKey: &armcompute.KeyVaultAndKeyReference{ - // 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"), - // }, - // }, - // }}, - // }, - // HyperVGeneration: to.Ptr(armcompute.HyperVGenerationV1), - // Incremental: to.Ptr(true), - // IncrementalSnapshotFamilyID: to.Ptr("d1a341d5-1ea7-4a85-b304-944ad8021639"), - // NetworkAccessPolicy: to.Ptr(armcompute.NetworkAccessPolicy("0")), - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // ProvisioningState: to.Ptr("Succeeded"), - // PurchasePlan: &armcompute.DiskPurchasePlan{ - // Name: to.Ptr("test_sku"), - // Product: to.Ptr("marketplace_vm_test"), - // Publisher: to.Ptr("test_test_pmc2pc1"), - // }, - // SupportedCapabilities: &armcompute.SupportedCapabilities{ - // AcceleratedNetwork: to.Ptr(true), - // }, - // SupportsHibernation: to.Ptr(true), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2016-12-28T04:41:35.079Z"); return t}()), - // UniqueID: to.Ptr("a395e9c1-fb9e-446e-a9ba-7b2fa0bcd305"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-10-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSnapshotsClient().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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-10-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewSnapshotsClient().NewListByResourceGroupPager("myResourceGroup", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.SnapshotList = armcompute.SnapshotList{ - // Value: []*armcompute.Snapshot{ - // { - // Name: to.Ptr("mySnapshot"), - // Type: to.Ptr("Microsoft.Compute/snapshots"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "department": to.Ptr("Development"), - // "project": to.Ptr("Snapshots"), - // }, - // Properties: &armcompute.SnapshotProperties{ - // CreationData: &armcompute.CreationData{ - // CreateOption: to.Ptr(armcompute.DiskCreateOptionCopy), - // SourceResourceID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot"), - // }, - // DiskSizeGB: to.Ptr[int32](200), - // Encryption: &armcompute.Encryption{ - // Type: to.Ptr(armcompute.EncryptionTypeEncryptionAtRestWithPlatformKey), - // }, - // EncryptionSettingsCollection: &armcompute.EncryptionSettingsCollection{ - // Enabled: to.Ptr(true), - // EncryptionSettings: []*armcompute.EncryptionSettingsElement{ - // { - // DiskEncryptionKey: &armcompute.KeyVaultAndSecretReference{ - // SecretURL: to.Ptr("https://myvmvault.vault-int.azure-int.net/secrets/{secret}"), - // SourceVault: &armcompute.SourceVault{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault"), - // }, - // }, - // KeyEncryptionKey: &armcompute.KeyVaultAndKeyReference{ - // 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"), - // }, - // }, - // }}, - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // ProvisioningState: to.Ptr("Succeeded"), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2016-12-28T04:41:35.927Z"); return t}()), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-10-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewSnapshotsClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.SnapshotList = armcompute.SnapshotList{ - // Value: []*armcompute.Snapshot{ - // { - // Name: to.Ptr("mySnapshot1"), - // Type: to.Ptr("Microsoft.Compute/snapshots"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot1"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "department": to.Ptr("Development"), - // "project": to.Ptr("Snapshots"), - // }, - // Properties: &armcompute.SnapshotProperties{ - // CreationData: &armcompute.CreationData{ - // CreateOption: to.Ptr(armcompute.DiskCreateOptionCopy), - // SourceResourceID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot"), - // }, - // DiskSizeGB: to.Ptr[int32](200), - // Encryption: &armcompute.Encryption{ - // Type: to.Ptr(armcompute.EncryptionTypeEncryptionAtRestWithPlatformKey), - // }, - // EncryptionSettingsCollection: &armcompute.EncryptionSettingsCollection{ - // Enabled: to.Ptr(true), - // EncryptionSettings: []*armcompute.EncryptionSettingsElement{ - // { - // DiskEncryptionKey: &armcompute.KeyVaultAndSecretReference{ - // SecretURL: to.Ptr("https://myvmvault.vault-int.azure-int.net/secrets/{secret}"), - // SourceVault: &armcompute.SourceVault{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault"), - // }, - // }, - // KeyEncryptionKey: &armcompute.KeyVaultAndKeyReference{ - // 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"), - // }, - // }, - // }}, - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // ProvisioningState: to.Ptr("Succeeded"), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2016-12-28T04:47:30.663Z"); return t}()), - // }, - // }, - // { - // Name: to.Ptr("mySnapshot2"), - // Type: to.Ptr("Microsoft.Compute/snapshots"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot2"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "department": to.Ptr("Development"), - // "project": to.Ptr("Snapshots"), - // }, - // 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/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myStorageAccount"), - // }, - // DiskSizeGB: to.Ptr[int32](200), - // Encryption: &armcompute.Encryption{ - // Type: to.Ptr(armcompute.EncryptionTypeEncryptionAtRestWithPlatformKey), - // }, - // EncryptionSettingsCollection: &armcompute.EncryptionSettingsCollection{ - // Enabled: to.Ptr(true), - // EncryptionSettings: []*armcompute.EncryptionSettingsElement{ - // { - // DiskEncryptionKey: &armcompute.KeyVaultAndSecretReference{ - // SecretURL: to.Ptr("https://myvmvault.vault-int.azure-int.net/secrets/{secret}"), - // SourceVault: &armcompute.SourceVault{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault"), - // }, - // }, - // KeyEncryptionKey: &armcompute.KeyVaultAndKeyReference{ - // 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"), - // }, - // }, - // }}, - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // ProvisioningState: to.Ptr("Succeeded"), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2016-12-28T04:47:30.324Z"); return t}()), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-10-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSnapshotsClient().BeginGrantAccess(ctx, "myResourceGroup", "mySnapshot", armcompute.GrantAccessData{ - Access: to.Ptr(armcompute.AccessLevelRead), - DurationInSeconds: to.Ptr[int32](300), - FileFormat: to.Ptr(armcompute.FileFormatVHDX), - }, 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AccessURI = armcompute.AccessURI{ - // AccessSAS: to.Ptr("https://md-gpvmcxzlzxgd.partition.blob.storage.azure.net/xx3cqcx53f0v/abcd?sv=2014-02-14&sr=b&sk=key1&sig=XXX&st=2021-05-24T18:02:34Z&se=2021-05-24T18:19:14Z&sp=r"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-10-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSnapshotsClient().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_example_test.go b/sdk/resourcemanager/compute/armcompute/sshpublickeys_client_example_test.go deleted file mode 100644 index e93cae3bcf0a..000000000000 --- a/sdk/resourcemanager/compute/armcompute/sshpublickeys_client_example_test.go +++ /dev/null @@ -1,407 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package 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/v5" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/sshPublicKeyExamples/SshPublicKey_ListBySubscription_MaximumSet_Gen.json -func ExampleSSHPublicKeysClient_NewListBySubscriptionPager_sshPublicKeyListBySubscriptionMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewSSHPublicKeysClient().NewListBySubscriptionPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.SSHPublicKeysGroupListResult = armcompute.SSHPublicKeysGroupListResult{ - // Value: []*armcompute.SSHPublicKeyResource{ - // { - // Name: to.Ptr("mySshPublicKeyName"), - // Type: to.Ptr("aaaa"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/sshPublicKeys/mySshPublicKeyName"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "key6396": to.Ptr("aaaaaaaaaaaaa"), - // "key8839": to.Ptr("aaa"), - // }, - // Properties: &armcompute.SSHPublicKeyResourceProperties{ - // PublicKey: to.Ptr("{ssh-rsa public key}"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/sshPublicKeyExamples/SshPublicKey_ListBySubscription_MinimumSet_Gen.json -func ExampleSSHPublicKeysClient_NewListBySubscriptionPager_sshPublicKeyListBySubscriptionMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewSSHPublicKeysClient().NewListBySubscriptionPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.SSHPublicKeysGroupListResult = armcompute.SSHPublicKeysGroupListResult{ - // Value: []*armcompute.SSHPublicKeyResource{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/rgcompute/providers/Microsoft.Compute/sshPublicKeys/mySshPublicKeyName"), - // Location: to.Ptr("westus"), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/sshPublicKeyExamples/SshPublicKey_ListByResourceGroup_MaximumSet_Gen.json -func ExampleSSHPublicKeysClient_NewListByResourceGroupPager_sshPublicKeyListByResourceGroupMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewSSHPublicKeysClient().NewListByResourceGroupPager("rgcompute", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.SSHPublicKeysGroupListResult = armcompute.SSHPublicKeysGroupListResult{ - // Value: []*armcompute.SSHPublicKeyResource{ - // { - // Name: to.Ptr("mySshPublicKeyName"), - // Type: to.Ptr("aaaa"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/sshPublicKeys/mySshPublicKeyName"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "key6396": to.Ptr("aaaaaaaaaaaaa"), - // "key8839": to.Ptr("aaa"), - // }, - // Properties: &armcompute.SSHPublicKeyResourceProperties{ - // PublicKey: to.Ptr("{ssh-rsa public key}"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/sshPublicKeyExamples/SshPublicKey_ListByResourceGroup_MinimumSet_Gen.json -func ExampleSSHPublicKeysClient_NewListByResourceGroupPager_sshPublicKeyListByResourceGroupMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewSSHPublicKeysClient().NewListByResourceGroupPager("rgcompute", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.SSHPublicKeysGroupListResult = armcompute.SSHPublicKeysGroupListResult{ - // Value: []*armcompute.SSHPublicKeyResource{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/rgcompute/providers/Microsoft.Compute/sshPublicKeys/mySshPublicKeyName"), - // Location: to.Ptr("westus"), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSSHPublicKeysClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SSHPublicKeyResource = armcompute.SSHPublicKeyResource{ - // Name: to.Ptr("mySshPublicKeyName"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/sshPublicKeys/mySshPublicKeyName"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.SSHPublicKeyResourceProperties{ - // PublicKey: to.Ptr("{ssh-rsa public key}"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/sshPublicKeyExamples/SshPublicKey_Update_MaximumSet_Gen.json -func ExampleSSHPublicKeysClient_Update_sshPublicKeyUpdateMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSSHPublicKeysClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SSHPublicKeyResource = armcompute.SSHPublicKeyResource{ - // Name: to.Ptr("mySshPublicKeyName"), - // Type: to.Ptr("aaaa"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/sshPublicKeys/mySshPublicKeyName"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "key6396": to.Ptr("aaaaaaaaaaaaa"), - // "key8839": to.Ptr("aaa"), - // }, - // Properties: &armcompute.SSHPublicKeyResourceProperties{ - // PublicKey: to.Ptr("{ssh-rsa public key}"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/sshPublicKeyExamples/SshPublicKey_Update_MinimumSet_Gen.json -func ExampleSSHPublicKeysClient_Update_sshPublicKeyUpdateMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSSHPublicKeysClient().Update(ctx, "rgcompute", "aaaaaaaaaaa", armcompute.SSHPublicKeyUpdateResource{}, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SSHPublicKeyResource = armcompute.SSHPublicKeyResource{ - // Location: to.Ptr("westus"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/sshPublicKeyExamples/SshPublicKey_Delete_MaximumSet_Gen.json -func ExampleSSHPublicKeysClient_Delete_sshPublicKeyDeleteMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewSSHPublicKeysClient().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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/sshPublicKeyExamples/SshPublicKey_Delete_MinimumSet_Gen.json -func ExampleSSHPublicKeysClient_Delete_sshPublicKeyDeleteMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewSSHPublicKeysClient().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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSSHPublicKeysClient().Get(ctx, "myResourceGroup", "mySshPublicKeyName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SSHPublicKeyResource = armcompute.SSHPublicKeyResource{ - // Name: to.Ptr("mySshPublicKeyName"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/SshPublicKeys/mySshPublicKeyName"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "{tagName}": to.Ptr("{tagValue}"), - // }, - // Properties: &armcompute.SSHPublicKeyResourceProperties{ - // PublicKey: to.Ptr("{ssh-rsa public key}"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/sshPublicKeyExamples/SshPublicKey_GenerateKeyPair_EncryptionWithEd25519.json -func ExampleSSHPublicKeysClient_GenerateKeyPair_generateAnSshKeyPairWithEd25519Encryption() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSSHPublicKeysClient().GenerateKeyPair(ctx, "myResourceGroup", "mySshPublicKeyName", &armcompute.SSHPublicKeysClientGenerateKeyPairOptions{Parameters: &armcompute.SSHGenerateKeyPairInputParameters{ - EncryptionType: to.Ptr(armcompute.SSHEncryptionTypesRSA), - }, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SSHPublicKeyGenerateKeyPairResult = armcompute.SSHPublicKeyGenerateKeyPairResult{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/SshPublicKeys/mySshPublicKeyName"), - // PrivateKey: to.Ptr("{ssh private key}"), - // PublicKey: to.Ptr("{ssh-rsa public key}"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/sshPublicKeyExamples/SshPublicKey_GenerateKeyPair_EncryptionWithRSA.json -func ExampleSSHPublicKeysClient_GenerateKeyPair_generateAnSshKeyPairWithRsaEncryption() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSSHPublicKeysClient().GenerateKeyPair(ctx, "myResourceGroup", "mySshPublicKeyName", &armcompute.SSHPublicKeysClientGenerateKeyPairOptions{Parameters: &armcompute.SSHGenerateKeyPairInputParameters{ - EncryptionType: to.Ptr(armcompute.SSHEncryptionTypesRSA), - }, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SSHPublicKeyGenerateKeyPairResult = armcompute.SSHPublicKeyGenerateKeyPairResult{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/SshPublicKeys/mySshPublicKeyName"), - // PrivateKey: to.Ptr("{ed25519 private key}"), - // PublicKey: to.Ptr("{ed25519 public key}"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/sshPublicKeyExamples/SshPublicKey_GenerateKeyPair.json -func ExampleSSHPublicKeysClient_GenerateKeyPair_generateAnSshKeyPair() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSSHPublicKeysClient().GenerateKeyPair(ctx, "myResourceGroup", "mySshPublicKeyName", &armcompute.SSHPublicKeysClientGenerateKeyPairOptions{Parameters: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SSHPublicKeyGenerateKeyPairResult = armcompute.SSHPublicKeyGenerateKeyPairResult{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/SshPublicKeys/mySshPublicKeyName"), - // PrivateKey: to.Ptr("{ssh private key}"), - // PublicKey: to.Ptr("{ssh-rsa public key}"), - // } -} 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 f98589650053..000000000000 --- a/sdk/resourcemanager/compute/armcompute/usage_client_example_test.go +++ /dev/null @@ -1,90 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package 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/v5" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewUsageClient().NewListPager("4_.", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ListUsagesResult = armcompute.ListUsagesResult{ - // Value: []*armcompute.Usage{ - // { - // Name: &armcompute.UsageName{ - // LocalizedValue: to.Ptr("aaaaaaaaaaaaaa"), - // Value: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // }, - // CurrentValue: to.Ptr[int32](17), - // Limit: to.Ptr[int64](19), - // Unit: to.Ptr("Count"), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewUsageClient().NewListPager("_--", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ListUsagesResult = armcompute.ListUsagesResult{ - // Value: []*armcompute.Usage{ - // { - // Name: &armcompute.UsageName{ - // }, - // CurrentValue: to.Ptr[int32](17), - // Limit: to.Ptr[int64](19), - // Unit: to.Ptr("Count"), - // }}, - // } - } -} 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 5512db2976b3..000000000000 --- a/sdk/resourcemanager/compute/armcompute/virtualmachineextensionimages_client_example_test.go +++ /dev/null @@ -1,212 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package 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/v5" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineExtensionImageExamples/VirtualMachineExtensionImage_Get_MaximumSet_Gen.json -func ExampleVirtualMachineExtensionImagesClient_Get_virtualMachineExtensionImageGetMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineExtensionImagesClient().Get(ctx, "aaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineExtensionImage = armcompute.VirtualMachineExtensionImage{ - // Name: to.Ptr("aaaaaaaaaaaaaaa"), - // Type: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // ID: to.Ptr("aaaaaaaaaaaaaaaaa"), - // Location: to.Ptr("aaaaaaaaaaaaa"), - // Tags: map[string]*string{ - // "key9885": to.Ptr("aaaaaaaaa"), - // }, - // Properties: &armcompute.VirtualMachineExtensionImageProperties{ - // ComputeRole: to.Ptr("aaaaaaaaaaaaaaaaa"), - // HandlerSchema: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // OperatingSystem: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // SupportsMultipleExtensions: to.Ptr(true), - // VMScaleSetEnabled: to.Ptr(true), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineExtensionImageExamples/VirtualMachineExtensionImage_Get_MinimumSet_Gen.json -func ExampleVirtualMachineExtensionImagesClient_Get_virtualMachineExtensionImageGetMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineExtensionImagesClient().Get(ctx, "aaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaa", "aa", "aaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineExtensionImage = armcompute.VirtualMachineExtensionImage{ - // Name: to.Ptr("aaaaaaaaaaaaaaa"), - // ID: to.Ptr("aaaaaaaaaaaaaaaaa"), - // Location: to.Ptr("aaaaaaaaaaaaa"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineExtensionImageExamples/VirtualMachineExtensionImage_ListTypes_MaximumSet_Gen.json -func ExampleVirtualMachineExtensionImagesClient_ListTypes_virtualMachineExtensionImageListTypesMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineExtensionImagesClient().ListTypes(ctx, "aaaaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineExtensionImageArray = []*armcompute.VirtualMachineExtensionImage{ - // { - // Name: to.Ptr("aaaaaaaaaaaaaaa"), - // Type: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // ID: to.Ptr("aaaaaaaaaaaaaaaaa"), - // Location: to.Ptr("aaaaaaaaaaaaa"), - // Tags: map[string]*string{ - // "key9885": to.Ptr("aaaaaaaaa"), - // }, - // Properties: &armcompute.VirtualMachineExtensionImageProperties{ - // ComputeRole: to.Ptr("aaaaaaaaaaaaaaaaa"), - // HandlerSchema: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // OperatingSystem: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // SupportsMultipleExtensions: to.Ptr(true), - // VMScaleSetEnabled: to.Ptr(true), - // }, - // }} -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineExtensionImageExamples/VirtualMachineExtensionImage_ListTypes_MinimumSet_Gen.json -func ExampleVirtualMachineExtensionImagesClient_ListTypes_virtualMachineExtensionImageListTypesMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineExtensionImagesClient().ListTypes(ctx, "aaaa", "aa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineExtensionImageArray = []*armcompute.VirtualMachineExtensionImage{ - // { - // Name: to.Ptr("aaaaaaaaaaaaaaa"), - // ID: to.Ptr("aaaaaaaaaaaaaaaaa"), - // Location: to.Ptr("aaaaaaaaaaaaa"), - // }} -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineExtensionImageExamples/VirtualMachineExtensionImage_ListVersions_MaximumSet_Gen.json -func ExampleVirtualMachineExtensionImagesClient_ListVersions_virtualMachineExtensionImageListVersionsMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineExtensionImagesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineExtensionImageArray = []*armcompute.VirtualMachineExtensionImage{ - // { - // Name: to.Ptr("aaaaaaaaaaaaaaa"), - // Type: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // ID: to.Ptr("aaaaaaaaaaaaaaaaa"), - // Location: to.Ptr("aaaaaaaaaaaaa"), - // Tags: map[string]*string{ - // "key9885": to.Ptr("aaaaaaaaa"), - // }, - // Properties: &armcompute.VirtualMachineExtensionImageProperties{ - // ComputeRole: to.Ptr("aaaaaaaaaaaaaaaaa"), - // HandlerSchema: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // OperatingSystem: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // SupportsMultipleExtensions: to.Ptr(true), - // VMScaleSetEnabled: to.Ptr(true), - // }, - // }} -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineExtensionImageExamples/VirtualMachineExtensionImage_ListVersions_MinimumSet_Gen.json -func ExampleVirtualMachineExtensionImagesClient_ListVersions_virtualMachineExtensionImageListVersionsMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineExtensionImagesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineExtensionImageArray = []*armcompute.VirtualMachineExtensionImage{ - // { - // Name: to.Ptr("aaaaaaaaaaaaaaa"), - // ID: to.Ptr("aaaaaaaaaaaaaaaaa"), - // Location: to.Ptr("aaaaaaaaaaaaa"), - // }} -} 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 f124123c71e6..000000000000 --- a/sdk/resourcemanager/compute/armcompute/virtualmachineextensions_client_example_test.go +++ /dev/null @@ -1,439 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package 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/v5" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineExamples/VirtualMachineExtension_CreateOrUpdate_MaximumSet_Gen.json -func ExampleVirtualMachineExtensionsClient_BeginCreateOrUpdate_virtualMachineExtensionCreateOrUpdateMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineExtensionsClient().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]any{}, - Publisher: to.Ptr("extPublisher"), - Settings: map[string]any{}, - 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineExtension = armcompute.VirtualMachineExtension{ - // Name: to.Ptr("myVMExtension"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines/extensions"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM/extensions/myVMExtension"), - // 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]any{ - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // Publisher: to.Ptr("extPublisher"), - // Settings: map[string]any{ - // }, - // SuppressFailures: to.Ptr(true), - // TypeHandlerVersion: to.Ptr("1.2"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineExamples/VirtualMachineExtension_CreateOrUpdate_MinimumSet_Gen.json -func ExampleVirtualMachineExtensionsClient_BeginCreateOrUpdate_virtualMachineExtensionCreateOrUpdateMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineExtensionsClient().BeginCreateOrUpdate(ctx, "rgcompute", "myVM", "myVMExtension", 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineExtension = armcompute.VirtualMachineExtension{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/rgcompute/providers/Microsoft.Compute/virtualMachines/myVM/extensions/myVMExtension"), - // Location: to.Ptr("westus"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineExamples/VirtualMachineExtension_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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineExtensionsClient().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]any{ - "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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineExtension = armcompute.VirtualMachineExtension{ - // Name: to.Ptr("myVMExtension"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines/extensions"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM/extensions/myVMExtension"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineExtensionProperties{ - // 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"), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // Publisher: to.Ptr("extPublisher"), - // Settings: map[string]any{ - // "UserName": "xyz@microsoft.com", - // }, - // SuppressFailures: to.Ptr(true), - // TypeHandlerVersion: to.Ptr("1.2"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineExamples/VirtualMachineExtension_Delete_MaximumSet_Gen.json -func ExampleVirtualMachineExtensionsClient_BeginDelete_virtualMachineExtensionDeleteMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineExtensionsClient().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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineExamples/VirtualMachineExtension_Delete_MinimumSet_Gen.json -func ExampleVirtualMachineExtensionsClient_BeginDelete_virtualMachineExtensionDeleteMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineExtensionsClient().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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineExamples/VirtualMachineExtension_Get_MaximumSet_Gen.json -func ExampleVirtualMachineExtensionsClient_Get_virtualMachineExtensionGetMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineExtensionsClient().Get(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaa", &armcompute.VirtualMachineExtensionsClientGetOptions{Expand: to.Ptr("aaaaaa")}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineExtension = armcompute.VirtualMachineExtension{ - // Name: to.Ptr("myVMExtension"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines/extensions"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM/extensions/myVMExtension"), - // 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]any{ - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // Publisher: to.Ptr("extPublisher"), - // Settings: map[string]any{ - // }, - // SuppressFailures: to.Ptr(true), - // TypeHandlerVersion: to.Ptr("1.2"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineExamples/VirtualMachineExtension_Get_MinimumSet_Gen.json -func ExampleVirtualMachineExtensionsClient_Get_virtualMachineExtensionGetMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineExtensionsClient().Get(ctx, "rgcompute", "myVM", "myVMExtension", &armcompute.VirtualMachineExtensionsClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineExtension = armcompute.VirtualMachineExtension{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/rgcompute/providers/Microsoft.Compute/virtualMachines/myVM/extensions/myVMExtension"), - // Location: to.Ptr("westus"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineExamples/VirtualMachineExtension_List_MaximumSet_Gen.json -func ExampleVirtualMachineExtensionsClient_List_virtualMachineExtensionListMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineExtensionsClient().List(ctx, "rgcompute", "aaaaaaaaaaaaa", &armcompute.VirtualMachineExtensionsClientListOptions{Expand: to.Ptr("aaaaaaaaaaaaaaaaa")}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineExtensionsListResult = armcompute.VirtualMachineExtensionsListResult{ - // Value: []*armcompute.VirtualMachineExtension{ - // { - // Name: to.Ptr("myVMExtension"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines/extensions"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM/extensions/myVMExtension"), - // 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]any{ - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // Publisher: to.Ptr("extPublisher"), - // Settings: map[string]any{ - // }, - // SuppressFailures: to.Ptr(true), - // TypeHandlerVersion: to.Ptr("1.2"), - // }, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineExamples/VirtualMachineExtension_List_MinimumSet_Gen.json -func ExampleVirtualMachineExtensionsClient_List_virtualMachineExtensionListMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineExtensionsClient().List(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaaaa", &armcompute.VirtualMachineExtensionsClientListOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineExtensionsListResult = armcompute.VirtualMachineExtensionsListResult{ - // } -} 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 8e0c8c5e304b..000000000000 --- a/sdk/resourcemanager/compute/armcompute/virtualmachineimages_client_example_test.go +++ /dev/null @@ -1,408 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package 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/v5" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineImageExamples/VirtualMachineImage_Get_MaximumSet_Gen.json -func ExampleVirtualMachineImagesClient_Get_virtualMachineImageGetMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineImagesClient().Get(ctx, "aaaaaa", "aaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineImage = armcompute.VirtualMachineImage{ - // ID: to.Ptr("aaaaaaaaaaa"), - // Name: to.Ptr("aaaaaaaaa"), - // ExtendedLocation: &armcompute.ExtendedLocation{ - // Name: to.Ptr("aaaaaaaaaaaaaaaaaaaaa"), - // Type: to.Ptr(armcompute.ExtendedLocationTypesEdgeZone), - // }, - // Location: to.Ptr("aaaaa"), - // Tags: map[string]*string{ - // "key6817": to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // }, - // Properties: &armcompute.VirtualMachineImageProperties{ - // AutomaticOSUpgradeProperties: &armcompute.AutomaticOSUpgradeProperties{ - // AutomaticOSUpgradeSupported: to.Ptr(true), - // }, - // DataDiskImages: []*armcompute.DataDiskImage{ - // { - // Lun: to.Ptr[int32](17), - // }}, - // Disallowed: &armcompute.DisallowedConfiguration{ - // VMDiskType: to.Ptr(armcompute.VMDiskTypesNone), - // }, - // Features: []*armcompute.VirtualMachineImageFeature{ - // { - // Name: to.Ptr("aaaaaaaaaaaaaaaaaaaaa"), - // Value: to.Ptr("aaaaaaaaaaaaaaaaaaaa"), - // }}, - // HyperVGeneration: to.Ptr(armcompute.HyperVGenerationTypesV1), - // ImageDeprecationStatus: &armcompute.ImageDeprecationStatus{ - // AlternativeOption: &armcompute.AlternativeOption{ - // Type: to.Ptr(armcompute.AlternativeTypeOffer), - // Value: to.Ptr("aaaaaaa"), - // }, - // ImageState: to.Ptr(armcompute.ImageStateScheduledForDeprecation), - // ScheduledDeprecationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-13T00:00:00.000Z"); return t}()), - // }, - // OSDiskImage: &armcompute.OSDiskImage{ - // OperatingSystem: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // Plan: &armcompute.PurchasePlan{ - // Name: to.Ptr("aaaaaaaaa"), - // Product: to.Ptr("aaaaaaaaaaaaaa"), - // Publisher: to.Ptr("aaaaaaaaaaaaaaaaaaa"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineImageExamples/VirtualMachineImage_Get_MinimumSet_Gen.json -func ExampleVirtualMachineImagesClient_Get_virtualMachineImageGetMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineImagesClient().Get(ctx, "aaaaaaaaaaaa", "aaaaaaaaaaa", "aa", "aaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineImage = armcompute.VirtualMachineImage{ - // ID: to.Ptr("aaaaaaaaaaa"), - // Name: to.Ptr("aaaaaaaaa"), - // Location: to.Ptr("aaaaa"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineImageExamples/VirtualMachineImage_List_MaximumSet_Gen.json -func ExampleVirtualMachineImagesClient_List_virtualMachineImageListMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineImagesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineImageResourceArray = []*armcompute.VirtualMachineImageResource{ - // { - // ID: to.Ptr("aaaaaaaaaaa"), - // Name: to.Ptr("aaaaaaaa"), - // ExtendedLocation: &armcompute.ExtendedLocation{ - // Name: to.Ptr("aaaaaaaaaaaaaaaaaaaaa"), - // Type: to.Ptr(armcompute.ExtendedLocationTypesEdgeZone), - // }, - // Location: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // Tags: map[string]*string{ - // "key7868": to.Ptr("aaaaa"), - // }, - // }} -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineImageExamples/VirtualMachineImage_List_MinimumSet_Gen.json -func ExampleVirtualMachineImagesClient_List_virtualMachineImageListMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineImagesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineImageResourceArray = []*armcompute.VirtualMachineImageResource{ - // { - // ID: to.Ptr("aaaaaaaaaaa"), - // Name: to.Ptr("aaaaaaaa"), - // Location: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // }} -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineImageExamples/VirtualMachineImage_ListOffers_MaximumSet_Gen.json -func ExampleVirtualMachineImagesClient_ListOffers_virtualMachineImageListOffersMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineImagesClient().ListOffers(ctx, "aaaaaaa", "aaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineImageResourceArray = []*armcompute.VirtualMachineImageResource{ - // { - // ID: to.Ptr("aaaaaaaaaaa"), - // Name: to.Ptr("aaaaaaaa"), - // ExtendedLocation: &armcompute.ExtendedLocation{ - // Name: to.Ptr("aaaaaaaaaaaaaaaaaaaaa"), - // Type: to.Ptr(armcompute.ExtendedLocationTypesEdgeZone), - // }, - // Location: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // Tags: map[string]*string{ - // "key7868": to.Ptr("aaaaa"), - // }, - // }} -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineImageExamples/VirtualMachineImage_ListOffers_MinimumSet_Gen.json -func ExampleVirtualMachineImagesClient_ListOffers_virtualMachineImageListOffersMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineImagesClient().ListOffers(ctx, "aaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineImageResourceArray = []*armcompute.VirtualMachineImageResource{ - // { - // ID: to.Ptr("aaaaaaaaaaa"), - // Name: to.Ptr("aaaaaaaa"), - // Location: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // }} -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineImageExamples/VirtualMachineImage_ListPublishers_MaximumSet_Gen.json -func ExampleVirtualMachineImagesClient_ListPublishers_virtualMachineImageListPublishersMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineImagesClient().ListPublishers(ctx, "aaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineImageResourceArray = []*armcompute.VirtualMachineImageResource{ - // { - // ID: to.Ptr("aaaaaaaaaaa"), - // Name: to.Ptr("aaaaaaaa"), - // ExtendedLocation: &armcompute.ExtendedLocation{ - // Name: to.Ptr("aaaaaaaaaaaaaaaaaaaaa"), - // Type: to.Ptr(armcompute.ExtendedLocationTypesEdgeZone), - // }, - // Location: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // Tags: map[string]*string{ - // "key7868": to.Ptr("aaaaa"), - // }, - // }} -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineImageExamples/VirtualMachineImage_ListPublishers_MinimumSet_Gen.json -func ExampleVirtualMachineImagesClient_ListPublishers_virtualMachineImageListPublishersMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineImagesClient().ListPublishers(ctx, "aaaaaaaaaaaaaaaaaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineImageResourceArray = []*armcompute.VirtualMachineImageResource{ - // { - // ID: to.Ptr("aaaaaaaaaaa"), - // Name: to.Ptr("aaaaaaaa"), - // Location: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // }} -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineImageExamples/VirtualMachineImage_ListSkus_MaximumSet_Gen.json -func ExampleVirtualMachineImagesClient_ListSKUs_virtualMachineImageListSkusMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineImagesClient().ListSKUs(ctx, "aaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineImageResourceArray = []*armcompute.VirtualMachineImageResource{ - // { - // ID: to.Ptr("aaaaaaaaaaa"), - // Name: to.Ptr("aaaaaaaa"), - // ExtendedLocation: &armcompute.ExtendedLocation{ - // Name: to.Ptr("aaaaaaaaaaaaaaaaaaaaa"), - // Type: to.Ptr(armcompute.ExtendedLocationTypesEdgeZone), - // }, - // Location: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // Tags: map[string]*string{ - // "key7868": to.Ptr("aaaaa"), - // }, - // }} -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineImageExamples/VirtualMachineImage_ListSkus_MinimumSet_Gen.json -func ExampleVirtualMachineImagesClient_ListSKUs_virtualMachineImageListSkusMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineImagesClient().ListSKUs(ctx, "aaaa", "aaaaaaaaaaaaa", "aaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineImageResourceArray = []*armcompute.VirtualMachineImageResource{ - // { - // ID: to.Ptr("aaaaaaaaaaa"), - // Name: to.Ptr("aaaaaaaa"), - // Location: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // }} -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineImagesClient().ListByEdgeZone(ctx, "WestUS", "microsoftlosangeles1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VMImagesInEdgeZoneListResult = armcompute.VMImagesInEdgeZoneListResult{ - // Value: []*armcompute.VirtualMachineImageResource{ - // { - // ID: to.Ptr("/Subscriptions/5ece5940-d962-4dad-a98f-ca9ac0f021a5/Providers/Microsoft.Compute/Locations/westus/Publishers/CANONICAL/ArtifactTypes/VMImage/Offers/UBUNTUSERVER/Skus/18_04-LTS-GEN2/Versions/18.04.202107200"), - // Name: to.Ptr("18.04.202107200"), - // ExtendedLocation: &armcompute.ExtendedLocation{ - // Name: to.Ptr("microsoftlosangeles1"), - // Type: to.Ptr(armcompute.ExtendedLocationTypesEdgeZone), - // }, - // Location: to.Ptr("WestUS"), - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineImagesClient().ListByEdgeZone(ctx, "WestUS", "microsoftlosangeles1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VMImagesInEdgeZoneListResult = armcompute.VMImagesInEdgeZoneListResult{ - // Value: []*armcompute.VirtualMachineImageResource{ - // }, - // } -} 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 f073d05c6fd5..000000000000 --- a/sdk/resourcemanager/compute/armcompute/virtualmachineimagesedgezone_client_example_test.go +++ /dev/null @@ -1,344 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package 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/v5" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineImagesEdgeZoneClient().Get(ctx, "aaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineImage = armcompute.VirtualMachineImage{ - // ID: to.Ptr("aaaaaaaaaaa"), - // Name: to.Ptr("aaaaaaaaa"), - // ExtendedLocation: &armcompute.ExtendedLocation{ - // Name: to.Ptr("aaaaaaaaaaaaaaaaaaaaa"), - // Type: to.Ptr(armcompute.ExtendedLocationTypesEdgeZone), - // }, - // Location: to.Ptr("aaaaa"), - // Tags: map[string]*string{ - // "key6817": to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // }, - // Properties: &armcompute.VirtualMachineImageProperties{ - // AutomaticOSUpgradeProperties: &armcompute.AutomaticOSUpgradeProperties{ - // AutomaticOSUpgradeSupported: to.Ptr(true), - // }, - // DataDiskImages: []*armcompute.DataDiskImage{ - // { - // Lun: to.Ptr[int32](17), - // }}, - // Disallowed: &armcompute.DisallowedConfiguration{ - // VMDiskType: to.Ptr(armcompute.VMDiskTypesNone), - // }, - // Features: []*armcompute.VirtualMachineImageFeature{ - // { - // Name: to.Ptr("aaaaaaaaaaaaaaaaaaaaa"), - // Value: to.Ptr("aaaaaaaaaaaaaaaaaaaa"), - // }}, - // HyperVGeneration: to.Ptr(armcompute.HyperVGenerationTypesV1), - // OSDiskImage: &armcompute.OSDiskImage{ - // OperatingSystem: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // Plan: &armcompute.PurchasePlan{ - // Name: to.Ptr("aaaaaaaaa"), - // Product: to.Ptr("aaaaaaaaaaaaaa"), - // Publisher: to.Ptr("aaaaaaaaaaaaaaaaaaa"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineImagesEdgeZoneClient().Get(ctx, "aaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaa", "aaaaaaaaaaaaaaaaaa", "aa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineImage = armcompute.VirtualMachineImage{ - // ID: to.Ptr("aaaaaaaaaaa"), - // Name: to.Ptr("aaaaaaaaa"), - // Location: to.Ptr("aaaaa"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineImagesEdgeZoneClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineImageResourceArray = []*armcompute.VirtualMachineImageResource{ - // { - // ID: to.Ptr("aaaaaaaaaaa"), - // Name: to.Ptr("aaaaaaaa"), - // ExtendedLocation: &armcompute.ExtendedLocation{ - // Name: to.Ptr("aaaaaaaaaaaaaaaaaaaaa"), - // Type: to.Ptr(armcompute.ExtendedLocationTypesEdgeZone), - // }, - // Location: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // Tags: map[string]*string{ - // "key7868": to.Ptr("aaaaa"), - // }, - // }} -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineImagesEdgeZoneClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineImageResourceArray = []*armcompute.VirtualMachineImageResource{ - // { - // ID: to.Ptr("aaaaaaaaaaa"), - // Name: to.Ptr("aaaaaaaa"), - // Location: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // }} -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineImagesEdgeZoneClient().ListOffers(ctx, "aaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineImageResourceArray = []*armcompute.VirtualMachineImageResource{ - // { - // ID: to.Ptr("aaaaaaaaaaa"), - // Name: to.Ptr("aaaaaaaa"), - // ExtendedLocation: &armcompute.ExtendedLocation{ - // Name: to.Ptr("aaaaaaaaaaaaaaaaaaaaa"), - // Type: to.Ptr(armcompute.ExtendedLocationTypesEdgeZone), - // }, - // Location: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // Tags: map[string]*string{ - // "key7868": to.Ptr("aaaaa"), - // }, - // }} -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineImagesEdgeZoneClient().ListOffers(ctx, "aaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineImageResourceArray = []*armcompute.VirtualMachineImageResource{ - // { - // ID: to.Ptr("aaaaaaaaaaa"), - // Name: to.Ptr("aaaaaaaa"), - // Location: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // }} -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineImagesEdgeZoneClient().ListPublishers(ctx, "aaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineImageResourceArray = []*armcompute.VirtualMachineImageResource{ - // { - // ID: to.Ptr("aaaaaaaaaaa"), - // Name: to.Ptr("aaaaaaaa"), - // ExtendedLocation: &armcompute.ExtendedLocation{ - // Name: to.Ptr("aaaaaaaaaaaaaaaaaaaaa"), - // Type: to.Ptr(armcompute.ExtendedLocationTypesEdgeZone), - // }, - // Location: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // Tags: map[string]*string{ - // "key7868": to.Ptr("aaaaa"), - // }, - // }} -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineImagesEdgeZoneClient().ListPublishers(ctx, "aaaa", "aaaaaaaaaaaaaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineImageResourceArray = []*armcompute.VirtualMachineImageResource{ - // { - // ID: to.Ptr("aaaaaaaaaaa"), - // Name: to.Ptr("aaaaaaaa"), - // Location: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // }} -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineImagesEdgeZoneClient().ListSKUs(ctx, "aaaaaaaaaaaa", "aaaaa", "aaaaaaaaaaaa", "aaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineImageResourceArray = []*armcompute.VirtualMachineImageResource{ - // { - // ID: to.Ptr("aaaaaaaaaaa"), - // Name: to.Ptr("aaaaaaaa"), - // ExtendedLocation: &armcompute.ExtendedLocation{ - // Name: to.Ptr("aaaaaaaaaaaaaaaaaaaaa"), - // Type: to.Ptr(armcompute.ExtendedLocationTypesEdgeZone), - // }, - // Location: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // Tags: map[string]*string{ - // "key7868": to.Ptr("aaaaa"), - // }, - // }} -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineImagesEdgeZoneClient().ListSKUs(ctx, "aaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaa", "aaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineImageResourceArray = []*armcompute.VirtualMachineImageResource{ - // { - // ID: to.Ptr("aaaaaaaaaaa"), - // Name: to.Ptr("aaaaaaaa"), - // Location: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // }} -} 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 96e95b219258..000000000000 --- a/sdk/resourcemanager/compute/armcompute/virtualmachineruncommands_client_example_test.go +++ /dev/null @@ -1,452 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package 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/v5" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualMachineRunCommandsClient().NewListPager("SoutheastAsia", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.RunCommandListResult = armcompute.RunCommandListResult{ - // Value: []*armcompute.RunCommandDocumentBase{ - // { - // Description: to.Ptr("Configure the machine to enable remote PowerShell."), - // Schema: to.Ptr("http://schema.management.azure.com/schemas/2016-11-17/runcommands.json"), - // ID: to.Ptr("EnableRemotePS"), - // Label: to.Ptr("Enable remote PowerShell"), - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // { - // Description: to.Ptr("Shows detailed information for the IP address, subnet mask and default gateway for each adapter bound to TCP/IP."), - // Schema: to.Ptr("http://schema.management.azure.com/schemas/2016-11-17/runcommands.json"), - // ID: to.Ptr("IPConfig"), - // Label: to.Ptr("List IP configuration"), - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // { - // Description: to.Ptr("Custom multiline PowerShell script should be defined in script property. Optional parameters can be set in parameters property."), - // Schema: to.Ptr("http://schema.management.azure.com/schemas/2016-11-17/runcommands.json"), - // ID: to.Ptr("RunPowerShellScript"), - // Label: to.Ptr("Executes a PowerShell script"), - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // { - // Description: to.Ptr("Custom multiline shell script should be defined in script property. Optional parameters can be set in parameters property."), - // Schema: to.Ptr("http://schema.management.azure.com/schemas/2016-11-17/runcommands.json"), - // ID: to.Ptr("RunShellScript"), - // Label: to.Ptr("Executes a Linux shell script"), - // OSType: to.Ptr(armcompute.OperatingSystemTypesLinux), - // }, - // { - // Description: to.Ptr("Get the configuration of all network interfaces."), - // Schema: to.Ptr("http://schema.management.azure.com/schemas/2016-11-17/runcommands.json"), - // ID: to.Ptr("ifconfig"), - // Label: to.Ptr("List network configuration"), - // OSType: to.Ptr(armcompute.OperatingSystemTypesLinux), - // }, - // { - // Description: to.Ptr("Checks if the local Administrator account is disabled, and if so enables it."), - // Schema: to.Ptr("http://schema.management.azure.com/schemas/2016-11-17/runcommands.json"), - // ID: to.Ptr("EnableAdminAccount"), - // Label: to.Ptr("Enable administrator account"), - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // { - // Description: to.Ptr("Reset built-in Administrator account password."), - // Schema: to.Ptr("http://schema.management.azure.com/schemas/2016-11-17/runcommands.json"), - // ID: to.Ptr("ResetAccountPassword"), - // Label: to.Ptr("Reset built-in Administrator account password"), - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // { - // Description: to.Ptr("Checks registry settings and domain policy settings. Suggests policy actions if machine is part of a domain or modifies the settings to default values."), - // Schema: to.Ptr("http://schema.management.azure.com/schemas/2016-11-17/runcommands.json"), - // ID: to.Ptr("RDPSettings"), - // Label: to.Ptr("Verify RDP Listener Settings"), - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // { - // Description: to.Ptr("Sets the default or user specified port number for Remote Desktop connections. Enables firewall rule for inbound access to the port."), - // Schema: to.Ptr("http://schema.management.azure.com/schemas/2016-11-17/runcommands.json"), - // ID: to.Ptr("SetRDPPort"), - // Label: to.Ptr("Set Remote Desktop port"), - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // { - // Description: to.Ptr("Removes the SSL certificate tied to the RDP listener and restores the RDP listerner security to default. Use this script if you see any issues with the certificate."), - // Schema: to.Ptr("http://schema.management.azure.com/schemas/2016-11-17/runcommands.json"), - // ID: to.Ptr("ResetRDPCert"), - // Label: to.Ptr("Restore RDP Authentication mode to defaults"), - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineRunCommandsClient().Get(ctx, "SoutheastAsia", "RunPowerShellScript", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RunCommandDocument = armcompute.RunCommandDocument{ - // Description: to.Ptr("Custom multiline PowerShell script should be defined in script property. Optional parameters can be set in parameters property."), - // Schema: to.Ptr("http://schema.management.azure.com/schemas/2016-11-17/runcommands.json"), - // ID: to.Ptr("RunPowerShellScript"), - // Label: to.Ptr("Executes a PowerShell script"), - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // Parameters: []*armcompute.RunCommandParameterDefinition{ - // { - // Name: to.Ptr("arg1"), - // Type: to.Ptr("string"), - // DefaultValue: to.Ptr("value1"), - // }, - // { - // Name: to.Ptr("arg2"), - // Type: to.Ptr("string"), - // DefaultValue: to.Ptr("value2"), - // }}, - // Script: []*string{ - // to.Ptr("param("), - // to.Ptr(" [string]$arg1,"), - // to.Ptr(" [string]$arg2"), - // to.Ptr(")"), - // to.Ptr("Write-Host This is a sample script with parameters $arg1 $arg2")}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineRunCommandsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", "myRunCommand", armcompute.VirtualMachineRunCommand{ - Location: to.Ptr("West US"), - Properties: &armcompute.VirtualMachineRunCommandProperties{ - AsyncExecution: to.Ptr(false), - ErrorBlobURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/scriptcontainer/scriptURI"), - OutputBlobManagedIdentity: &armcompute.RunCommandManagedIdentity{ - ClientID: to.Ptr("22d35efb-0c99-4041-8c5b-6d24db33a69a"), - }, - OutputBlobURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/myscriptoutputcontainer/MyScriptoutput.txt"), - 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{ - ScriptURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/scriptcontainer/scriptURI"), - }, - TimeoutInSeconds: to.Ptr[int32](3600), - TreatFailureAsDeploymentFailure: 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineRunCommand = armcompute.VirtualMachineRunCommand{ - // Name: to.Ptr("myRunCommand"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines/runCommands"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM/runCommands/myRunCommand"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "tag1": to.Ptr("value1"), - // "tag2": to.Ptr("value2"), - // }, - // Properties: &armcompute.VirtualMachineRunCommandProperties{ - // AsyncExecution: to.Ptr(false), - // ErrorBlobURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/mycontainer/MyScriptError.txt"), - // OutputBlobURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/myscriptoutputcontainer/MyScriptoutput.txt"), - // Parameters: []*armcompute.RunCommandInputParameter{ - // { - // Name: to.Ptr("param1"), - // Value: to.Ptr("value1"), - // }, - // { - // Name: to.Ptr("param2"), - // Value: to.Ptr("value2"), - // }}, - // ProvisioningState: to.Ptr("Succeeded"), - // RunAsUser: to.Ptr("user1"), - // Source: &armcompute.VirtualMachineRunCommandScriptSource{ - // ScriptURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/scriptcontainer/MyScript.ps1"), - // }, - // TimeoutInSeconds: to.Ptr[int32](3600), - // TreatFailureAsDeploymentFailure: to.Ptr(false), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineRunCommandsClient().BeginUpdate(ctx, "myResourceGroup", "myVM", "myRunCommand", armcompute.VirtualMachineRunCommandUpdate{ - Properties: &armcompute.VirtualMachineRunCommandProperties{ - AsyncExecution: to.Ptr(false), - ErrorBlobManagedIdentity: &armcompute.RunCommandManagedIdentity{ - ObjectID: to.Ptr("4231e4d2-33e4-4e23-96b2-17888afa6072"), - }, - ErrorBlobURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/mycontainer/MyScriptError.txt"), - OutputBlobURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/myscriptoutputcontainer/outputUri"), - 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! ; Remove-Item C: est estFile.txt"), - }, - 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineRunCommand = armcompute.VirtualMachineRunCommand{ - // Name: to.Ptr("myRunCommand"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines/runCommands"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM/runCommands/myRunCommand"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "tag1": to.Ptr("value1"), - // "tag2": to.Ptr("value2"), - // }, - // Properties: &armcompute.VirtualMachineRunCommandProperties{ - // AsyncExecution: to.Ptr(false), - // ErrorBlobURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/mycontainer/MyScriptError.txt"), - // OutputBlobURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/myscriptoutputcontainer/MyScriptoutput.txt"), - // Parameters: []*armcompute.RunCommandInputParameter{ - // { - // Name: to.Ptr("param1"), - // Value: to.Ptr("value1"), - // }, - // { - // Name: to.Ptr("param2"), - // Value: to.Ptr("value2"), - // }}, - // ProvisioningState: to.Ptr("Succeeded"), - // RunAsUser: to.Ptr("user1"), - // Source: &armcompute.VirtualMachineRunCommandScriptSource{ - // Script: to.Ptr("Write-Host Hello World! ; Remove-Item C: est estFile.txt"), - // }, - // TimeoutInSeconds: to.Ptr[int32](3600), - // TreatFailureAsDeploymentFailure: to.Ptr(false), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineRunCommandsClient().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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineRunCommandsClient().GetByVirtualMachine(ctx, "myResourceGroup", "myVM", "myRunCommand", &armcompute.VirtualMachineRunCommandsClientGetByVirtualMachineOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineRunCommand = armcompute.VirtualMachineRunCommand{ - // Name: to.Ptr("myRunCommand"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines/runCommands"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM/runCommands/myRunCommand"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "tag1": to.Ptr("value1"), - // "tag2": to.Ptr("value2"), - // }, - // Properties: &armcompute.VirtualMachineRunCommandProperties{ - // AsyncExecution: to.Ptr(false), - // ErrorBlobURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/mycontainer/MyScriptError.txt"), - // OutputBlobURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/myscriptoutputcontainer/MyScriptoutput.txt"), - // Parameters: []*armcompute.RunCommandInputParameter{ - // { - // Name: to.Ptr("param1"), - // Value: to.Ptr("value1"), - // }, - // { - // Name: to.Ptr("param2"), - // Value: to.Ptr("value2"), - // }}, - // ProvisioningState: to.Ptr("Succeeded"), - // RunAsUser: to.Ptr("user1"), - // Source: &armcompute.VirtualMachineRunCommandScriptSource{ - // Script: to.Ptr("Write-Host Hello World! ; Remove-Item C: est estFile.txt"), - // }, - // TimeoutInSeconds: to.Ptr[int32](3600), - // TreatFailureAsDeploymentFailure: to.Ptr(false), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualMachineRunCommandsClient().NewListByVirtualMachinePager("myResourceGroup", "myVM", &armcompute.VirtualMachineRunCommandsClientListByVirtualMachineOptions{Expand: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.VirtualMachineRunCommandsListResult = armcompute.VirtualMachineRunCommandsListResult{ - // Value: []*armcompute.VirtualMachineRunCommand{ - // { - // Name: to.Ptr("myRunCommand"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines/runCommands"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM/runCommands/myRunCommand"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "tag1": to.Ptr("value1"), - // "tag2": to.Ptr("value2"), - // }, - // Properties: &armcompute.VirtualMachineRunCommandProperties{ - // AsyncExecution: to.Ptr(false), - // ErrorBlobURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/mycontainer/MyScriptError.txt"), - // OutputBlobURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/myscriptoutputcontainer/MyScriptoutput.txt"), - // Parameters: []*armcompute.RunCommandInputParameter{ - // { - // Name: to.Ptr("param1"), - // Value: to.Ptr("value1"), - // }, - // { - // Name: to.Ptr("param2"), - // Value: to.Ptr("value2"), - // }}, - // ProvisioningState: to.Ptr("Succeeded"), - // RunAsUser: to.Ptr("user1"), - // Source: &armcompute.VirtualMachineRunCommandScriptSource{ - // Script: to.Ptr("Write-Host Hello World!"), - // }, - // TimeoutInSeconds: to.Ptr[int32](0), - // TreatFailureAsDeploymentFailure: to.Ptr(false), - // }, - // }}, - // } - } -} 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 706966b4f947..000000000000 --- a/sdk/resourcemanager/compute/armcompute/virtualmachines_client_example_test.go +++ /dev/null @@ -1,9690 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package 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/v5" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineExamples/VirtualMachine_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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualMachinesClient().NewListByLocationPager("eastus", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.VirtualMachineListResult = armcompute.VirtualMachineListResult{ - // Value: []*armcompute.VirtualMachine{ - // { - // Name: to.Ptr("{virtualMachineName}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{virtualMachineName}"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "RG": to.Ptr("rg"), - // "testTag": to.Ptr("1"), - // }, - // Properties: &armcompute.VirtualMachineProperties{ - // AvailabilitySet: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // HardwareProfile: &armcompute.HardwareProfile{ - // VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardA0), - // }, - // NetworkProfile: &armcompute.NetworkProfile{ - // NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - // { - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}"), - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("Foo12"), - // AllowExtensionOperations: to.Ptr(true), - // ComputerName: to.Ptr("Test"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("WindowsServer"), - // Publisher: to.Ptr("MicrosoftWindowsServer"), - // SKU: to.Ptr("2012-R2-Datacenter"), - // Version: to.Ptr("4.127.20170406"), - // }, - // OSDisk: &armcompute.OSDisk{ - // Name: to.Ptr("test"), - // Caching: to.Ptr(armcompute.CachingTypesNone), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // DiskSizeGB: to.Ptr[int32](127), - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // Vhd: &armcompute.VirtualHardDisk{ - // URI: to.Ptr("https://{storageAccountName}.blob.core.windows.net/{containerName}/{vhdName}.vhd"), - // }, - // }, - // }, - // VMID: to.Ptr("{vmId}"), - // }, - // }, - // { - // Name: to.Ptr("{virtualMachineName}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{virtualMachineName}"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "RG": to.Ptr("rg"), - // "testTag": to.Ptr("1"), - // }, - // Properties: &armcompute.VirtualMachineProperties{ - // AvailabilitySet: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // HardwareProfile: &armcompute.HardwareProfile{ - // VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardA0), - // }, - // NetworkProfile: &armcompute.NetworkProfile{ - // NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - // { - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}"), - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("Foo12"), - // AllowExtensionOperations: to.Ptr(true), - // ComputerName: to.Ptr("Test"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("WindowsServer"), - // Publisher: to.Ptr("MicrosoftWindowsServer"), - // SKU: to.Ptr("2012-R2-Datacenter"), - // Version: to.Ptr("4.127.20170406"), - // }, - // OSDisk: &armcompute.OSDisk{ - // Name: to.Ptr("test"), - // Caching: to.Ptr(armcompute.CachingTypesNone), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // DiskSizeGB: to.Ptr[int32](127), - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // Vhd: &armcompute.VirtualHardDisk{ - // URI: to.Ptr("https://{storageAccountName}.blob.core.windows.net/{containerName}/{vhdName}.vhd"), - // }, - // }, - // }, - // VMID: to.Ptr("{vmId}"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineExamples/VirtualMachine_Capture_MaximumSet_Gen.json -func ExampleVirtualMachinesClient_BeginCapture_virtualMachineCaptureMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineCaptureResult = armcompute.VirtualMachineCaptureResult{ - // ID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Schema: to.Ptr("aaaaa"), - // ContentVersion: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // Parameters: map[string]any{ - // }, - // Resources: []any{ - // map[string]any{ - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineExamples/VirtualMachine_Capture_MinimumSet_Gen.json -func ExampleVirtualMachinesClient_BeginCapture_virtualMachineCaptureMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineCaptureResult = armcompute.VirtualMachineCaptureResult{ - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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), - }, - }, - }, - }, - }, &armcompute.VirtualMachinesClientBeginCreateOrUpdateOptions{IfMatch: nil, - IfNoneMatch: 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // 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/nsgExistingNic"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // LinuxConfiguration: &armcompute.LinuxConfiguration{ - // PatchSettings: &armcompute.LinuxPatchSettings{ - // AssessmentMode: to.Ptr(armcompute.LinuxPatchAssessmentModeImageDefault), - // }, - // ProvisionVMAgent: to.Ptr(true), - // }, - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // 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), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesLinux), - // }, - // }, - // VMID: to.Ptr("a149cd25-409f-41af-8088-275f5486bc93"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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{ - BypassPlatformSafetyChecksOnUserSchedule: to.Ptr(true), - 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), - }, - }, - }, - }, - }, &armcompute.VirtualMachinesClientBeginCreateOrUpdateOptions{IfMatch: nil, - IfNoneMatch: 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // 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/nsgExistingNic"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // LinuxConfiguration: &armcompute.LinuxConfiguration{ - // PatchSettings: &armcompute.LinuxPatchSettings{ - // AssessmentMode: to.Ptr(armcompute.LinuxPatchAssessmentModeAutomaticByPlatform), - // AutomaticByPlatformSettings: &armcompute.LinuxVMGuestPatchAutomaticByPlatformSettings{ - // BypassPlatformSafetyChecksOnUserSchedule: to.Ptr(true), - // RebootSetting: to.Ptr(armcompute.LinuxVMGuestPatchAutomaticByPlatformRebootSettingNever), - // }, - // PatchMode: to.Ptr(armcompute.LinuxVMGuestPatchModeAutomaticByPlatform), - // }, - // ProvisionVMAgent: to.Ptr(true), - // }, - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // 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), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesLinux), - // }, - // }, - // VMID: to.Ptr("a149cd25-409f-41af-8088-275f5486bc93"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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), - }, - }, - }, - }, - }, &armcompute.VirtualMachinesClientBeginCreateOrUpdateOptions{IfMatch: nil, - IfNoneMatch: 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // 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/nsgExistingNic"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // LinuxConfiguration: &armcompute.LinuxConfiguration{ - // PatchSettings: &armcompute.LinuxPatchSettings{ - // PatchMode: to.Ptr(armcompute.LinuxVMGuestPatchModeImageDefault), - // }, - // ProvisionVMAgent: to.Ptr(true), - // }, - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // 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), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesLinux), - // }, - // }, - // VMID: to.Ptr("a149cd25-409f-41af-8088-275f5486bc93"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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), - }, - }, - }, - }, - }, &armcompute.VirtualMachinesClientBeginCreateOrUpdateOptions{IfMatch: nil, - IfNoneMatch: 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // 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/nsgExistingNic"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // 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), - // }, - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // 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), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesLinux), - // }, - // }, - // VMID: to.Ptr("a149cd25-409f-41af-8088-275f5486bc93"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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), - }, - }, - }, - }, - }, &armcompute.VirtualMachinesClientBeginCreateOrUpdateOptions{IfMatch: nil, - IfNoneMatch: 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // 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{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // LinuxConfiguration: &armcompute.LinuxConfiguration{ - // DisablePasswordAuthentication: to.Ptr(false), - // }, - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // 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), - // DiskSizeGB: to.Ptr[int32](30), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesLinux), - // }, - // }, - // VMID: to.Ptr("71aa3d5a-d73d-4970-9182-8580433b2865"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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), - }, - }, - }, - }, - }, &armcompute.VirtualMachinesClientBeginCreateOrUpdateOptions{IfMatch: nil, - IfNoneMatch: 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // 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{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // LinuxConfiguration: &armcompute.LinuxConfiguration{ - // DisablePasswordAuthentication: to.Ptr(false), - // }, - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // 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), - // DiskSizeGB: to.Ptr[int32](30), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesLinux), - // }, - // }, - // VMID: to.Ptr("71aa3d5a-d73d-4970-9182-8580433b2865"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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=="), - }, - }, &armcompute.VirtualMachinesClientBeginCreateOrUpdateOptions{IfMatch: nil, - IfNoneMatch: 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineProperties{ - // DiagnosticsProfile: &armcompute.DiagnosticsProfile{ - // BootDiagnostics: &armcompute.BootDiagnostics{ - // Enabled: to.Ptr(true), - // StorageURI: to.Ptr("http://nsgdiagnostic.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/nsgExistingNic"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // 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), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }, - // VMID: to.Ptr("676420ba-7a24-4bfe-80bd-9c841ee184fa"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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), - }, - }, - }, - }, - }, &armcompute.VirtualMachinesClientBeginCreateOrUpdateOptions{IfMatch: nil, - IfNoneMatch: 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("{vm-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/{vm-name}"), - // 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://nsgdiagnostic.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/nsgExistingNic"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("{vm-name}"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // 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), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }, - // VMID: to.Ptr("676420ba-7a24-4bfe-80bd-9c841ee184fa"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineExamples/VirtualMachine_Create_WithProxyAgentSettings.json -func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createAVmWithProxyAgentSettingsOfEnabledAndMode() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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{ - ProxyAgentSettings: &armcompute.ProxyAgentSettings{ - Enabled: to.Ptr(true), - Mode: to.Ptr(armcompute.ModeEnforce), - }, - }, - 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("myVMosdisk"), - Caching: to.Ptr(armcompute.CachingTypesReadOnly), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.ManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardSSDLRS), - }, - }, - }, - }, - }, &armcompute.VirtualMachinesClientBeginCreateOrUpdateOptions{IfMatch: nil, - IfNoneMatch: 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // 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/nsgExistingNic"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // SecurityProfile: &armcompute.SecurityProfile{ - // ProxyAgentSettings: &armcompute.ProxyAgentSettings{ - // Enabled: to.Ptr(true), - // Mode: to.Ptr(armcompute.ModeEnforce), - // }, - // }, - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // 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("myVMosdisk"), - // Caching: to.Ptr(armcompute.CachingTypesReadOnly), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardSSDLRS), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }, - // VMID: to.Ptr("5c0d55a7-c407-4ed6-bf7d-ddb810267c85"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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), - }, - }, - }, - }, - }, &armcompute.VirtualMachinesClientBeginCreateOrUpdateOptions{IfMatch: nil, - IfNoneMatch: 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // 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/nsgExistingNic"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // SecurityProfile: &armcompute.SecurityProfile{ - // SecurityType: to.Ptr(armcompute.SecurityTypesTrustedLaunch), - // UefiSettings: &armcompute.UefiSettings{ - // SecureBootEnabled: to.Ptr(true), - // VTpmEnabled: to.Ptr(true), - // }, - // }, - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // 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), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }, - // VMID: to.Ptr("5c0d55a7-c407-4ed6-bf7d-ddb810267c85"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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=="), - }, - }, &armcompute.VirtualMachinesClientBeginCreateOrUpdateOptions{IfMatch: nil, - IfNoneMatch: 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("{vm-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/{vm-name}"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineProperties{ - // DiagnosticsProfile: &armcompute.DiagnosticsProfile{ - // BootDiagnostics: &armcompute.BootDiagnostics{ - // Enabled: to.Ptr(true), - // StorageURI: to.Ptr("http://nsgdiagnostic.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/nsgExistingNic"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("{vm-name}"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // 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), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }, - // VMID: to.Ptr("676420ba-7a24-4bfe-80bd-9c841ee184fa"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineExamples/VirtualMachine_Create_WithVMSizeProperties.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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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=="), - }, - }, &armcompute.VirtualMachinesClientBeginCreateOrUpdateOptions{IfMatch: nil, - IfNoneMatch: 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineProperties{ - // DiagnosticsProfile: &armcompute.DiagnosticsProfile{ - // BootDiagnostics: &armcompute.BootDiagnostics{ - // Enabled: to.Ptr(true), - // StorageURI: to.Ptr("http://nsgdiagnostic.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/nsgExistingNic"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // 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), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }, - // VMID: to.Ptr("676420ba-7a24-4bfe-80bd-9c841ee184fa"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineExamples/VirtualMachine_Create_WithEncryptionIdentity.json -func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createAVmWithEncryptionIdentity() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{ - Location: to.Ptr("westus"), - Identity: &armcompute.VirtualMachineIdentity{ - Type: to.Ptr(armcompute.ResourceIdentityTypeUserAssigned), - UserAssignedIdentities: map[string]*armcompute.UserAssignedIdentitiesValue{ - "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myIdentity": {}, - }, - }, - 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{ - EncryptionIdentity: &armcompute.EncryptionIdentity{ - UserAssignedIdentityResourceID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myIdentity"), - }, - }, - 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("myVMosdisk"), - Caching: to.Ptr(armcompute.CachingTypesReadOnly), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.ManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardSSDLRS), - }, - }, - }, - }, - }, &armcompute.VirtualMachinesClientBeginCreateOrUpdateOptions{IfMatch: nil, - IfNoneMatch: 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // Location: to.Ptr("westus"), - // Identity: &armcompute.VirtualMachineIdentity{ - // Type: to.Ptr(armcompute.ResourceIdentityTypeUserAssigned), - // UserAssignedIdentities: map[string]*armcompute.UserAssignedIdentitiesValue{ - // "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myIdentity": &armcompute.UserAssignedIdentitiesValue{ - // }, - // }, - // }, - // 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/nsgExistingNic"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // SecurityProfile: &armcompute.SecurityProfile{ - // EncryptionIdentity: &armcompute.EncryptionIdentity{ - // UserAssignedIdentityResourceID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myIdentity"), - // }, - // }, - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // 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("myVMosdisk"), - // Caching: to.Ptr(armcompute.CachingTypesReadOnly), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardSSDLRS), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }, - // VMID: to.Ptr("5c0d55a7-c407-4ed6-bf7d-ddb810267c85"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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), - }, - }, - }, - }, - }, &armcompute.VirtualMachinesClientBeginCreateOrUpdateOptions{IfMatch: nil, - IfNoneMatch: 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // 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/toBeCreatedNetworkInterface"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // 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), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }, - // VMID: to.Ptr("b7a098cc-b0b8-46e8-a205-62f301a62a8f"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineExamples/VirtualMachine_Create_WithNetworkInterfaceConfigurationDnsSettings.json -func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createAVmWithNetworkInterfaceConfigurationWithPublicIpAddressDnsSettings() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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), - DNSSettings: &armcompute.VirtualMachinePublicIPAddressDNSSettingsConfiguration{ - DomainNameLabel: to.Ptr("aaaaa"), - DomainNameLabelScope: to.Ptr(armcompute.DomainNameLabelScopeTypesTenantReuse), - }, - 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), - }, - }, - }, - }, - }, &armcompute.VirtualMachinesClientBeginCreateOrUpdateOptions{IfMatch: nil, - IfNoneMatch: 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // 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/toBeCreatedNetworkInterface"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // 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), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }, - // VMID: to.Ptr("b7a098cc-b0b8-46e8-a205-62f301a62a8f"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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), - }, - }, - }, - }, - }, &armcompute.VirtualMachinesClientBeginCreateOrUpdateOptions{IfMatch: nil, - IfNoneMatch: 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // 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/nsgExistingNic"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // SecurityProfile: &armcompute.SecurityProfile{ - // SecurityType: to.Ptr(armcompute.SecurityTypesConfidentialVM), - // UefiSettings: &armcompute.UefiSettings{ - // SecureBootEnabled: to.Ptr(true), - // VTpmEnabled: to.Ptr(true), - // }, - // }, - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // 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), - // }, - // }, - // }, - // VMID: to.Ptr("5c0d55a7-c407-4ed6-bf7d-ddb810267c85"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineExamples/VirtualMachine_Create_WithSecurityTypeConfidentialVMWithNonPersistedTPM.json -func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createAVmWithSecurityTypeConfidentialVmWithNonPersistedTpmSecurityEncryptionType() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineProperties{ - HardwareProfile: &armcompute.HardwareProfile{ - VMSize: to.Ptr(armcompute.VirtualMachineSizeTypes("Standard_DC2es_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(false), - VTpmEnabled: to.Ptr(true), - }, - }, - StorageProfile: &armcompute.StorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("2022-datacenter-cvm"), - Publisher: to.Ptr("UbuntuServer"), - SKU: to.Ptr("linux-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.SecurityEncryptionTypesNonPersistedTPM), - }, - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardSSDLRS), - }, - }, - }, - }, - }, &armcompute.VirtualMachinesClientBeginCreateOrUpdateOptions{IfMatch: nil, - IfNoneMatch: 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineProperties{ - // HardwareProfile: &armcompute.HardwareProfile{ - // VMSize: to.Ptr(armcompute.VirtualMachineSizeTypes("Standard_DC2es_v5")), - // }, - // 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{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // SecurityProfile: &armcompute.SecurityProfile{ - // SecurityType: to.Ptr(armcompute.SecurityTypesConfidentialVM), - // UefiSettings: &armcompute.UefiSettings{ - // SecureBootEnabled: to.Ptr(false), - // VTpmEnabled: to.Ptr(true), - // }, - // }, - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("2022-datacenter-cvm"), - // Publisher: to.Ptr("UbuntuServer"), - // SKU: to.Ptr("linux-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.SecurityEncryptionTypesNonPersistedTPM), - // }, - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardSSDLRS), - // }, - // }, - // }, - // VMID: to.Ptr("5c0d55a7-c407-4ed6-bf7d-ddb810267c85"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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), - }, - }, - }, - }, - }, &armcompute.VirtualMachinesClientBeginCreateOrUpdateOptions{IfMatch: nil, - IfNoneMatch: 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // 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/nsgExistingNic"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // SecurityProfile: &armcompute.SecurityProfile{ - // SecurityType: to.Ptr(armcompute.SecurityTypesConfidentialVM), - // UefiSettings: &armcompute.UefiSettings{ - // SecureBootEnabled: to.Ptr(true), - // VTpmEnabled: to.Ptr(true), - // }, - // }, - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // 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), - // }, - // }, - // }, - // VMID: to.Ptr("5c0d55a7-c407-4ed6-bf7d-ddb810267c85"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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), - }, - }, - }, - }, - }, &armcompute.VirtualMachinesClientBeginCreateOrUpdateOptions{IfMatch: nil, - IfNoneMatch: 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // Location: to.Ptr("westus"), - // 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/nsgExistingNic"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // PatchSettings: &armcompute.PatchSettings{ - // AssessmentMode: to.Ptr(armcompute.WindowsPatchAssessmentModeImageDefault), - // }, - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // 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), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }, - // VMID: to.Ptr("a149cd25-409f-41af-8088-275f5486bc93"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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), - }, - }, - }, - }, - }, &armcompute.VirtualMachinesClientBeginCreateOrUpdateOptions{IfMatch: nil, - IfNoneMatch: 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // Location: to.Ptr("westus"), - // 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/nsgExistingNic"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // PatchSettings: &armcompute.PatchSettings{ - // PatchMode: to.Ptr(armcompute.WindowsVMGuestPatchModeAutomaticByOS), - // }, - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // 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), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }, - // VMID: to.Ptr("a149cd25-409f-41af-8088-275f5486bc93"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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{ - BypassPlatformSafetyChecksOnUserSchedule: to.Ptr(false), - 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), - }, - }, - }, - }, - }, &armcompute.VirtualMachinesClientBeginCreateOrUpdateOptions{IfMatch: nil, - IfNoneMatch: 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // Location: to.Ptr("westus"), - // 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/nsgExistingNic"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // PatchSettings: &armcompute.PatchSettings{ - // AssessmentMode: to.Ptr(armcompute.WindowsPatchAssessmentModeAutomaticByPlatform), - // AutomaticByPlatformSettings: &armcompute.WindowsVMGuestPatchAutomaticByPlatformSettings{ - // BypassPlatformSafetyChecksOnUserSchedule: to.Ptr(false), - // RebootSetting: to.Ptr(armcompute.WindowsVMGuestPatchAutomaticByPlatformRebootSettingNever), - // }, - // PatchMode: to.Ptr(armcompute.WindowsVMGuestPatchModeAutomaticByPlatform), - // }, - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // 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), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }, - // VMID: to.Ptr("a149cd25-409f-41af-8088-275f5486bc93"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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), - }, - }, - }, - }, - }, &armcompute.VirtualMachinesClientBeginCreateOrUpdateOptions{IfMatch: nil, - IfNoneMatch: 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // Location: to.Ptr("westus"), - // 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/nsgExistingNic"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // PatchSettings: &armcompute.PatchSettings{ - // EnableHotpatching: to.Ptr(true), - // PatchMode: to.Ptr(armcompute.WindowsVMGuestPatchModeAutomaticByPlatform), - // }, - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // 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), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }, - // VMID: to.Ptr("a149cd25-409f-41af-8088-275f5486bc93"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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), - }, - }, - }, - }, - }, &armcompute.VirtualMachinesClientBeginCreateOrUpdateOptions{IfMatch: nil, - IfNoneMatch: 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // Location: to.Ptr("westus"), - // 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/nsgExistingNic"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // PatchSettings: &armcompute.PatchSettings{ - // PatchMode: to.Ptr(armcompute.WindowsVMGuestPatchModeManual), - // }, - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // 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), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }, - // VMID: to.Ptr("a149cd25-409f-41af-8088-275f5486bc93"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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), - }, - }, - }, - }, - }, &armcompute.VirtualMachinesClientBeginCreateOrUpdateOptions{IfMatch: nil, - IfNoneMatch: 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // Location: to.Ptr("westus"), - // 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/nsgExistingNic"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // PatchSettings: &armcompute.PatchSettings{ - // AssessmentMode: to.Ptr(armcompute.WindowsPatchAssessmentModeAutomaticByPlatform), - // PatchMode: to.Ptr(armcompute.WindowsVMGuestPatchModeAutomaticByPlatform), - // }, - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // 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), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }, - // VMID: to.Ptr("a149cd25-409f-41af-8088-275f5486bc93"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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"), - }, - }, - }, - }, - }, &armcompute.VirtualMachinesClientBeginCreateOrUpdateOptions{IfMatch: nil, - IfNoneMatch: 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // 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{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // OSDisk: &armcompute.OSDisk{ - // Name: to.Ptr("myVMosdisk"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // Image: &armcompute.VirtualHardDisk{ - // URI: to.Ptr("https://{existing-storage-account-name}.blob.core.windows.net/system/Microsoft.Compute/Images/vhds/{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/vhds/myDisk.vhd"), - // }, - // }, - // }, - // VMID: to.Ptr("926cd555-a07c-4ff5-b214-4aa4dd09d79b"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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"), - }, - }, - }, - }, - }, &armcompute.VirtualMachinesClientBeginCreateOrUpdateOptions{IfMatch: nil, - IfNoneMatch: 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // 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/nsgExistingNic"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // { - // Name: to.Ptr("dataDisk0"), - // Caching: to.Ptr(armcompute.CachingTypesNone), - // 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/vhds/myDisk0.vhd"), - // }, - // }, - // { - // Name: to.Ptr("dataDisk1"), - // Caching: to.Ptr(armcompute.CachingTypesNone), - // 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/vhds/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), - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // Vhd: &armcompute.VirtualHardDisk{ - // URI: to.Ptr("http://{existing-storage-account-name}.blob.core.windows.net/vhds/myDisk.vhd"), - // }, - // }, - // }, - // VMID: to.Ptr("5230a749-2f68-4830-900b-702182d32e63"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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), - }, - }, - }, - }, - }, &armcompute.VirtualMachinesClientBeginCreateOrUpdateOptions{IfMatch: nil, - IfNoneMatch: 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // 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{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // LinuxConfiguration: &armcompute.LinuxConfiguration{ - // DisablePasswordAuthentication: to.Ptr(false), - // }, - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // ImageReference: &armcompute.ImageReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/images/nsgcustom"), - // }, - // OSDisk: &armcompute.OSDisk{ - // Name: to.Ptr("myVMosdisk"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // DiskSizeGB: to.Ptr[int32](30), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesLinux), - // }, - // }, - // VMID: to.Ptr("71aa3d5a-d73d-4970-9182-8580433b2865"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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), - }, - }, - }, - }, - }, &armcompute.VirtualMachinesClientBeginCreateOrUpdateOptions{IfMatch: nil, - IfNoneMatch: 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // 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{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // LinuxConfiguration: &armcompute.LinuxConfiguration{ - // DisablePasswordAuthentication: to.Ptr(false), - // }, - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // 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), - // DiskSizeGB: to.Ptr[int32](30), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesLinux), - // }, - // }, - // VMID: to.Ptr("71aa3d5a-d73d-4970-9182-8580433b2865"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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), - }, - }, - }, - }, - }, &armcompute.VirtualMachinesClientBeginCreateOrUpdateOptions{IfMatch: nil, - IfNoneMatch: 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // 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), - // }, - // }}, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // 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), - // DiskSizeGB: to.Ptr[int32](30), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesLinux), - // }, - // }, - // VMID: to.Ptr("71aa3d5a-d73d-4970-9182-8580433b2865"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineExamples/VirtualMachine_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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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}"), - }, - }, - }, &armcompute.VirtualMachinesClientBeginCreateOrUpdateOptions{IfMatch: nil, - IfNoneMatch: 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // 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{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // PlatformFaultDomain: to.Ptr[int32](1), - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // 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), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }, - // VirtualMachineScaleSet: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/myExistingFlexVmss"), - // }, - // VMID: to.Ptr("7cce54f2-ecd3-4ddd-a8d9-50984faa3918"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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), - }, - }, - }, - }, - }, &armcompute.VirtualMachinesClientBeginCreateOrUpdateOptions{IfMatch: nil, - IfNoneMatch: 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineProperties{ - // AvailabilitySet: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/availabilitySets/NSGEXISTINGAS"), - // }, - // 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{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // 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), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }, - // VMID: to.Ptr("b7a098cc-b0b8-46e8-a205-62f301a62a8f"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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), - }, - }, - }, - }, - }, &armcompute.VirtualMachinesClientBeginCreateOrUpdateOptions{IfMatch: nil, - IfNoneMatch: 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // 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"), - // 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"), - // }, - // { - // 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/nsgExistingNic"), - // 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"), - // }}, - // }, - // }, - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // 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.StorageAccountTypesStandardLRS), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesLinux), - // }, - // }, - // VMID: to.Ptr("e0de9b84-a506-4b95-9623-00a425d05c90"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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), - }, - }, - }, - }, - }, &armcompute.VirtualMachinesClientBeginCreateOrUpdateOptions{IfMatch: nil, - IfNoneMatch: 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // 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{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // LinuxConfiguration: &armcompute.LinuxConfiguration{ - // DisablePasswordAuthentication: to.Ptr(false), - // }, - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // 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/nsgcustom"), - // }, - // OSDisk: &armcompute.OSDisk{ - // Name: to.Ptr("myVMosdisk"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // DiskSizeGB: to.Ptr[int32](30), - // 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), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesLinux), - // }, - // }, - // VMID: to.Ptr("71aa3d5a-d73d-4970-9182-8580433b2865"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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), - }, - }, - }, - }, - }, &armcompute.VirtualMachinesClientBeginCreateOrUpdateOptions{IfMatch: nil, - IfNoneMatch: 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // Location: to.Ptr("westus"), - // Plan: &armcompute.Plan{ - // Name: to.Ptr("standard-data-science-vm"), - // Product: to.Ptr("standard-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/nsgExistingNic"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // SecurityProfile: &armcompute.SecurityProfile{ - // EncryptionAtHost: to.Ptr(true), - // }, - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("standard-data-science-vm"), - // Publisher: to.Ptr("microsoft-ads"), - // SKU: to.Ptr("standard-data-science-vm"), - // 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), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }, - // VMID: to.Ptr("5c0d55a7-c407-4ed6-bf7d-ddb810267c85"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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{ - OSImageNotificationProfile: &armcompute.OSImageNotificationProfile{ - Enable: to.Ptr(true), - NotBeforeTimeout: to.Ptr("PT15M"), - }, - 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), - }, - }, - }, - }, - }, &armcompute.VirtualMachinesClientBeginCreateOrUpdateOptions{IfMatch: nil, - IfNoneMatch: 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineProperties{ - // DiagnosticsProfile: &armcompute.DiagnosticsProfile{ - // BootDiagnostics: &armcompute.BootDiagnostics{ - // Enabled: to.Ptr(true), - // StorageURI: to.Ptr("http://nsgdiagnostic.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/nsgExistingNic"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // ScheduledEventsProfile: &armcompute.ScheduledEventsProfile{ - // OSImageNotificationProfile: &armcompute.OSImageNotificationProfile{ - // Enable: to.Ptr(true), - // NotBeforeTimeout: to.Ptr("PT15M"), - // }, - // TerminateNotificationProfile: &armcompute.TerminateNotificationProfile{ - // Enable: to.Ptr(true), - // NotBeforeTimeout: to.Ptr("PT10M"), - // }, - // }, - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // 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), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }, - // VMID: to.Ptr("676420ba-7a24-4bfe-80bd-9c841ee184fa"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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), - }, - }, - }, - }, - }, &armcompute.VirtualMachinesClientBeginCreateOrUpdateOptions{IfMatch: nil, - IfNoneMatch: 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // Location: to.Ptr("westus"), - // Plan: &armcompute.Plan{ - // Name: to.Ptr("standard-data-science-vm"), - // Product: to.Ptr("standard-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/nsgExistingNic"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("standard-data-science-vm"), - // Publisher: to.Ptr("microsoft-ads"), - // SKU: to.Ptr("standard-data-science-vm"), - // 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), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }, - // VMID: to.Ptr("5c0d55a7-c407-4ed6-bf7d-ddb810267c85"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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), - }, - }, - }, - }, - }, &armcompute.VirtualMachinesClientBeginCreateOrUpdateOptions{IfMatch: nil, - IfNoneMatch: 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineProperties{ - // DiagnosticsProfile: &armcompute.DiagnosticsProfile{ - // BootDiagnostics: &armcompute.BootDiagnostics{ - // Enabled: to.Ptr(true), - // StorageURI: to.Ptr("http://nsgdiagnostic.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/nsgExistingNic"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // 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), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }, - // VMID: to.Ptr("676420ba-7a24-4bfe-80bd-9c841ee184fa"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineExamples/VirtualMachine_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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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), - }, - }, - }, - }, - }, &armcompute.VirtualMachinesClientBeginCreateOrUpdateOptions{IfMatch: nil, - IfNoneMatch: 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineProperties{ - // DiagnosticsProfile: &armcompute.DiagnosticsProfile{ - // BootDiagnostics: &armcompute.BootDiagnostics{ - // Enabled: to.Ptr(true), - // StorageURI: to.Ptr("http://nsgdiagnostic.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/nsgExistingNic"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // 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), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }, - // VMID: to.Ptr("676420ba-7a24-4bfe-80bd-9c841ee184fa"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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), - }, - }, - }, - }, - }, &armcompute.VirtualMachinesClientBeginCreateOrUpdateOptions{IfMatch: nil, - IfNoneMatch: 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // 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/nsgExistingNic"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // { - // Caching: to.Ptr(armcompute.CachingTypesNone), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesEmpty), - // DiskSizeGB: to.Ptr[int32](1023), - // Lun: to.Ptr[int32](0), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // }, - // { - // Caching: to.Ptr(armcompute.CachingTypesNone), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesEmpty), - // DiskSizeGB: to.Ptr[int32](1023), - // Lun: to.Ptr[int32](1), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // }}, - // 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), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }, - // VMID: to.Ptr("3906fef9-a1e5-4b83-a8a8-540858b41df0"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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), - }, - }, - }, - }, - }, &armcompute.VirtualMachinesClientBeginCreateOrUpdateOptions{IfMatch: nil, - IfNoneMatch: 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // Location: to.Ptr("westus"), - // Plan: &armcompute.Plan{ - // Name: to.Ptr("standard-data-science-vm"), - // Product: to.Ptr("standard-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/nsgExistingNic"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("standard-data-science-vm"), - // Publisher: to.Ptr("microsoft-ads"), - // SKU: to.Ptr("standard-data-science-vm"), - // 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), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }, - // VMID: to.Ptr("5c0d55a7-c407-4ed6-bf7d-ddb810267c85"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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), - }, - }, - }, - }, - }, &armcompute.VirtualMachinesClientBeginCreateOrUpdateOptions{IfMatch: nil, - IfNoneMatch: 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // Location: to.Ptr("westus"), - // Plan: &armcompute.Plan{ - // Name: to.Ptr("standard-data-science-vm"), - // Product: to.Ptr("standard-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/nsgExistingNic"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("standard-data-science-vm"), - // Publisher: to.Ptr("microsoft-ads"), - // SKU: to.Ptr("standard-data-science-vm"), - // 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), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }, - // VMID: to.Ptr("5c0d55a7-c407-4ed6-bf7d-ddb810267c85"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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), - }, - }, - }, - }, - }, &armcompute.VirtualMachinesClientBeginCreateOrUpdateOptions{IfMatch: nil, - IfNoneMatch: 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // Location: to.Ptr("westus"), - // Plan: &armcompute.Plan{ - // Name: to.Ptr("standard-data-science-vm"), - // Product: to.Ptr("standard-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/nsgExistingNic"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("standard-data-science-vm"), - // Publisher: to.Ptr("microsoft-ads"), - // SKU: to.Ptr("standard-data-science-vm"), - // 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), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }, - // VMID: to.Ptr("5c0d55a7-c407-4ed6-bf7d-ddb810267c85"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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), - }, - }, - }, - }, - }, &armcompute.VirtualMachinesClientBeginCreateOrUpdateOptions{IfMatch: nil, - IfNoneMatch: 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // 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/nsgExistingNic"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // 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), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }, - // VMID: to.Ptr("676420ba-7a24-4bfe-80bd-9c841ee184fa"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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), - }, - }, - }, - }, - }, &armcompute.VirtualMachinesClientBeginCreateOrUpdateOptions{IfMatch: nil, - IfNoneMatch: 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // 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{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // 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), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }, - // VMID: to.Ptr("b248db33-62ba-4d2d-b791-811e075ee0f5"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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), - }, - }, - }, - }, - }, &armcompute.VirtualMachinesClientBeginCreateOrUpdateOptions{IfMatch: nil, - IfNoneMatch: 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // Location: to.Ptr("westus"), - // 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/nsgExistingNic"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // 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), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }, - // VMID: to.Ptr("a149cd25-409f-41af-8088-275f5486bc93"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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), - }, - }, - }, - }, - }, &armcompute.VirtualMachinesClientBeginCreateOrUpdateOptions{IfMatch: nil, - IfNoneMatch: 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // 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{ - // 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"), - // }}, - // }, - // }, - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // 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.StorageAccountTypesStandardLRS), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesLinux), - // }, - // }, - // VMID: to.Ptr("e0de9b84-a506-4b95-9623-00a425d05c90"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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), - }, - }, - }, - }, - }, &armcompute.VirtualMachinesClientBeginCreateOrUpdateOptions{IfMatch: nil, - IfNoneMatch: 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // Location: to.Ptr("westus"), - // Plan: &armcompute.Plan{ - // Name: to.Ptr("standard-data-science-vm"), - // Product: to.Ptr("standard-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/nsgExistingNic"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("standard-data-science-vm"), - // Publisher: to.Ptr("microsoft-ads"), - // SKU: to.Ptr("standard-data-science-vm"), - // 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), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }, - // VMID: to.Ptr("5c0d55a7-c407-4ed6-bf7d-ddb810267c85"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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), - }, - }, - }, - }, - }, &armcompute.VirtualMachinesClientBeginUpdateOptions{IfMatch: nil, - IfNoneMatch: 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // 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/nsgExistingNic"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // { - // Caching: to.Ptr(armcompute.CachingTypesNone), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesEmpty), - // DiskSizeGB: to.Ptr[int32](1023), - // Lun: to.Ptr[int32](0), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // ToBeDetached: to.Ptr(true), - // }, - // { - // Caching: to.Ptr(armcompute.CachingTypesNone), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesEmpty), - // DiskSizeGB: to.Ptr[int32](1023), - // Lun: to.Ptr[int32](1), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // 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), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }, - // VMID: to.Ptr("3906fef9-a1e5-4b83-a8a8-540858b41df0"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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), - }, - }, - }, - }, - }, &armcompute.VirtualMachinesClientBeginUpdateOptions{IfMatch: nil, - IfNoneMatch: 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // 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/nsgExistingNic"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // { - // Caching: to.Ptr(armcompute.CachingTypesNone), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesEmpty), - // DetachOption: to.Ptr(armcompute.DiskDetachOptionTypesForceDetach), - // DiskSizeGB: to.Ptr[int32](1023), - // Lun: to.Ptr[int32](0), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // ToBeDetached: to.Ptr(true), - // }, - // { - // Caching: to.Ptr(armcompute.CachingTypesNone), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesEmpty), - // DiskSizeGB: to.Ptr[int32](1023), - // Lun: to.Ptr[int32](1), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // 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), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }, - // VMID: to.Ptr("3906fef9-a1e5-4b83-a8a8-540858b41df0"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachinesClient().Get(ctx, "myResourceGroup", "myVM", &armcompute.VirtualMachinesClientGetOptions{Expand: to.Ptr(armcompute.InstanceViewTypesUserData)}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "myTag1": to.Ptr("tagValue1"), - // }, - // Etag: to.Ptr("\"1\""), - // ManagedBy: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{MyVmss}"), - // Properties: &armcompute.VirtualMachineProperties{ - // ApplicationProfile: &armcompute.ApplicationProfile{ - // GalleryApplications: []*armcompute.VMGalleryApplication{ - // { - // ConfigurationReference: to.Ptr("https://mystorageaccount.blob.core.windows.net/configurations/settings.config"), - // 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"), - // }, - // { - // PackageReferenceID: to.Ptr("/subscriptions/32c17a9e-aa7b-4ba5-a45b-e324116b6fdg/resourceGroups/myresourceGroupName3/providers/Microsoft.Compute/galleries/myGallery2/applications/MyApplication2/versions/1.1"), - // }}, - // }, - // AvailabilitySet: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/availabilitySets/my-AvailabilitySet"), - // }, - // DiagnosticsProfile: &armcompute.DiagnosticsProfile{ - // BootDiagnostics: &armcompute.BootDiagnostics{ - // Enabled: to.Ptr(true), - // StorageURI: to.Ptr("http://{myStorageAccount}.blob.core.windows.net"), - // }, - // }, - // ExtensionsTimeBudget: to.Ptr("PT50M"), - // HardwareProfile: &armcompute.HardwareProfile{ - // VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardDS3V2), - // }, - // NetworkProfile: &armcompute.NetworkProfile{ - // NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{myNIC}"), - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("admin"), - // ComputerName: to.Ptr("myVM"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(false), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // ProximityPlacementGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/proximityPlacementGroups/my-ppg01"), - // }, - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // { - // Name: to.Ptr("myDataDisk0"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesEmpty), - // DiskSizeGB: to.Ptr[int32](30), - // Lun: to.Ptr[int32](0), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDataDisk0"), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesPremiumLRS), - // }, - // }, - // { - // Name: to.Ptr("myDataDisk1"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesAttach), - // DiskSizeGB: to.Ptr[int32](100), - // Lun: to.Ptr[int32](1), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDataDisk1"), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesPremiumLRS), - // }, - // }}, - // 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("myOsDisk"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // DiskSizeGB: to.Ptr[int32](30), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myOsDisk"), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesPremiumLRS), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }, - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-27T01:02:38.313Z"); return t}()), - // UserData: to.Ptr("RXhhbXBsZSBVc2VyRGF0YQ=="), - // VMID: to.Ptr("0f47b100-583c-48e3-a4c0-aefc2c9bbcc1"), - // }, - // Resources: []*armcompute.VirtualMachineExtension{ - // { - // Name: to.Ptr("CustomScriptExtension-DSC"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines/extensions"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM/extensions/CustomScriptExtension-DSC"), - // Location: to.Ptr("west us"), - // Tags: map[string]*string{ - // "displayName": to.Ptr("CustomScriptExtension-DSC"), - // }, - // Properties: &armcompute.VirtualMachineExtensionProperties{ - // Type: to.Ptr("CustomScriptExtension"), - // AutoUpgradeMinorVersion: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // Publisher: to.Ptr("Microsoft.Compute"), - // Settings: map[string]any{ - // }, - // TypeHandlerVersion: to.Ptr("1.9"), - // }, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachinesClient().Get(ctx, "myResourceGroup", "myVM", &armcompute.VirtualMachinesClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "myTag1": to.Ptr("tagValue1"), - // }, - // Properties: &armcompute.VirtualMachineProperties{ - // HardwareProfile: &armcompute.HardwareProfile{ - // VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD2SV3), - // }, - // HostGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/hostGroups/myHostGroup"), - // }, - // NetworkProfile: &armcompute.NetworkProfile{ - // NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{myNIC}"), - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("admin"), - // ComputerName: to.Ptr("myVM"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(false), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // 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("myOsDisk"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // DiskSizeGB: to.Ptr[int32](30), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myOsDisk"), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesPremiumLRS), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }, - // VMID: to.Ptr("0f47b100-583c-48e3-a4c0-aefc2c9bbcc1"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachinesClient().Get(ctx, "myResourceGroup", "myVM", &armcompute.VirtualMachinesClientGetOptions{Expand: to.Ptr(armcompute.InstanceViewTypesUserData)}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "myTag1": to.Ptr("tagValue1"), - // }, - // Properties: &armcompute.VirtualMachineProperties{ - // ApplicationProfile: &armcompute.ApplicationProfile{ - // GalleryApplications: []*armcompute.VMGalleryApplication{ - // { - // ConfigurationReference: to.Ptr("https://mystorageaccount.blob.core.windows.net/configurations/settings.config"), - // 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"), - // }, - // { - // PackageReferenceID: to.Ptr("/subscriptions/32c17a9e-aa7b-4ba5-a45b-e324116b6fdg/resourceGroups/myresourceGroupName3/providers/Microsoft.Compute/galleries/myGallery2/applications/MyApplication2/versions/1.1"), - // }}, - // }, - // AvailabilitySet: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/availabilitySets/my-AvailabilitySet"), - // }, - // DiagnosticsProfile: &armcompute.DiagnosticsProfile{ - // BootDiagnostics: &armcompute.BootDiagnostics{ - // Enabled: to.Ptr(true), - // StorageURI: to.Ptr("http://{myStorageAccount}.blob.core.windows.net"), - // }, - // }, - // ExtensionsTimeBudget: to.Ptr("PT50M"), - // HardwareProfile: &armcompute.HardwareProfile{ - // VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardDS3V2), - // 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/{myNIC}"), - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("admin"), - // ComputerName: to.Ptr("myVM"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(false), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // { - // Name: to.Ptr("myDataDisk0"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesEmpty), - // DiskSizeGB: to.Ptr[int32](30), - // Lun: to.Ptr[int32](0), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDataDisk0"), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesPremiumLRS), - // }, - // }, - // { - // Name: to.Ptr("myDataDisk1"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesAttach), - // DiskSizeGB: to.Ptr[int32](100), - // Lun: to.Ptr[int32](1), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDataDisk1"), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesPremiumLRS), - // }, - // }}, - // 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("myOsDisk"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // DiskSizeGB: to.Ptr[int32](30), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myOsDisk"), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesPremiumLRS), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }, - // UserData: to.Ptr("RXhhbXBsZSBVc2VyRGF0YQ=="), - // VMID: to.Ptr("0f47b100-583c-48e3-a4c0-aefc2c9bbcc1"), - // }, - // Resources: []*armcompute.VirtualMachineExtension{ - // { - // Name: to.Ptr("CustomScriptExtension-DSC"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines/extensions"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM/extensions/CustomScriptExtension-DSC"), - // Location: to.Ptr("west us"), - // Tags: map[string]*string{ - // "displayName": to.Ptr("CustomScriptExtension-DSC"), - // }, - // Properties: &armcompute.VirtualMachineExtensionProperties{ - // Type: to.Ptr("CustomScriptExtension"), - // AutoUpgradeMinorVersion: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // Publisher: to.Ptr("Microsoft.Compute"), - // Settings: map[string]any{ - // }, - // TypeHandlerVersion: to.Ptr("1.9"), - // }, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachinesClient().Get(ctx, "myResourceGroup", "myVM", &armcompute.VirtualMachinesClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "myTag1": to.Ptr("tagValue1"), - // }, - // Properties: &armcompute.VirtualMachineProperties{ - // ApplicationProfile: &armcompute.ApplicationProfile{ - // GalleryApplications: []*armcompute.VMGalleryApplication{ - // { - // ConfigurationReference: to.Ptr("https://mystorageaccount.blob.core.windows.net/configurations/settings.config"), - // 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"), - // }, - // { - // PackageReferenceID: to.Ptr("/subscriptions/32c17a9e-aa7b-4ba5-a45b-e324116b6fdg/resourceGroups/myresourceGroupName3/providers/Microsoft.Compute/galleries/myGallery2/applications/MyApplication2/versions/1.1"), - // }}, - // }, - // AvailabilitySet: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/availabilitySets/my-AvailabilitySet"), - // }, - // DiagnosticsProfile: &armcompute.DiagnosticsProfile{ - // BootDiagnostics: &armcompute.BootDiagnostics{ - // Enabled: to.Ptr(true), - // StorageURI: to.Ptr("http://{myStorageAccount}.blob.core.windows.net"), - // }, - // }, - // ExtensionsTimeBudget: to.Ptr("PT50M"), - // HardwareProfile: &armcompute.HardwareProfile{ - // VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardDS3V2), - // 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/{myNIC}"), - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("admin"), - // ComputerName: to.Ptr("myVM"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(false), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // { - // Name: to.Ptr("myDataDisk0"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesEmpty), - // DiskSizeGB: to.Ptr[int32](30), - // Lun: to.Ptr[int32](0), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDataDisk0"), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesPremiumLRS), - // }, - // }, - // { - // Name: to.Ptr("myDataDisk1"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesAttach), - // DiskSizeGB: to.Ptr[int32](100), - // Lun: to.Ptr[int32](1), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDataDisk1"), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesPremiumLRS), - // }, - // }}, - // 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("myOsDisk"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // DiskSizeGB: to.Ptr[int32](30), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myOsDisk"), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesPremiumLRS), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }, - // UserData: to.Ptr("RXhhbXBsZSBVc2VyRGF0YQ=="), - // VMID: to.Ptr("0f47b100-583c-48e3-a4c0-aefc2c9bbcc1"), - // }, - // Resources: []*armcompute.VirtualMachineExtension{ - // { - // Name: to.Ptr("CustomScriptExtension-DSC"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines/extensions"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM/extensions/CustomScriptExtension-DSC"), - // Location: to.Ptr("west us"), - // Tags: map[string]*string{ - // "displayName": to.Ptr("CustomScriptExtension-DSC"), - // }, - // Properties: &armcompute.VirtualMachineExtensionProperties{ - // Type: to.Ptr("CustomScriptExtension"), - // AutoUpgradeMinorVersion: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // Publisher: to.Ptr("Microsoft.Compute"), - // Settings: map[string]any{ - // }, - // TypeHandlerVersion: to.Ptr("1.9"), - // }, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachinesClient().InstanceView(ctx, "myResourceGroup", "myVM", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineInstanceView = armcompute.VirtualMachineInstanceView{ - // BootDiagnostics: &armcompute.BootDiagnosticsInstanceView{ - // ConsoleScreenshotBlobURI: to.Ptr("https://{myStorageAccount}.blob.core.windows.net/bootdiagnostics-myOsDisk/myOsDisk.screenshot.bmp"), - // SerialConsoleLogBlobURI: to.Ptr("https://{myStorageAccount}.blob.core.windows.net/bootdiagnostics-myOsDisk/myOsDisk.serialconsole.log"), - // }, - // ComputerName: to.Ptr("myVM"), - // Disks: []*armcompute.DiskInstanceView{ - // { - // Name: to.Ptr("myOsDisk"), - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("ProvisioningState/succeeded"), - // DisplayStatus: to.Ptr("Provisioning succeeded"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-14T21:29:47.477Z"); return t}()), - // }}, - // }, - // { - // Name: to.Ptr("myDataDisk0"), - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("ProvisioningState/succeeded"), - // DisplayStatus: to.Ptr("Provisioning succeeded"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-14T21:29:47.461Z"); return t}()), - // }}, - // }}, - // HyperVGeneration: to.Ptr(armcompute.HyperVGenerationTypeV1), - // IsVMInStandbyPool: to.Ptr(false), - // OSName: to.Ptr("Windows Server 2016 Datacenter"), - // OSVersion: to.Ptr("Microsoft Windows NT 10.0.14393.0"), - // PatchStatus: &armcompute.VirtualMachinePatchStatus{ - // AvailablePatchSummary: &armcompute.AvailablePatchSummary{ - // AssessmentActivityID: to.Ptr("68f8b292-dfc2-4646-9781-33cc88631968"), - // CriticalAndSecurityPatchCount: to.Ptr[int32](1), - // LastModifiedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-24T21:02:04.255Z"); return t}()), - // OtherPatchCount: to.Ptr[int32](2), - // RebootPending: to.Ptr(true), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-24T21:02:04.255Z"); return t}()), - // Status: to.Ptr(armcompute.PatchOperationStatusSucceeded), - // }, - // ConfigurationStatuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("PatchModeConfigurationState/Ready"), - // DisplayStatus: to.Ptr("Status_PatchModeConfigurationState_Ready"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-24T21:02:04.255Z"); return t}()), - // }, - // { - // Code: to.Ptr("AssessmentModeConfigurationState/Pending"), - // DisplayStatus: to.Ptr("Status_AssessmentModeConfigurationState_Pending"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-24T21:02:04.255Z"); return t}()), - // }}, - // LastPatchInstallationSummary: &armcompute.LastPatchInstallationSummary{ - // ExcludedPatchCount: to.Ptr[int32](1), - // FailedPatchCount: to.Ptr[int32](1), - // InstallationActivityID: to.Ptr("68f8b292-dfc2-4646-9981-33cc88631968"), - // InstalledPatchCount: to.Ptr[int32](1), - // LastModifiedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-24T21:02:04.255Z"); return t}()), - // MaintenanceWindowExceeded: to.Ptr(false), - // NotSelectedPatchCount: to.Ptr[int32](1), - // PendingPatchCount: to.Ptr[int32](1), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-24T21:02:04.255Z"); return t}()), - // Status: to.Ptr(armcompute.PatchOperationStatusSucceeded), - // }, - // }, - // PlatformFaultDomain: to.Ptr[int32](1), - // PlatformUpdateDomain: to.Ptr[int32](1), - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("ProvisioningState/succeeded"), - // DisplayStatus: to.Ptr("Provisioning succeeded"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-14T21:30:12.805Z"); return t}()), - // }, - // { - // Code: to.Ptr("PowerState/running"), - // DisplayStatus: to.Ptr("VM running"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // }}, - // VMAgent: &armcompute.VirtualMachineAgentInstanceView{ - // ExtensionHandlers: []*armcompute.VirtualMachineExtensionHandlerInstanceView{ - // { - // Type: to.Ptr("Microsoft.Azure.Security.IaaSAntimalware"), - // Status: &armcompute.InstanceViewStatus{ - // Code: to.Ptr("ProvisioningState/succeeded"), - // DisplayStatus: to.Ptr("Ready"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // }, - // TypeHandlerVersion: to.Ptr("1.5.5.9"), - // }}, - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("ProvisioningState/succeeded"), - // DisplayStatus: to.Ptr("Ready"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("GuestAgent is running and accepting new configurations."), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-14T23:11:22.000Z"); return t}()), - // }}, - // VMAgentVersion: to.Ptr("2.7.41491.949"), - // }, - // Extensions: []*armcompute.VirtualMachineExtensionInstanceView{ - // { - // Name: to.Ptr("IaaSAntiMalware-ext0"), - // Type: to.Ptr("Microsoft.Azure.Security.IaaSAntimalware"), - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("ProvisioningState/succeeded"), - // DisplayStatus: to.Ptr("Provisioning succeeded"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("Microsoft Antimalware enabled"), - // }}, - // TypeHandlerVersion: to.Ptr("1.5.5.9"), - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachinesClient().InstanceView(ctx, "myResourceGroup", "myVM", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineInstanceView = armcompute.VirtualMachineInstanceView{ - // AssignedHost: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/hostGroups/myHostGroup/hosts/myHost"), - // ComputerName: to.Ptr("myVM"), - // Disks: []*armcompute.DiskInstanceView{ - // { - // Name: to.Ptr("myOsDisk"), - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("ProvisioningState/succeeded"), - // DisplayStatus: to.Ptr("Provisioning succeeded"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-09-01T21:29:47.477Z"); return t}()), - // }}, - // }}, - // HyperVGeneration: to.Ptr(armcompute.HyperVGenerationTypeV1), - // OSName: to.Ptr("Windows Server 2016 Datacenter"), - // OSVersion: to.Ptr("Microsoft Windows NT 10.0.14393.0"), - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("ProvisioningState/succeeded"), - // DisplayStatus: to.Ptr("Provisioning succeeded"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-09-01T21:30:12.805Z"); return t}()), - // }, - // { - // Code: to.Ptr("PowerState/running"), - // DisplayStatus: to.Ptr("VM running"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // }}, - // VMAgent: &armcompute.VirtualMachineAgentInstanceView{ - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("ProvisioningState/succeeded"), - // DisplayStatus: to.Ptr("Ready"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("GuestAgent is running and accepting new configurations."), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-09-01T23:11:22.000Z"); return t}()), - // }}, - // VMAgentVersion: to.Ptr("2.7.41491.949"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineExamples/VirtualMachine_ConvertToManagedDisks_MaximumSet_Gen.json -func ExampleVirtualMachinesClient_BeginConvertToManagedDisks_virtualMachineConvertToManagedDisksMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineExamples/VirtualMachine_ConvertToManagedDisks_MinimumSet_Gen.json -func ExampleVirtualMachinesClient_BeginConvertToManagedDisks_virtualMachineConvertToManagedDisksMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineExamples/VirtualMachine_Deallocate_MaximumSet_Gen.json -func ExampleVirtualMachinesClient_BeginDeallocate_virtualMachineDeallocateMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineExamples/VirtualMachine_Deallocate_MinimumSet_Gen.json -func ExampleVirtualMachinesClient_BeginDeallocate_virtualMachineDeallocateMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewVirtualMachinesClient().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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineExamples/VirtualMachine_List_MaximumSet_Gen.json -func ExampleVirtualMachinesClient_NewListPager_virtualMachineListMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualMachinesClient().NewListPager("rgcompute", &armcompute.VirtualMachinesClientListOptions{Filter: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"), - Expand: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.VirtualMachineListResult = armcompute.VirtualMachineListResult{ - // Value: []*armcompute.VirtualMachine{ - // { - // Name: to.Ptr("{virtualMachineName}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{virtualMachineName}"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // ExtendedLocation: &armcompute.ExtendedLocation{ - // Name: to.Ptr("aaaa"), - // Type: to.Ptr(armcompute.ExtendedLocationTypesEdgeZone), - // }, - // Identity: &armcompute.VirtualMachineIdentity{ - // Type: to.Ptr(armcompute.ResourceIdentityTypeSystemAssigned), - // PrincipalID: to.Ptr("aaaaaaaaaaaaaaaa"), - // TenantID: to.Ptr("aaaaa"), - // UserAssignedIdentities: map[string]*armcompute.UserAssignedIdentitiesValue{ - // "key5688": &armcompute.UserAssignedIdentitiesValue{ - // ClientID: to.Ptr("aaaaaaaaaaa"), - // PrincipalID: to.Ptr("aaaaaaaaaaaaaaa"), - // }, - // }, - // }, - // Plan: &armcompute.Plan{ - // Name: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // Product: to.Ptr("aaaaaaaaaaaaaaaaaaaaaa"), - // PromotionCode: to.Ptr("aaaaaaaaaaaaaa"), - // Publisher: to.Ptr("aaaaaaaaaaaaaaaaa"), - // }, - // Properties: &armcompute.VirtualMachineProperties{ - // AdditionalCapabilities: &armcompute.AdditionalCapabilities{ - // HibernationEnabled: to.Ptr(true), - // UltraSSDEnabled: to.Ptr(true), - // }, - // ApplicationProfile: &armcompute.ApplicationProfile{ - // GalleryApplications: []*armcompute.VMGalleryApplication{ - // { - // ConfigurationReference: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // Order: to.Ptr[int32](4), - // PackageReferenceID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaa"), - // Tags: to.Ptr("aaaaa"), - // }}, - // }, - // AvailabilitySet: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // BillingProfile: &armcompute.BillingProfile{ - // MaxPrice: to.Ptr[float64](26), - // }, - // CapacityReservation: &armcompute.CapacityReservationProfile{ - // CapacityReservationGroup: &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("aaaaaaaaaaaaaaaaaaaaa"), - // }, - // }, - // EvictionPolicy: to.Ptr(armcompute.VirtualMachineEvictionPolicyTypesDeallocate), - // ExtensionsTimeBudget: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // HardwareProfile: &armcompute.HardwareProfile{ - // VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardA0), - // VMSizeProperties: &armcompute.VMSizeProperties{ - // VCPUsAvailable: to.Ptr[int32](7), - // VCPUsPerCore: to.Ptr[int32](14), - // }, - // }, - // Host: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // HostGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // LicenseType: to.Ptr("aaaaaaaaaaaaaaa"), - // NetworkProfile: &armcompute.NetworkProfile{ - // NetworkAPIVersion: to.Ptr(armcompute.NetworkAPIVersion("2022-05-01")), - // NetworkInterfaceConfigurations: []*armcompute.VirtualMachineNetworkInterfaceConfiguration{ - // { - // Name: to.Ptr("aaaaaaaa"), - // Properties: &armcompute.VirtualMachineNetworkInterfaceConfigurationProperties{ - // DeleteOption: to.Ptr(armcompute.DeleteOptionsDelete), - // DisableTCPStateTracking: to.Ptr(true), - // DNSSettings: &armcompute.VirtualMachineNetworkInterfaceDNSSettingsConfiguration{ - // DNSServers: []*string{ - // to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa")}, - // }, - // 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("aaaaaaaa"), - // 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("aaaaaaaaaaaaaaaaaa"), - // Properties: &armcompute.VirtualMachinePublicIPAddressConfigurationProperties{ - // DeleteOption: to.Ptr(armcompute.DeleteOptionsDelete), - // DNSSettings: &armcompute.VirtualMachinePublicIPAddressDNSSettingsConfiguration{ - // DomainNameLabel: to.Ptr("aaaaa"), - // }, - // IdleTimeoutInMinutes: to.Ptr[int32](23), - // IPTags: []*armcompute.VirtualMachineIPTag{ - // { - // IPTagType: to.Ptr("aaaaa"), - // Tag: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // }}, - // 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/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // DeleteOption: to.Ptr(armcompute.DeleteOptionsDelete), - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("Foo12"), - // AllowExtensionOperations: to.Ptr(true), - // ComputerName: to.Ptr("Test"), - // 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("aaaaaaaaaaaaaaaaaaaaaa"), - // KeyData: to.Ptr("aaa"), - // }}, - // }, - // }, - // RequireGuestProvisionSignal: to.Ptr(true), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // AdditionalUnattendContent: []*armcompute.AdditionalUnattendContent{ - // { - // ComponentName: to.Ptr("Microsoft-Windows-Shell-Setup"), - // Content: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaa"), - // 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("aaaaaaaaaaaaaaaaaaaaaa"), - // WinRM: &armcompute.WinRMConfiguration{ - // Listeners: []*armcompute.WinRMListener{ - // { - // CertificateURL: to.Ptr("aaaaaaaaaaaaaaaaaaaaa"), - // Protocol: to.Ptr(armcompute.ProtocolTypesHTTP), - // }}, - // }, - // }, - // }, - // PlatformFaultDomain: to.Ptr[int32](8), - // Priority: to.Ptr(armcompute.VirtualMachinePriorityTypesRegular), - // ProvisioningState: to.Ptr("Succeeded"), - // ProximityPlacementGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // ScheduledEventsProfile: &armcompute.ScheduledEventsProfile{ - // OSImageNotificationProfile: &armcompute.OSImageNotificationProfile{ - // Enable: to.Ptr(true), - // NotBeforeTimeout: to.Ptr("PT15M"), - // }, - // 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.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // ImageReference: &armcompute.ImageReference{ - // ID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // CommunityGalleryImageID: to.Ptr("aaaa"), - // ExactVersion: to.Ptr("aaaaaaaaaaaaa"), - // Offer: to.Ptr("WindowsServer"), - // Publisher: to.Ptr("MicrosoftWindowsServer"), - // SharedGalleryImageID: to.Ptr("aaaaaaaaaaaaaaa"), - // SKU: to.Ptr("2012-R2-Datacenter"), - // Version: to.Ptr("4.127.20170406"), - // }, - // OSDisk: &armcompute.OSDisk{ - // Name: to.Ptr("test"), - // 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("aaaaaaaaa"), - // 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("aaaaaaaaaaaaa"), - // 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/testingexcludedisk_OsDisk_1_74cdaedcea50483d9833c96adefa100f"), - // DiskEncryptionSet: &armcompute.DiskEncryptionSetParameters{ - // ID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // }, - // SecurityProfile: &armcompute.VMDiskSecurityProfile{ - // DiskEncryptionSet: &armcompute.DiskEncryptionSetParameters{ - // ID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // }, - // SecurityEncryptionType: to.Ptr(armcompute.SecurityEncryptionTypesVMGuestStateOnly), - // }, - // 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), - // }, - // }, - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-14T16:43:41.683Z"); return t}()), - // UserData: to.Ptr("aaa"), - // VirtualMachineScaleSet: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // VMID: to.Ptr("{vmId}"), - // }, - // Resources: []*armcompute.VirtualMachineExtension{ - // { - // Name: to.Ptr("aaaaaaaaaaaaa"), - // Type: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // ID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // Location: to.Ptr("aaaaaaaaaaaaaaaa"), - // Tags: map[string]*string{ - // "key9428": to.Ptr("aaaaaaa"), - // }, - // Properties: &armcompute.VirtualMachineExtensionProperties{ - // Type: to.Ptr("aaaaaaaa"), - // AutoUpgradeMinorVersion: to.Ptr(true), - // EnableAutomaticUpgrade: to.Ptr(true), - // ForceUpdateTag: to.Ptr("aaaaaaaaaaaaaaa"), - // InstanceView: &armcompute.VirtualMachineExtensionInstanceView{ - // Name: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Type: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("aaa"), - // DisplayStatus: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("aaaaaaaaaaaaaaaaaaa"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-14T16:43:41.657Z"); return t}()), - // }}, - // Substatuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("aaa"), - // DisplayStatus: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("aaaaaaaaaaaaaaaaaaa"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-14T16:43:41.657Z"); return t}()), - // }}, - // TypeHandlerVersion: to.Ptr("aaaaaa"), - // }, - // ProtectedSettings: map[string]any{ - // }, - // 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"), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // Publisher: to.Ptr("aaaaaaaaaaaaaaaa"), - // Settings: map[string]any{ - // }, - // SuppressFailures: to.Ptr(true), - // TypeHandlerVersion: to.Ptr("aaaaaaaaaaaa"), - // }, - // }}, - // Zones: []*string{ - // to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaa")}, - // }, - // { - // Name: to.Ptr("{virtualMachineName}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{virtualMachineName}"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // ExtendedLocation: &armcompute.ExtendedLocation{ - // Name: to.Ptr("aaaa"), - // Type: to.Ptr(armcompute.ExtendedLocationTypesEdgeZone), - // }, - // Identity: &armcompute.VirtualMachineIdentity{ - // Type: to.Ptr(armcompute.ResourceIdentityTypeSystemAssigned), - // PrincipalID: to.Ptr("aaaaaaaaaaaaaaaa"), - // TenantID: to.Ptr("aaaaa"), - // UserAssignedIdentities: map[string]*armcompute.UserAssignedIdentitiesValue{ - // "key5688": &armcompute.UserAssignedIdentitiesValue{ - // ClientID: to.Ptr("aaaaaaaaaaa"), - // PrincipalID: to.Ptr("aaaaaaaaaaaaaaa"), - // }, - // }, - // }, - // Plan: &armcompute.Plan{ - // Name: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // Product: to.Ptr("aaaaaaaaaaaaaaaaaaaaaa"), - // PromotionCode: to.Ptr("aaaaaaaaaaaaaa"), - // Publisher: to.Ptr("aaaaaaaaaaaaaaaaa"), - // }, - // Properties: &armcompute.VirtualMachineProperties{ - // AdditionalCapabilities: &armcompute.AdditionalCapabilities{ - // HibernationEnabled: to.Ptr(true), - // UltraSSDEnabled: to.Ptr(true), - // }, - // ApplicationProfile: &armcompute.ApplicationProfile{ - // GalleryApplications: []*armcompute.VMGalleryApplication{ - // { - // ConfigurationReference: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // Order: to.Ptr[int32](4), - // PackageReferenceID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaa"), - // Tags: to.Ptr("aaaaa"), - // }}, - // }, - // AvailabilitySet: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // BillingProfile: &armcompute.BillingProfile{ - // MaxPrice: to.Ptr[float64](26), - // }, - // CapacityReservation: &armcompute.CapacityReservationProfile{ - // CapacityReservationGroup: &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("aaaaaaaaaaaaaaaaaaaaa"), - // }, - // }, - // EvictionPolicy: to.Ptr(armcompute.VirtualMachineEvictionPolicyTypesDeallocate), - // ExtensionsTimeBudget: to.Ptr("aaaaaaaaaaaaaaaaaaaaaa"), - // HardwareProfile: &armcompute.HardwareProfile{ - // VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardA0), - // VMSizeProperties: &armcompute.VMSizeProperties{ - // VCPUsAvailable: to.Ptr[int32](7), - // VCPUsPerCore: to.Ptr[int32](14), - // }, - // }, - // Host: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // HostGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // InstanceView: &armcompute.VirtualMachineInstanceView{ - // AssignedHost: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // BootDiagnostics: &armcompute.BootDiagnosticsInstanceView{ - // ConsoleScreenshotBlobURI: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"), - // SerialConsoleLogBlobURI: to.Ptr("aaaaaaaaaaaaaaaaaaa"), - // Status: &armcompute.InstanceViewStatus{ - // Code: to.Ptr("aaa"), - // DisplayStatus: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("aaaaaaaaaaaaaaaaaaa"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-14T16:43:41.657Z"); return t}()), - // }, - // }, - // ComputerName: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // Disks: []*armcompute.DiskInstanceView{ - // { - // Name: to.Ptr("a"), - // EncryptionSettings: []*armcompute.DiskEncryptionSettings{ - // { - // DiskEncryptionKey: &armcompute.KeyVaultSecretReference{ - // SecretURL: to.Ptr("aaaaaaaaa"), - // 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("aaaaaaaaaaaaa"), - // SourceVault: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // }, - // }}, - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("aaa"), - // DisplayStatus: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("aaaaaaaaaaaaaaaaaaa"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-14T16:43:41.657Z"); return t}()), - // }}, - // }}, - // HyperVGeneration: to.Ptr(armcompute.HyperVGenerationTypeV1), - // IsVMInStandbyPool: to.Ptr(false), - // MaintenanceRedeployStatus: &armcompute.MaintenanceRedeployStatus{ - // IsCustomerInitiatedMaintenanceAllowed: to.Ptr(true), - // LastOperationMessage: to.Ptr("aa"), - // LastOperationResultCode: to.Ptr(armcompute.MaintenanceOperationResultCodeTypesNone), - // MaintenanceWindowEndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-14T16:43:41.682Z"); return t}()), - // MaintenanceWindowStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-14T16:43:41.682Z"); return t}()), - // PreMaintenanceWindowEndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-14T16:43:41.682Z"); return t}()), - // PreMaintenanceWindowStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-14T16:43:41.682Z"); return t}()), - // }, - // OSName: to.Ptr("aaaaaaaaaaa"), - // OSVersion: to.Ptr("aaaaaaaaaaaaaa"), - // PatchStatus: &armcompute.VirtualMachinePatchStatus{ - // AvailablePatchSummary: &armcompute.AvailablePatchSummary{ - // AssessmentActivityID: to.Ptr("aaaaaaaaaaaaaaaaaaa"), - // CriticalAndSecurityPatchCount: to.Ptr[int32](22), - // Error: &armcompute.APIError{ - // Code: to.Ptr("aaaaaa"), - // Innererror: &armcompute.InnerError{ - // Errordetail: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // Exceptiontype: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // }, - // Message: to.Ptr("aaa"), - // Target: to.Ptr("aaaaaaaaa"), - // Details: []*armcompute.APIErrorBase{ - // { - // Code: to.Ptr("aaaaaaaaaaaaaaaaaaaaa"), - // Message: to.Ptr("aaaaaaaaaaaaa"), - // Target: to.Ptr("aaaaaa"), - // }}, - // }, - // LastModifiedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-14T16:43:41.683Z"); return t}()), - // OtherPatchCount: to.Ptr[int32](25), - // RebootPending: to.Ptr(true), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-14T16:43:41.682Z"); return t}()), - // Status: to.Ptr(armcompute.PatchOperationStatusUnknown), - // }, - // ConfigurationStatuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("aaa"), - // DisplayStatus: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("aaaaaaaaaaaaaaaaaaa"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-14T16:43:41.657Z"); return t}()), - // }}, - // LastPatchInstallationSummary: &armcompute.LastPatchInstallationSummary{ - // Error: &armcompute.APIError{ - // Code: to.Ptr("aaaaaa"), - // Innererror: &armcompute.InnerError{ - // Errordetail: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // Exceptiontype: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // }, - // Message: to.Ptr("aaa"), - // Target: to.Ptr("aaaaaaaaa"), - // Details: []*armcompute.APIErrorBase{ - // { - // Code: to.Ptr("aaaaaaaaaaaaaaaaaaaaa"), - // Message: to.Ptr("aaaaaaaaaaaaa"), - // Target: to.Ptr("aaaaaa"), - // }}, - // }, - // ExcludedPatchCount: to.Ptr[int32](1), - // FailedPatchCount: to.Ptr[int32](30), - // InstallationActivityID: to.Ptr("aaaaaa"), - // InstalledPatchCount: to.Ptr[int32](28), - // LastModifiedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-14T16:43:41.683Z"); return t}()), - // MaintenanceWindowExceeded: to.Ptr(true), - // NotSelectedPatchCount: to.Ptr[int32](20), - // PendingPatchCount: to.Ptr[int32](2), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-14T16:43:41.683Z"); return t}()), - // Status: to.Ptr(armcompute.PatchOperationStatusUnknown), - // }, - // }, - // PlatformFaultDomain: to.Ptr[int32](29), - // PlatformUpdateDomain: to.Ptr[int32](1), - // RdpThumbPrint: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"), - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("aaa"), - // DisplayStatus: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("aaaaaaaaaaaaaaaaaaa"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-14T16:43:41.657Z"); return t}()), - // }}, - // VMAgent: &armcompute.VirtualMachineAgentInstanceView{ - // ExtensionHandlers: []*armcompute.VirtualMachineExtensionHandlerInstanceView{ - // { - // Type: to.Ptr("aaaaa"), - // Status: &armcompute.InstanceViewStatus{ - // Code: to.Ptr("aaa"), - // DisplayStatus: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("aaaaaaaaaaaaaaaaaaa"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-14T16:43:41.657Z"); return t}()), - // }, - // TypeHandlerVersion: to.Ptr("aaaaaaaaaaaaaaaaaaa"), - // }}, - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("aaa"), - // DisplayStatus: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("aaaaaaaaaaaaaaaaaaa"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-14T16:43:41.657Z"); return t}()), - // }}, - // VMAgentVersion: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // }, - // VMHealth: &armcompute.VirtualMachineHealthStatus{ - // Status: &armcompute.InstanceViewStatus{ - // Code: to.Ptr("aaa"), - // DisplayStatus: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("aaaaaaaaaaaaaaaaaaa"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-14T16:43:41.657Z"); return t}()), - // }, - // }, - // Extensions: []*armcompute.VirtualMachineExtensionInstanceView{ - // { - // Name: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Type: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("aaa"), - // DisplayStatus: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("aaaaaaaaaaaaaaaaaaa"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-14T16:43:41.657Z"); return t}()), - // }}, - // Substatuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("aaa"), - // DisplayStatus: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("aaaaaaaaaaaaaaaaaaa"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-14T16:43:41.657Z"); return t}()), - // }}, - // TypeHandlerVersion: to.Ptr("aaaaaa"), - // }}, - // }, - // LicenseType: to.Ptr("aaaaaaaaaaaaaa"), - // NetworkProfile: &armcompute.NetworkProfile{ - // NetworkAPIVersion: to.Ptr(armcompute.NetworkAPIVersion("2022-05-01")), - // NetworkInterfaceConfigurations: []*armcompute.VirtualMachineNetworkInterfaceConfiguration{ - // { - // Name: to.Ptr("aaaaaaaa"), - // Properties: &armcompute.VirtualMachineNetworkInterfaceConfigurationProperties{ - // DeleteOption: to.Ptr(armcompute.DeleteOptionsDelete), - // DisableTCPStateTracking: to.Ptr(true), - // DNSSettings: &armcompute.VirtualMachineNetworkInterfaceDNSSettingsConfiguration{ - // DNSServers: []*string{ - // to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa")}, - // }, - // 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("aaaaaaaa"), - // 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("aaaaaaaaaaaaaaaaaa"), - // Properties: &armcompute.VirtualMachinePublicIPAddressConfigurationProperties{ - // DeleteOption: to.Ptr(armcompute.DeleteOptionsDelete), - // DNSSettings: &armcompute.VirtualMachinePublicIPAddressDNSSettingsConfiguration{ - // DomainNameLabel: to.Ptr("aaaaa"), - // }, - // IdleTimeoutInMinutes: to.Ptr[int32](23), - // IPTags: []*armcompute.VirtualMachineIPTag{ - // { - // IPTagType: to.Ptr("aaaaa"), - // Tag: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // }}, - // 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/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // DeleteOption: to.Ptr(armcompute.DeleteOptionsDelete), - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("Foo12"), - // AllowExtensionOperations: to.Ptr(true), - // ComputerName: to.Ptr("Test"), - // CustomData: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"), - // 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("aaaaaaaaaaaaaaaaaaaaaa"), - // KeyData: to.Ptr("aaa"), - // }}, - // }, - // }, - // RequireGuestProvisionSignal: to.Ptr(true), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // AdditionalUnattendContent: []*armcompute.AdditionalUnattendContent{ - // { - // ComponentName: to.Ptr("Microsoft-Windows-Shell-Setup"), - // Content: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaa"), - // 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("aaaaaaaaaaaaaaaaaaaa"), - // WinRM: &armcompute.WinRMConfiguration{ - // Listeners: []*armcompute.WinRMListener{ - // { - // CertificateURL: to.Ptr("aaaaaaaaaaaaaaaaaaaaa"), - // Protocol: to.Ptr(armcompute.ProtocolTypesHTTP), - // }}, - // }, - // }, - // }, - // PlatformFaultDomain: to.Ptr[int32](11), - // Priority: to.Ptr(armcompute.VirtualMachinePriorityTypesRegular), - // ProvisioningState: to.Ptr("Succeeded"), - // ProximityPlacementGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // ScheduledEventsProfile: &armcompute.ScheduledEventsProfile{ - // OSImageNotificationProfile: &armcompute.OSImageNotificationProfile{ - // Enable: to.Ptr(true), - // NotBeforeTimeout: to.Ptr("PT15M"), - // }, - // 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.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // ImageReference: &armcompute.ImageReference{ - // ID: to.Ptr("aaaaaaaa"), - // CommunityGalleryImageID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // ExactVersion: to.Ptr("aa"), - // Offer: to.Ptr("WindowsServer"), - // Publisher: to.Ptr("MicrosoftWindowsServer"), - // SharedGalleryImageID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaa"), - // SKU: to.Ptr("2012-R2-Datacenter"), - // Version: to.Ptr("4.127.20170406"), - // }, - // OSDisk: &armcompute.OSDisk{ - // Name: to.Ptr("test"), - // 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("aaaaaaaaa"), - // 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("aaaaaaaaaaaaa"), - // 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/testingexcludedisk_OsDisk_1_74cdaedcea50483d9833c96adefa100f"), - // DiskEncryptionSet: &armcompute.DiskEncryptionSetParameters{ - // ID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // }, - // SecurityProfile: &armcompute.VMDiskSecurityProfile{ - // DiskEncryptionSet: &armcompute.DiskEncryptionSetParameters{ - // ID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // }, - // SecurityEncryptionType: to.Ptr(armcompute.SecurityEncryptionTypesVMGuestStateOnly), - // }, - // 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), - // }, - // }, - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-14T16:43:41.685Z"); return t}()), - // UserData: to.Ptr("aaaaaaaaaaaaaaaaaaa"), - // VirtualMachineScaleSet: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // VMID: to.Ptr("{vmId}"), - // }, - // Resources: []*armcompute.VirtualMachineExtension{ - // { - // Name: to.Ptr("aaaaaaaaaaaaa"), - // Type: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // ID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // Location: to.Ptr("aaaaaaaaaaaaaaaa"), - // Tags: map[string]*string{ - // "key9428": to.Ptr("aaaaaaa"), - // }, - // Properties: &armcompute.VirtualMachineExtensionProperties{ - // Type: to.Ptr("aaaaaaaa"), - // AutoUpgradeMinorVersion: to.Ptr(true), - // EnableAutomaticUpgrade: to.Ptr(true), - // ForceUpdateTag: to.Ptr("aaaaaaaaaaaaaaa"), - // InstanceView: &armcompute.VirtualMachineExtensionInstanceView{ - // Name: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Type: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("aaa"), - // DisplayStatus: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("aaaaaaaaaaaaaaaaaaa"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-14T16:43:41.657Z"); return t}()), - // }}, - // Substatuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("aaa"), - // DisplayStatus: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("aaaaaaaaaaaaaaaaaaa"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-14T16:43:41.657Z"); return t}()), - // }}, - // TypeHandlerVersion: to.Ptr("aaaaaa"), - // }, - // ProtectedSettings: map[string]any{ - // }, - // 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"), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // Publisher: to.Ptr("aaaaaaaaaaaaaaaa"), - // Settings: map[string]any{ - // }, - // SuppressFailures: to.Ptr(true), - // TypeHandlerVersion: to.Ptr("aaaaaaaaaaaa"), - // }, - // }}, - // Zones: []*string{ - // to.Ptr("aaaaaa")}, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineExamples/VirtualMachine_List_MinimumSet_Gen.json -func ExampleVirtualMachinesClient_NewListPager_virtualMachineListMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualMachinesClient().NewListPager("rgcompute", &armcompute.VirtualMachinesClientListOptions{Filter: nil, - Expand: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.VirtualMachineListResult = armcompute.VirtualMachineListResult{ - // Value: []*armcompute.VirtualMachine{ - // { - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/rgcompute/providers/Microsoft.Compute/virtualMachines/{virtualMachineName}"), - // Location: to.Ptr("eastus"), - // }, - // { - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/rgcompute/providers/Microsoft.Compute/virtualMachines/{virtualMachineName}"), - // Location: to.Ptr("eastus"), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineExamples/VirtualMachine_ListAll_MaximumSet_Gen.json -func ExampleVirtualMachinesClient_NewListAllPager_virtualMachineListAllMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualMachinesClient().NewListAllPager(&armcompute.VirtualMachinesClientListAllOptions{StatusOnly: to.Ptr("aaaaaa"), - Filter: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - Expand: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.VirtualMachineListResult = armcompute.VirtualMachineListResult{ - // Value: []*armcompute.VirtualMachine{ - // { - // Name: to.Ptr("{virtualMachineName}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{virtualMachineName}"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // ExtendedLocation: &armcompute.ExtendedLocation{ - // Name: to.Ptr("aaaa"), - // Type: to.Ptr(armcompute.ExtendedLocationTypesEdgeZone), - // }, - // Identity: &armcompute.VirtualMachineIdentity{ - // Type: to.Ptr(armcompute.ResourceIdentityTypeSystemAssigned), - // PrincipalID: to.Ptr("aaaaaaaaaaaaaaaa"), - // TenantID: to.Ptr("aaaaa"), - // UserAssignedIdentities: map[string]*armcompute.UserAssignedIdentitiesValue{ - // "key5688": &armcompute.UserAssignedIdentitiesValue{ - // ClientID: to.Ptr("aaaaaaaaaaa"), - // PrincipalID: to.Ptr("aaaaaaaaaaaaaaa"), - // }, - // }, - // }, - // Plan: &armcompute.Plan{ - // Name: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // Product: to.Ptr("aaaaaaaaaaaaaaaaaaaaaa"), - // PromotionCode: to.Ptr("aaaaaaaaaaaaaa"), - // Publisher: to.Ptr("aaaaaaaaaaaaaaaaa"), - // }, - // Properties: &armcompute.VirtualMachineProperties{ - // AdditionalCapabilities: &armcompute.AdditionalCapabilities{ - // HibernationEnabled: to.Ptr(true), - // UltraSSDEnabled: to.Ptr(true), - // }, - // ApplicationProfile: &armcompute.ApplicationProfile{ - // GalleryApplications: []*armcompute.VMGalleryApplication{ - // { - // ConfigurationReference: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // Order: to.Ptr[int32](4), - // PackageReferenceID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaa"), - // Tags: to.Ptr("aaaaa"), - // }}, - // }, - // AvailabilitySet: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // BillingProfile: &armcompute.BillingProfile{ - // MaxPrice: to.Ptr[float64](26), - // }, - // CapacityReservation: &armcompute.CapacityReservationProfile{ - // CapacityReservationGroup: &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("aaaaaaaaaaaaaaaaaaaaa"), - // }, - // }, - // EvictionPolicy: to.Ptr(armcompute.VirtualMachineEvictionPolicyTypesDeallocate), - // ExtensionsTimeBudget: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // HardwareProfile: &armcompute.HardwareProfile{ - // VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardA0), - // VMSizeProperties: &armcompute.VMSizeProperties{ - // VCPUsAvailable: to.Ptr[int32](7), - // VCPUsPerCore: to.Ptr[int32](14), - // }, - // }, - // Host: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // HostGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // LicenseType: to.Ptr("aaaaaaaaaaaaaaa"), - // NetworkProfile: &armcompute.NetworkProfile{ - // NetworkAPIVersion: to.Ptr(armcompute.NetworkAPIVersion("2022-05-01")), - // NetworkInterfaceConfigurations: []*armcompute.VirtualMachineNetworkInterfaceConfiguration{ - // { - // Name: to.Ptr("aaaaaaaa"), - // Properties: &armcompute.VirtualMachineNetworkInterfaceConfigurationProperties{ - // DeleteOption: to.Ptr(armcompute.DeleteOptionsDelete), - // DisableTCPStateTracking: to.Ptr(true), - // DNSSettings: &armcompute.VirtualMachineNetworkInterfaceDNSSettingsConfiguration{ - // DNSServers: []*string{ - // to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa")}, - // }, - // 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("aaaaaaaa"), - // 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("aaaaaaaaaaaaaaaaaa"), - // Properties: &armcompute.VirtualMachinePublicIPAddressConfigurationProperties{ - // DeleteOption: to.Ptr(armcompute.DeleteOptionsDelete), - // DNSSettings: &armcompute.VirtualMachinePublicIPAddressDNSSettingsConfiguration{ - // DomainNameLabel: to.Ptr("aaaaa"), - // DomainNameLabelScope: to.Ptr(armcompute.DomainNameLabelScopeTypesTenantReuse), - // }, - // IdleTimeoutInMinutes: to.Ptr[int32](23), - // IPTags: []*armcompute.VirtualMachineIPTag{ - // { - // IPTagType: to.Ptr("aaaaa"), - // Tag: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // }}, - // 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/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // DeleteOption: to.Ptr(armcompute.DeleteOptionsDelete), - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("Foo12"), - // AllowExtensionOperations: to.Ptr(true), - // ComputerName: to.Ptr("Test"), - // 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("aaaaaaaaaaaaaaaaaaaaaa"), - // KeyData: to.Ptr("aaa"), - // }}, - // }, - // }, - // RequireGuestProvisionSignal: to.Ptr(true), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // AdditionalUnattendContent: []*armcompute.AdditionalUnattendContent{ - // { - // ComponentName: to.Ptr("Microsoft-Windows-Shell-Setup"), - // Content: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaa"), - // 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("aaaaaaaaaaaaaaaaaaaaaa"), - // WinRM: &armcompute.WinRMConfiguration{ - // Listeners: []*armcompute.WinRMListener{ - // { - // CertificateURL: to.Ptr("aaaaaaaaaaaaaaaaaaaaa"), - // Protocol: to.Ptr(armcompute.ProtocolTypesHTTP), - // }}, - // }, - // }, - // }, - // PlatformFaultDomain: to.Ptr[int32](8), - // Priority: to.Ptr(armcompute.VirtualMachinePriorityTypesRegular), - // ProvisioningState: to.Ptr("Succeeded"), - // ProximityPlacementGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // ScheduledEventsProfile: &armcompute.ScheduledEventsProfile{ - // OSImageNotificationProfile: &armcompute.OSImageNotificationProfile{ - // Enable: to.Ptr(true), - // NotBeforeTimeout: to.Ptr("PT15M"), - // }, - // 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.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // ImageReference: &armcompute.ImageReference{ - // ID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // CommunityGalleryImageID: to.Ptr("aaaa"), - // ExactVersion: to.Ptr("aaaaaaaaaaaaa"), - // Offer: to.Ptr("WindowsServer"), - // Publisher: to.Ptr("MicrosoftWindowsServer"), - // SharedGalleryImageID: to.Ptr("aaaaaaaaaaaaaaa"), - // SKU: to.Ptr("2012-R2-Datacenter"), - // Version: to.Ptr("4.127.20170406"), - // }, - // OSDisk: &armcompute.OSDisk{ - // Name: to.Ptr("test"), - // 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("aaaaaaaaa"), - // 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("aaaaaaaaaaaaa"), - // 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/testingexcludedisk_OsDisk_1_74cdaedcea50483d9833c96adefa100f"), - // DiskEncryptionSet: &armcompute.DiskEncryptionSetParameters{ - // ID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // }, - // SecurityProfile: &armcompute.VMDiskSecurityProfile{ - // DiskEncryptionSet: &armcompute.DiskEncryptionSetParameters{ - // ID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // }, - // SecurityEncryptionType: to.Ptr(armcompute.SecurityEncryptionTypesVMGuestStateOnly), - // }, - // 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), - // }, - // }, - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-14T16:43:41.683Z"); return t}()), - // UserData: to.Ptr("aaa"), - // VirtualMachineScaleSet: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // VMID: to.Ptr("{vmId}"), - // }, - // Resources: []*armcompute.VirtualMachineExtension{ - // { - // Name: to.Ptr("aaaaaaaaaaaaa"), - // Type: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // ID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // Location: to.Ptr("aaaaaaaaaaaaaaaa"), - // Tags: map[string]*string{ - // "key9428": to.Ptr("aaaaaaa"), - // }, - // Properties: &armcompute.VirtualMachineExtensionProperties{ - // Type: to.Ptr("aaaaaaaa"), - // AutoUpgradeMinorVersion: to.Ptr(true), - // EnableAutomaticUpgrade: to.Ptr(true), - // ForceUpdateTag: to.Ptr("aaaaaaaaaaaaaaa"), - // ProtectedSettings: map[string]any{ - // }, - // 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"), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // Publisher: to.Ptr("aaaaaaaaaaaaaaaa"), - // Settings: map[string]any{ - // }, - // SuppressFailures: to.Ptr(true), - // TypeHandlerVersion: to.Ptr("aaaaaaaaaaaa"), - // }, - // }}, - // Zones: []*string{ - // to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaa")}, - // }, - // { - // Name: to.Ptr("{virtualMachineName}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{virtualMachineName}"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // ExtendedLocation: &armcompute.ExtendedLocation{ - // Name: to.Ptr("aaaa"), - // Type: to.Ptr(armcompute.ExtendedLocationTypesEdgeZone), - // }, - // Identity: &armcompute.VirtualMachineIdentity{ - // Type: to.Ptr(armcompute.ResourceIdentityTypeSystemAssigned), - // PrincipalID: to.Ptr("aaaaaaaaaaaaaaaa"), - // TenantID: to.Ptr("aaaaa"), - // UserAssignedIdentities: map[string]*armcompute.UserAssignedIdentitiesValue{ - // "key5688": &armcompute.UserAssignedIdentitiesValue{ - // ClientID: to.Ptr("aaaaaaaaaaa"), - // PrincipalID: to.Ptr("aaaaaaaaaaaaaaa"), - // }, - // }, - // }, - // Plan: &armcompute.Plan{ - // Name: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // Product: to.Ptr("aaaaaaaaaaaaaaaaaaaaaa"), - // PromotionCode: to.Ptr("aaaaaaaaaaaaaa"), - // Publisher: to.Ptr("aaaaaaaaaaaaaaaaa"), - // }, - // Properties: &armcompute.VirtualMachineProperties{ - // AdditionalCapabilities: &armcompute.AdditionalCapabilities{ - // HibernationEnabled: to.Ptr(true), - // UltraSSDEnabled: to.Ptr(true), - // }, - // ApplicationProfile: &armcompute.ApplicationProfile{ - // GalleryApplications: []*armcompute.VMGalleryApplication{ - // { - // ConfigurationReference: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // Order: to.Ptr[int32](4), - // PackageReferenceID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaa"), - // Tags: to.Ptr("aaaaa"), - // }}, - // }, - // AvailabilitySet: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // BillingProfile: &armcompute.BillingProfile{ - // MaxPrice: to.Ptr[float64](26), - // }, - // CapacityReservation: &armcompute.CapacityReservationProfile{ - // CapacityReservationGroup: &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("aaaaaaaaaaaaaaaaaaaaa"), - // }, - // }, - // EvictionPolicy: to.Ptr(armcompute.VirtualMachineEvictionPolicyTypesDeallocate), - // ExtensionsTimeBudget: to.Ptr("aaaaaaaaaaaaaaaaaaaaaa"), - // HardwareProfile: &armcompute.HardwareProfile{ - // VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardA0), - // VMSizeProperties: &armcompute.VMSizeProperties{ - // VCPUsAvailable: to.Ptr[int32](7), - // VCPUsPerCore: to.Ptr[int32](14), - // }, - // }, - // Host: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // HostGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // LicenseType: to.Ptr("aaaaaaaaaaaaaa"), - // NetworkProfile: &armcompute.NetworkProfile{ - // NetworkAPIVersion: to.Ptr(armcompute.NetworkAPIVersion("2022-05-01")), - // NetworkInterfaceConfigurations: []*armcompute.VirtualMachineNetworkInterfaceConfiguration{ - // { - // Name: to.Ptr("aaaaaaaa"), - // Properties: &armcompute.VirtualMachineNetworkInterfaceConfigurationProperties{ - // DeleteOption: to.Ptr(armcompute.DeleteOptionsDelete), - // DisableTCPStateTracking: to.Ptr(true), - // DNSSettings: &armcompute.VirtualMachineNetworkInterfaceDNSSettingsConfiguration{ - // DNSServers: []*string{ - // to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa")}, - // }, - // 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("aaaaaaaa"), - // 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("aaaaaaaaaaaaaaaaaa"), - // Properties: &armcompute.VirtualMachinePublicIPAddressConfigurationProperties{ - // DeleteOption: to.Ptr(armcompute.DeleteOptionsDelete), - // DNSSettings: &armcompute.VirtualMachinePublicIPAddressDNSSettingsConfiguration{ - // DomainNameLabel: to.Ptr("aaaaa"), - // DomainNameLabelScope: to.Ptr(armcompute.DomainNameLabelScopeTypesSubscriptionReuse), - // }, - // IdleTimeoutInMinutes: to.Ptr[int32](23), - // IPTags: []*armcompute.VirtualMachineIPTag{ - // { - // IPTagType: to.Ptr("aaaaa"), - // Tag: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // }}, - // 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/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // DeleteOption: to.Ptr(armcompute.DeleteOptionsDelete), - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("Foo12"), - // AllowExtensionOperations: to.Ptr(true), - // ComputerName: to.Ptr("Test"), - // CustomData: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"), - // 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("aaaaaaaaaaaaaaaaaaaaaa"), - // KeyData: to.Ptr("aaa"), - // }}, - // }, - // }, - // RequireGuestProvisionSignal: to.Ptr(true), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // AdditionalUnattendContent: []*armcompute.AdditionalUnattendContent{ - // { - // ComponentName: to.Ptr("Microsoft-Windows-Shell-Setup"), - // Content: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaa"), - // 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("aaaaaaaaaaaaaaaaaaaa"), - // WinRM: &armcompute.WinRMConfiguration{ - // Listeners: []*armcompute.WinRMListener{ - // { - // CertificateURL: to.Ptr("aaaaaaaaaaaaaaaaaaaaa"), - // Protocol: to.Ptr(armcompute.ProtocolTypesHTTP), - // }}, - // }, - // }, - // }, - // PlatformFaultDomain: to.Ptr[int32](11), - // Priority: to.Ptr(armcompute.VirtualMachinePriorityTypesRegular), - // ProvisioningState: to.Ptr("Succeeded"), - // ProximityPlacementGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // ScheduledEventsProfile: &armcompute.ScheduledEventsProfile{ - // OSImageNotificationProfile: &armcompute.OSImageNotificationProfile{ - // Enable: to.Ptr(true), - // NotBeforeTimeout: to.Ptr("PT15M"), - // }, - // 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.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // ImageReference: &armcompute.ImageReference{ - // ID: to.Ptr("aaaaaaaa"), - // CommunityGalleryImageID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // ExactVersion: to.Ptr("aa"), - // Offer: to.Ptr("WindowsServer"), - // Publisher: to.Ptr("MicrosoftWindowsServer"), - // SharedGalleryImageID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaa"), - // SKU: to.Ptr("2012-R2-Datacenter"), - // Version: to.Ptr("4.127.20170406"), - // }, - // OSDisk: &armcompute.OSDisk{ - // Name: to.Ptr("test"), - // 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("aaaaaaaaa"), - // 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("aaaaaaaaaaaaa"), - // 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/testingexcludedisk_OsDisk_1_74cdaedcea50483d9833c96adefa100f"), - // DiskEncryptionSet: &armcompute.DiskEncryptionSetParameters{ - // ID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // }, - // SecurityProfile: &armcompute.VMDiskSecurityProfile{ - // DiskEncryptionSet: &armcompute.DiskEncryptionSetParameters{ - // ID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // }, - // SecurityEncryptionType: to.Ptr(armcompute.SecurityEncryptionTypesVMGuestStateOnly), - // }, - // 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), - // }, - // }, - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-14T16:43:41.685Z"); return t}()), - // UserData: to.Ptr("aaaaaaaaaaaaaaaaaaa"), - // VirtualMachineScaleSet: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // VMID: to.Ptr("{vmId}"), - // }, - // Resources: []*armcompute.VirtualMachineExtension{ - // { - // Name: to.Ptr("aaaaaaaaaaaaa"), - // Type: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // ID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // Location: to.Ptr("aaaaaaaaaaaaaaaa"), - // Tags: map[string]*string{ - // "key9428": to.Ptr("aaaaaaa"), - // }, - // Properties: &armcompute.VirtualMachineExtensionProperties{ - // Type: to.Ptr("aaaaaaaa"), - // AutoUpgradeMinorVersion: to.Ptr(true), - // EnableAutomaticUpgrade: to.Ptr(true), - // ForceUpdateTag: to.Ptr("aaaaaaaaaaaaaaa"), - // ProtectedSettings: map[string]any{ - // }, - // 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"), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // Publisher: to.Ptr("aaaaaaaaaaaaaaaa"), - // Settings: map[string]any{ - // }, - // SuppressFailures: to.Ptr(true), - // TypeHandlerVersion: to.Ptr("aaaaaaaaaaaa"), - // }, - // }}, - // Zones: []*string{ - // to.Ptr("aaaaaa")}, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineExamples/VirtualMachine_ListAll_MinimumSet_Gen.json -func ExampleVirtualMachinesClient_NewListAllPager_virtualMachineListAllMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualMachinesClient().NewListAllPager(&armcompute.VirtualMachinesClientListAllOptions{StatusOnly: nil, - Filter: nil, - Expand: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.VirtualMachineListResult = armcompute.VirtualMachineListResult{ - // Value: []*armcompute.VirtualMachine{ - // { - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{virtualMachineName}"), - // Location: to.Ptr("eastus"), - // }, - // { - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{virtualMachineName}"), - // Location: to.Ptr("eastus"), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineExamples/VirtualMachine_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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualMachinesClient().NewListAvailableSizesPager("myResourceGroup", "myVmName", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.VirtualMachineSizeListResult = armcompute.VirtualMachineSizeListResult{ - // Value: []*armcompute.VirtualMachineSize{ - // { - // Name: to.Ptr("Standard_A1_V2"), - // MaxDataDiskCount: to.Ptr[int32](2), - // MemoryInMB: to.Ptr[int32](2048), - // NumberOfCores: to.Ptr[int32](1), - // OSDiskSizeInMB: to.Ptr[int32](1047552), - // ResourceDiskSizeInMB: to.Ptr[int32](10240), - // }, - // { - // Name: to.Ptr("Standard_A2_V2"), - // MaxDataDiskCount: to.Ptr[int32](4), - // MemoryInMB: to.Ptr[int32](4096), - // NumberOfCores: to.Ptr[int32](2), - // OSDiskSizeInMB: to.Ptr[int32](1047552), - // ResourceDiskSizeInMB: to.Ptr[int32](20480), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineExamples/VirtualMachine_PowerOff_MaximumSet_Gen.json -func ExampleVirtualMachinesClient_BeginPowerOff_virtualMachinePowerOffMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineExamples/VirtualMachine_PowerOff_MinimumSet_Gen.json -func ExampleVirtualMachinesClient_BeginPowerOff_virtualMachinePowerOffMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineExamples/VirtualMachine_Restart_MaximumSet_Gen.json -func ExampleVirtualMachinesClient_BeginRestart_virtualMachineRestartMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineExamples/VirtualMachine_Restart_MinimumSet_Gen.json -func ExampleVirtualMachinesClient_BeginRestart_virtualMachineRestartMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineExamples/VirtualMachine_Start_MaximumSet_Gen.json -func ExampleVirtualMachinesClient_BeginStart_virtualMachineStartMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineExamples/VirtualMachine_Start_MinimumSet_Gen.json -func ExampleVirtualMachinesClient_BeginStart_virtualMachineStartMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineExamples/VirtualMachine_Redeploy_MaximumSet_Gen.json -func ExampleVirtualMachinesClient_BeginRedeploy_virtualMachineRedeployMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineExamples/VirtualMachine_Redeploy_MinimumSet_Gen.json -func ExampleVirtualMachinesClient_BeginRedeploy_virtualMachineRedeployMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineExamples/VirtualMachine_Reimage_NonEphemeralVMs.json -func ExampleVirtualMachinesClient_BeginReimage_reimageANonEphemeralVirtualMachine() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().BeginReimage(ctx, "myResourceGroup", "myVMName", &armcompute.VirtualMachinesClientBeginReimageOptions{Parameters: &armcompute.VirtualMachineReimageParameters{ - ExactVersion: to.Ptr("aaaaaa"), - OSProfile: &armcompute.OSProfileProvisioningData{ - AdminPassword: to.Ptr("{your-password}"), - CustomData: to.Ptr("{your-custom-data}"), - }, - 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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineExamples/VirtualMachine_Reimage.json -func ExampleVirtualMachinesClient_BeginReimage_reimageAVirtualMachine() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachinesClient().RetrieveBootDiagnosticsData(ctx, "ResourceGroup", "VMName", &armcompute.VirtualMachinesClientRetrieveBootDiagnosticsDataOptions{SasURIExpirationTimeInMinutes: to.Ptr[int32](60)}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RetrieveBootDiagnosticsDataResult = armcompute.RetrieveBootDiagnosticsDataResult{ - // ConsoleScreenshotBlobURI: to.Ptr("https://storageuri/vm.screenshot.bmp?{sasKey}"), - // SerialConsoleLogBlobURI: to.Ptr("https://storageuri/vm.serialconsole.log?{sasKey}"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineExamples/VirtualMachine_PerformMaintenance_MaximumSet_Gen.json -func ExampleVirtualMachinesClient_BeginPerformMaintenance_virtualMachinePerformMaintenanceMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineExamples/VirtualMachine_PerformMaintenance_MinimumSet_Gen.json -func ExampleVirtualMachinesClient_BeginPerformMaintenance_virtualMachinePerformMaintenanceMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewVirtualMachinesClient().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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineAssessPatchesResult = armcompute.VirtualMachineAssessPatchesResult{ - // AssessmentActivityID: to.Ptr("68f8b292-dfc2-4646-9781-33cc88631968"), - // AvailablePatches: []*armcompute.VirtualMachineSoftwarePatchProperties{ - // { - // Name: to.Ptr("Definition Update for Windows Defender Antivirus - KB2267602 (Definition 1.279.1373.0)"), - // ActivityID: to.Ptr("68f8b292-dfc2-4646-9781-33cc88631968"), - // AssessmentState: to.Ptr(armcompute.PatchAssessmentStateAvailable), - // Classifications: []*string{ - // to.Ptr("Definition Updates")}, - // KbID: to.Ptr("2267602"), - // LastModifiedDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-24T21:18:45.283Z"); return t}()), - // PatchID: to.Ptr("35428702-5784-4ba4-a6e0-5222258b5411"), - // PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-11-07T00:00:00.000Z"); return t}()), - // RebootBehavior: to.Ptr(armcompute.VMGuestPatchRebootBehaviorNeverReboots), - // Version: to.Ptr(""), - // }, - // { - // Name: to.Ptr("Windows Malicious Software Removal Tool x64 - October 2018 (KB890830)"), - // ActivityID: to.Ptr("68f8b292-dfc2-4646-9781-33cc88631968"), - // AssessmentState: to.Ptr(armcompute.PatchAssessmentStateAvailable), - // Classifications: []*string{ - // to.Ptr("Update Rollups")}, - // KbID: to.Ptr("890830"), - // LastModifiedDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-24T21:18:45.283Z"); return t}()), - // PatchID: to.Ptr("39f9cdd1-795c-4d0e-8c0a-73ab3f31746d"), - // PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-11-07T00:00:00.000Z"); return t}()), - // RebootBehavior: to.Ptr(armcompute.VMGuestPatchRebootBehaviorCanRequestReboot), - // Version: to.Ptr(""), - // }}, - // CriticalAndSecurityPatchCount: to.Ptr[int32](1), - // OtherPatchCount: to.Ptr[int32](2), - // RebootPending: to.Ptr(true), - // StartDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-24T21:02:04.255Z"); return t}()), - // Status: to.Ptr(armcompute.PatchOperationStatusSucceeded), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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.053Z"); 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineInstallPatchesResult = armcompute.VirtualMachineInstallPatchesResult{ - // ExcludedPatchCount: to.Ptr[int32](0), - // FailedPatchCount: to.Ptr[int32](0), - // InstallationActivityID: to.Ptr("68f8b292-dfc2-4646-9781-33cc88631968"), - // InstalledPatchCount: to.Ptr[int32](3), - // MaintenanceWindowExceeded: to.Ptr(false), - // NotSelectedPatchCount: to.Ptr[int32](0), - // Patches: []*armcompute.PatchInstallationDetail{ - // { - // Name: to.Ptr("Definition Update for Windows Defender Antivirus - KB2267602 (Definition 1.279.1373.0)"), - // Classifications: []*string{ - // to.Ptr("Definition Updates")}, - // InstallationState: to.Ptr(armcompute.PatchInstallationStateInstalled), - // KbID: to.Ptr("2267602"), - // PatchID: to.Ptr("35428702-5784-4ba4-a6e0-5222258b5411"), - // Version: to.Ptr(""), - // }, - // { - // Name: to.Ptr("Windows Malicious Software Removal Tool x64 - October 2018 (KB890830)"), - // Classifications: []*string{ - // to.Ptr("Update Rollups")}, - // InstallationState: to.Ptr(armcompute.PatchInstallationStatePending), - // KbID: to.Ptr("890830"), - // PatchID: to.Ptr("39f9cdd1-795c-4d0e-8c0a-73ab3f31746d"), - // Version: to.Ptr(""), - // }}, - // PendingPatchCount: to.Ptr[int32](2), - // RebootStatus: to.Ptr(armcompute.VMGuestPatchRebootStatusCompleted), - // StartDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-24T21:02:04.255Z"); return t}()), - // Status: to.Ptr(armcompute.PatchOperationStatusSucceeded), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineExamples/VirtualMachine_AttachDetachDataDisks_MaximumSet_Gen.json -func ExampleVirtualMachinesClient_BeginAttachDetachDataDisks_virtualMachineAttachDetachDataDisksMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().BeginAttachDetachDataDisks(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaa", armcompute.AttachDetachDataDisksRequest{ - DataDisksToAttach: []*armcompute.DataDisksToAttach{ - { - DiskID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/vmss3176_vmss3176_0_disk2_6c4f554bdafa49baa780eb2d128ff39d"), - Lun: to.Ptr[int32](1), - }, - { - DiskID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/vmss3176_vmss3176_2_disk3_7d5e664bdafa49baa780eb2d128ff38e"), - Lun: to.Ptr[int32](2), - }}, - DataDisksToDetach: []*armcompute.DataDisksToDetach{ - { - DetachOption: to.Ptr(armcompute.DiskDetachOptionTypesForceDetach), - DiskID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/vmss3176_vmss3176_1_disk1_1a4e784bdafa49baa780eb2d128ff65x"), - }, - { - DetachOption: to.Ptr(armcompute.DiskDetachOptionTypesForceDetach), - DiskID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/vmss3176_vmss3176_4_disk4_4d4e784bdafa49baa780eb2d256ff41z"), - }}, - }, 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.StorageProfile = armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // { - // Name: to.Ptr("vmss3176_vmss3176_0_disk2_6c4f554bdafa49baa780eb2d128ff39d"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesAttach), - // DiskSizeGB: to.Ptr[int32](30), - // 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"), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesPremiumLRS), - // }, - // }, - // { - // Name: to.Ptr("vmss3176_vmss3176_2_disk3_7d5e664bdafa49baa780eb2d128ff38e"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesAttach), - // DiskSizeGB: to.Ptr[int32](100), - // Lun: to.Ptr[int32](2), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/vmss3176_vmss3176_2_disk3_7d5e664bdafa49baa780eb2d128ff38e"), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesPremiumLRS), - // }, - // }}, - // 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("myOsDisk"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // DiskSizeGB: to.Ptr[int32](30), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myOsDisk"), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesPremiumLRS), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineExamples/VirtualMachine_AttachDetachDataDisks_MinimumSet_Gen.json -func ExampleVirtualMachinesClient_BeginAttachDetachDataDisks_virtualMachineAttachDetachDataDisksMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().BeginAttachDetachDataDisks(ctx, "rgcompute", "azure-vm", armcompute.AttachDetachDataDisksRequest{ - DataDisksToAttach: []*armcompute.DataDisksToAttach{ - { - DiskID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/vmss3176_vmss3176_0_disk2_6c4f554bdafa49baa780eb2d128ff39d"), - }}, - DataDisksToDetach: []*armcompute.DataDisksToDetach{ - { - DiskID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/vmss3176_vmss3176_1_disk1_1a4e784bdafa49baa780eb2d128ff65x"), - }}, - }, 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.StorageProfile = armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // { - // Name: to.Ptr("vmss3176_vmss3176_0_disk2_6c4f554bdafa49baa780eb2d128ff39d"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesAttach), - // DiskSizeGB: to.Ptr[int32](30), - // Lun: to.Ptr[int32](0), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/vmss3176_vmss3176_0_disk2_6c4f554bdafa49baa780eb2d128ff39d"), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesPremiumLRS), - // }, - // }}, - // 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("myOsDisk"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // DiskSizeGB: to.Ptr[int32](30), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myOsDisk"), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesPremiumLRS), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RunCommandResult = armcompute.RunCommandResult{ - // Value: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("ComponentStatus/StdOut/succeeded"), - // DisplayStatus: to.Ptr("Provisioning succeeded"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("This is a sample script with parameters value1 value2"), - // }, - // { - // Code: to.Ptr("ComponentStatus/StdErr/succeeded"), - // DisplayStatus: to.Ptr("Provisioning succeeded"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr(""), - // }}, - // } -} 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 20c239d7adc0..000000000000 --- a/sdk/resourcemanager/compute/armcompute/virtualmachinescalesetextensions_client_example_test.go +++ /dev/null @@ -1,374 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package 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/v5" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtension_CreateOrUpdate_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetExtensionsClient_BeginCreateOrUpdate_virtualMachineScaleSetExtensionCreateOrUpdateMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetExtensionsClient().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]any{}, - ProvisionAfterExtensions: []*string{ - to.Ptr("aa")}, - Publisher: to.Ptr("{extension-Publisher}"), - Settings: map[string]any{}, - 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSetExtension = armcompute.VirtualMachineScaleSetExtension{ - // ID: to.Ptr("aaaaaaaa"), - // Name: to.Ptr("{extension-name}"), - // Type: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Properties: &armcompute.VirtualMachineScaleSetExtensionProperties{ - // Type: to.Ptr("{extension-Type}"), - // AutoUpgradeMinorVersion: to.Ptr(true), - // EnableAutomaticUpgrade: to.Ptr(true), - // ForceUpdateTag: to.Ptr("aaaaaaaaa"), - // ProtectedSettings: map[string]any{ - // }, - // ProvisionAfterExtensions: []*string{ - // to.Ptr("aa")}, - // ProvisioningState: to.Ptr("Succeeded"), - // Publisher: to.Ptr("{extension-Publisher}"), - // Settings: map[string]any{ - // }, - // SuppressFailures: to.Ptr(true), - // TypeHandlerVersion: to.Ptr("{handler-version}"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtension_CreateOrUpdate_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetExtensionsClient_BeginCreateOrUpdate_virtualMachineScaleSetExtensionCreateOrUpdateMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetExtensionsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSetExtension = armcompute.VirtualMachineScaleSetExtension{ - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtension_Update_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetExtensionsClient_BeginUpdate_virtualMachineScaleSetExtensionUpdateMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetExtensionsClient().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]any{}, - ProvisionAfterExtensions: []*string{ - to.Ptr("aa")}, - Publisher: to.Ptr("{extension-Publisher}"), - Settings: map[string]any{}, - 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSetExtension = armcompute.VirtualMachineScaleSetExtension{ - // ID: to.Ptr("aaaaaaaa"), - // Name: to.Ptr("{extension-name}"), - // Type: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Properties: &armcompute.VirtualMachineScaleSetExtensionProperties{ - // Type: to.Ptr("{extension-Type}"), - // AutoUpgradeMinorVersion: to.Ptr(true), - // EnableAutomaticUpgrade: to.Ptr(true), - // ForceUpdateTag: to.Ptr("aaaaaaaaa"), - // ProtectedSettings: map[string]any{ - // }, - // ProvisionAfterExtensions: []*string{ - // to.Ptr("aa")}, - // ProvisioningState: to.Ptr("Succeeded"), - // Publisher: to.Ptr("{extension-Publisher}"), - // Settings: map[string]any{ - // }, - // SuppressFailures: to.Ptr(true), - // TypeHandlerVersion: to.Ptr("{handler-version}"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtension_Update_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetExtensionsClient_BeginUpdate_virtualMachineScaleSetExtensionUpdateMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetExtensionsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSetExtension = armcompute.VirtualMachineScaleSetExtension{ - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtension_Delete_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetExtensionsClient_BeginDelete_virtualMachineScaleSetExtensionDeleteMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetExtensionsClient().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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtension_Delete_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetExtensionsClient_BeginDelete_virtualMachineScaleSetExtensionDeleteMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetExtensionsClient().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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtension_Get_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetExtensionsClient_Get_virtualMachineScaleSetExtensionGetMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineScaleSetExtensionsClient().Get(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaa", &armcompute.VirtualMachineScaleSetExtensionsClientGetOptions{Expand: to.Ptr("aaaaaaa")}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSetExtension = armcompute.VirtualMachineScaleSetExtension{ - // ID: to.Ptr("aaaaaaaa"), - // Name: to.Ptr("{extension-name}"), - // Type: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Properties: &armcompute.VirtualMachineScaleSetExtensionProperties{ - // Type: to.Ptr("{extension-Type}"), - // AutoUpgradeMinorVersion: to.Ptr(true), - // EnableAutomaticUpgrade: to.Ptr(true), - // ForceUpdateTag: to.Ptr("aaaaaaaaa"), - // ProtectedSettings: map[string]any{ - // }, - // ProvisionAfterExtensions: []*string{ - // to.Ptr("aa")}, - // ProvisioningState: to.Ptr("Succeeded"), - // Publisher: to.Ptr("{extension-Publisher}"), - // Settings: map[string]any{ - // }, - // SuppressFailures: to.Ptr(true), - // TypeHandlerVersion: to.Ptr("{handler-version}"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtension_Get_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetExtensionsClient_Get_virtualMachineScaleSetExtensionGetMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineScaleSetExtensionsClient().Get(ctx, "rgcompute", "a", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", &armcompute.VirtualMachineScaleSetExtensionsClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSetExtension = armcompute.VirtualMachineScaleSetExtension{ - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtension_List_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetExtensionsClient_NewListPager_virtualMachineScaleSetExtensionListMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualMachineScaleSetExtensionsClient().NewListPager("rgcompute", "aaaaaaaaaaaaaaaaaaaa", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.VirtualMachineScaleSetExtensionListResult = armcompute.VirtualMachineScaleSetExtensionListResult{ - // Value: []*armcompute.VirtualMachineScaleSetExtension{ - // { - // ID: to.Ptr("aaaaaaaa"), - // Name: to.Ptr("{extension-name}"), - // Type: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Properties: &armcompute.VirtualMachineScaleSetExtensionProperties{ - // Type: to.Ptr("{extension-Type}"), - // AutoUpgradeMinorVersion: to.Ptr(true), - // EnableAutomaticUpgrade: to.Ptr(true), - // ForceUpdateTag: to.Ptr("aaaaaaaaa"), - // ProtectedSettings: map[string]any{ - // }, - // ProvisionAfterExtensions: []*string{ - // to.Ptr("aa")}, - // ProvisioningState: to.Ptr("Succeeded"), - // Publisher: to.Ptr("{extension-Publisher}"), - // Settings: map[string]any{ - // }, - // SuppressFailures: to.Ptr(true), - // TypeHandlerVersion: to.Ptr("{handler-version}"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtension_List_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetExtensionsClient_NewListPager_virtualMachineScaleSetExtensionListMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualMachineScaleSetExtensionsClient().NewListPager("rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.VirtualMachineScaleSetExtensionListResult = armcompute.VirtualMachineScaleSetExtensionListResult{ - // Value: []*armcompute.VirtualMachineScaleSetExtension{ - // { - // }}, - // } - } -} 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 8f237e2a8741..000000000000 --- a/sdk/resourcemanager/compute/armcompute/virtualmachinescalesetrollingupgrades_client_example_test.go +++ /dev/null @@ -1,215 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package 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/v5" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetRollingUpgrade_Cancel_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetRollingUpgradesClient_BeginCancel_virtualMachineScaleSetRollingUpgradeCancelMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetRollingUpgradesClient().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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetRollingUpgrade_Cancel_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetRollingUpgradesClient_BeginCancel_virtualMachineScaleSetRollingUpgradeCancelMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetRollingUpgradesClient().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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetRollingUpgrade_StartOSUpgrade_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetRollingUpgradesClient_BeginStartOSUpgrade_virtualMachineScaleSetRollingUpgradeStartOsUpgradeMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetRollingUpgradesClient().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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetRollingUpgrade_StartOSUpgrade_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetRollingUpgradesClient_BeginStartOSUpgrade_virtualMachineScaleSetRollingUpgradeStartOsUpgradeMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetRollingUpgradesClient().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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetRollingUpgradesClient().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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetRollingUpgrade_GetLatest_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetRollingUpgradesClient_GetLatest_virtualMachineScaleSetRollingUpgradeGetLatestMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineScaleSetRollingUpgradesClient().GetLatest(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RollingUpgradeStatusInfo = armcompute.RollingUpgradeStatusInfo{ - // Name: to.Ptr("aaaaaaaaaaaaaaaaaaa"), - // Type: to.Ptr("aaaaaaaaaaaaaaaaaaaaa"), - // ID: to.Ptr("aaaaaaaaaa"), - // Location: to.Ptr("aaaaaa"), - // Tags: map[string]*string{ - // "key8533": to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // }, - // Properties: &armcompute.RollingUpgradeStatusInfoProperties{ - // Error: &armcompute.APIError{ - // Code: to.Ptr("aaaaaaa"), - // Innererror: &armcompute.InnerError{ - // Errordetail: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Exceptiontype: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // }, - // Message: to.Ptr("aaaaaaaaa"), - // Target: to.Ptr("aaaaaaa"), - // Details: []*armcompute.APIErrorBase{ - // { - // Code: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Message: to.Ptr("aa"), - // Target: to.Ptr("aaaa"), - // }}, - // }, - // Policy: &armcompute.RollingUpgradePolicy{ - // EnableCrossZoneUpgrade: to.Ptr(true), - // MaxBatchInstancePercent: to.Ptr[int32](49), - // MaxSurge: to.Ptr(true), - // MaxUnhealthyInstancePercent: to.Ptr[int32](81), - // MaxUnhealthyUpgradedInstancePercent: to.Ptr[int32](98), - // PauseTimeBetweenBatches: to.Ptr("aaaaaaaaaaaaaaa"), - // PrioritizeUnhealthyInstances: to.Ptr(true), - // RollbackFailedInstancesOnPolicyBreach: to.Ptr(true), - // }, - // Progress: &armcompute.RollingUpgradeProgressInfo{ - // FailedInstanceCount: to.Ptr[int32](25), - // InProgressInstanceCount: to.Ptr[int32](20), - // PendingInstanceCount: to.Ptr[int32](27), - // SuccessfulInstanceCount: to.Ptr[int32](6), - // }, - // RunningStatus: &armcompute.RollingUpgradeRunningStatus{ - // Code: to.Ptr(armcompute.RollingUpgradeStatusCodeRollingForward), - // LastAction: to.Ptr(armcompute.RollingUpgradeActionTypeStart), - // LastActionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T13:06:23.362Z"); return t}()), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T13:06:23.362Z"); return t}()), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetRollingUpgrade_GetLatest_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetRollingUpgradesClient_GetLatest_virtualMachineScaleSetRollingUpgradeGetLatestMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineScaleSetRollingUpgradesClient().GetLatest(ctx, "rgcompute", "aaaaaaaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RollingUpgradeStatusInfo = armcompute.RollingUpgradeStatusInfo{ - // ID: to.Ptr("aaaaaaaaaa"), - // Location: to.Ptr("aaaaaa"), - // } -} 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 52c8a3ab87bd..000000000000 --- a/sdk/resourcemanager/compute/armcompute/virtualmachinescalesets_client_example_test.go +++ /dev/null @@ -1,10760 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package 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/v5" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualMachineScaleSetsClient().NewListByLocationPager("eastus", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.VirtualMachineScaleSetListResult = armcompute.VirtualMachineScaleSetListResult{ - // Value: []*armcompute.VirtualMachineScaleSet{ - // { - // Name: to.Ptr("{virtualMachineScaleSetName}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "myTag1": to.Ptr("tagValue1"), - // }, - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // DoNotRunExtensionsOnOverprovisionedVMs: to.Ptr(false), - // Overprovision: to.Ptr(false), - // PlatformFaultDomainCount: to.Ptr[int32](1), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(false), - // UpgradePolicy: &armcompute.UpgradePolicy{ - // AutomaticOSUpgradePolicy: &armcompute.AutomaticOSUpgradePolicy{ - // EnableAutomaticOSUpgrade: to.Ptr(false), - // }, - // Mode: to.Ptr(armcompute.UpgradeModeAutomatic), - // }, - // VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - // NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - // NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - // { - // Name: to.Ptr("myNic"), - // Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("myIPConfig"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // Primary: to.Ptr(true), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/myVNet/subnets/mySubnet"), - // }, - // }, - // }}, - // NetworkSecurityGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/myNetworkSecurityGroup"), - // }, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("admin"), - // ComputerNamePrefix: to.Ptr("{virtualMachineScaleSetName}"), - // LinuxConfiguration: &armcompute.LinuxConfiguration{ - // DisablePasswordAuthentication: to.Ptr(false), - // }, - // }, - // StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - // DataDisks: []*armcompute.VirtualMachineScaleSetDataDisk{ - // }, - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("databricks"), - // Publisher: to.Ptr("azuredatabricks"), - // SKU: to.Ptr("databricksworker"), - // Version: to.Ptr("3.15.2"), - // }, - // OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // DiskSizeGB: to.Ptr[int32](30), - // ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesPremiumLRS), - // }, - // }, - // }, - // }, - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Standard_D2s_v3"), - // Capacity: to.Ptr[int64](4), - // Tier: to.Ptr("Standard"), - // }, - // }, - // { - // Name: to.Ptr("{virtualMachineScaleSetName}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}1"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "myTag1": to.Ptr("tagValue2"), - // }, - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // DoNotRunExtensionsOnOverprovisionedVMs: to.Ptr(false), - // Overprovision: to.Ptr(false), - // PlatformFaultDomainCount: to.Ptr[int32](1), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(false), - // UpgradePolicy: &armcompute.UpgradePolicy{ - // AutomaticOSUpgradePolicy: &armcompute.AutomaticOSUpgradePolicy{ - // EnableAutomaticOSUpgrade: to.Ptr(false), - // }, - // Mode: to.Ptr(armcompute.UpgradeModeAutomatic), - // }, - // VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - // NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - // NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - // { - // Name: to.Ptr("myNic1"), - // Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("myIPConfig"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // Primary: to.Ptr(true), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/myVNet/subnets/mySubnet"), - // }, - // }, - // }}, - // NetworkSecurityGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/myNetworkSecurityGroup"), - // }, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("admin"), - // ComputerNamePrefix: to.Ptr("{virtualMachineScaleSetName}"), - // LinuxConfiguration: &armcompute.LinuxConfiguration{ - // DisablePasswordAuthentication: to.Ptr(false), - // }, - // }, - // StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - // DataDisks: []*armcompute.VirtualMachineScaleSetDataDisk{ - // }, - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("databricks"), - // Publisher: to.Ptr("azuredatabricks"), - // SKU: to.Ptr("databricksworker"), - // Version: to.Ptr("3.15.2"), - // }, - // OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // DiskSizeGB: to.Ptr[int32](30), - // ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesPremiumLRS), - // }, - // }, - // }, - // }, - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Standard_D2s_v3"), - // Capacity: to.Ptr[int64](4), - // Tier: to.Ptr("Standard"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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]any{}, - 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"), - }, - }, &armcompute.VirtualMachineScaleSetsClientBeginCreateOrUpdateOptions{IfMatch: nil, - IfNoneMatch: 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // Overprovision: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(true), - // UniqueID: to.Ptr("d053ec5a-8da6-495f-ab13-38216503c6d7"), - // 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://nsgdiagnostic.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]any{ - // }, - // SuppressFailures: to.Ptr(true), - // TypeHandlerVersion: to.Ptr("{handler-version}"), - // }, - // }}, - // }, - // NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - // NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // 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"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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]any{}, - 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"), - }, - }, &armcompute.VirtualMachineScaleSetsClientBeginCreateOrUpdateOptions{IfMatch: nil, - IfNoneMatch: 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // Overprovision: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(true), - // UniqueID: to.Ptr("d053ec5a-8da6-495f-ab13-38216503c6d7"), - // 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://nsgdiagnostic.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]any{ - // }, - // TypeHandlerVersion: to.Ptr("{handler-version}"), - // }, - // }}, - // }, - // NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - // NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // 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"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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"), - }, - }, &armcompute.VirtualMachineScaleSetsClientBeginCreateOrUpdateOptions{IfMatch: nil, - IfNoneMatch: 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // Overprovision: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(true), - // UniqueID: to.Ptr("d6e9ab29-f8c9-4792-978c-ae2c07b98f17"), - // 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{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // 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("https://{existing-storage-account-name}.blob.core.windows.net/system/Microsoft.Compute/Images/vhds/{existing-generalized-os-image-blob-name}.vhd"), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }, - // }, - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Standard_D1_v2"), - // Capacity: to.Ptr[int64](3), - // Tier: to.Ptr("Standard"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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"), - }, - }, &armcompute.VirtualMachineScaleSetsClientBeginCreateOrUpdateOptions{IfMatch: nil, - IfNoneMatch: 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // Overprovision: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(true), - // UniqueID: to.Ptr("77b7df9a-32fe-45e3-8911-60ac9c9b9c64"), - // 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{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // 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}.blob.core.windows.net/vhds")}, - // }, - // }, - // }, - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Standard_D1_v2"), - // Capacity: to.Ptr[int64](3), - // Tier: to.Ptr("Standard"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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"), - }, - }, &armcompute.VirtualMachineScaleSetsClientBeginCreateOrUpdateOptions{IfMatch: nil, - IfNoneMatch: 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // Overprovision: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(true), - // UniqueID: to.Ptr("afa2afa8-9e49-48fb-9d18-c86323b5d064"), - // 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{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // LinuxConfiguration: &armcompute.LinuxConfiguration{ - // DisablePasswordAuthentication: to.Ptr(false), - // }, - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // }, - // StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - // ImageReference: &armcompute.ImageReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/images/nsgcustom"), - // }, - // 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"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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"), - }, - }, &armcompute.VirtualMachineScaleSetsClientBeginCreateOrUpdateOptions{IfMatch: nil, - IfNoneMatch: 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // Overprovision: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(true), - // UniqueID: to.Ptr("afa2afa8-9e49-48fb-9d18-c86323b5d064"), - // 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{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // LinuxConfiguration: &armcompute.LinuxConfiguration{ - // DisablePasswordAuthentication: to.Ptr(false), - // }, - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // }, - // 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"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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"), - }, - }, &armcompute.VirtualMachineScaleSetsClientBeginCreateOrUpdateOptions{IfMatch: nil, - IfNoneMatch: 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // Overprovision: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(true), - // UniqueID: to.Ptr("afa2afa8-9e49-48fb-9d18-c86323b5d064"), - // 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{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // 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"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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"), - }, - }, &armcompute.VirtualMachineScaleSetsClientBeginCreateOrUpdateOptions{IfMatch: nil, - IfNoneMatch: 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // Overprovision: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(true), - // UniqueID: to.Ptr("afa2afa8-9e49-48fb-9d18-c86323b5d064"), - // 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), - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(true), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{nicConfig1-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }, - // { - // Name: to.Ptr("{nicConfig2-name}"), - // Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - // DisableTCPStateTracking: to.Ptr(false), - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableFpga: 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{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // LinuxConfiguration: &armcompute.LinuxConfiguration{ - // DisablePasswordAuthentication: to.Ptr(false), - // }, - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // }, - // StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - // ImageReference: &armcompute.ImageReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/images/nsgcustom"), - // }, - // 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"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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"), - }, - }, &armcompute.VirtualMachineScaleSetsClientBeginCreateOrUpdateOptions{IfMatch: nil, - IfNoneMatch: 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // Overprovision: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(true), - // UniqueID: to.Ptr("ffb27c5c-39a5-4d4e-b307-b32598689813"), - // 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"), - // 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"), - // }, - // { - // 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{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // 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"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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"), - }, - }, &armcompute.VirtualMachineScaleSetsClientBeginCreateOrUpdateOptions{IfMatch: nil, - IfNoneMatch: 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // Overprovision: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(true), - // UniqueID: to.Ptr("d053ec5a-8da6-495f-ab13-38216503c6d7"), - // 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://nsgdiagnostic.blob.core.windows.net"), - // }, - // }, - // 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{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // 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), - // }, - // }, - // }, - // }, - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Standard_D1_v2"), - // Capacity: to.Ptr[int64](3), - // Tier: to.Ptr("Standard"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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"), - }, - }, &armcompute.VirtualMachineScaleSetsClientBeginCreateOrUpdateOptions{IfMatch: nil, - IfNoneMatch: 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // Overprovision: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(true), - // UniqueID: to.Ptr("afa2afa8-9e49-48fb-9d18-c86323b5d064"), - // 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{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // LinuxConfiguration: &armcompute.LinuxConfiguration{ - // DisablePasswordAuthentication: to.Ptr(false), - // }, - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // }, - // 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/nsgcustom"), - // }, - // 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_D1_v2"), - // Capacity: to.Ptr[int64](3), - // Tier: to.Ptr("Standard"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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"), - }, - }, &armcompute.VirtualMachineScaleSetsClientBeginCreateOrUpdateOptions{IfMatch: nil, - IfNoneMatch: 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // Overprovision: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(true), - // UniqueID: to.Ptr("afa2afa8-9e49-48fb-9d18-c86323b5d064"), - // 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{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }, - // { - // Name: to.Ptr("{fpgaNic-Name}"), - // Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableFpga: to.Ptr(true), - // 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{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // LinuxConfiguration: &armcompute.LinuxConfiguration{ - // DisablePasswordAuthentication: to.Ptr(false), - // }, - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // }, - // StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - // ImageReference: &armcompute.ImageReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/images/nsgcustom"), - // }, - // 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"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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"), - }, - }, &armcompute.VirtualMachineScaleSetsClientBeginCreateOrUpdateOptions{IfMatch: nil, - IfNoneMatch: 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("westus"), - // Plan: &armcompute.Plan{ - // Name: to.Ptr("standard-data-science-vm"), - // Product: to.Ptr("standard-data-science-vm"), - // Publisher: to.Ptr("microsoft-ads"), - // }, - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // Overprovision: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(true), - // UniqueID: to.Ptr("b9e23088-6ffc-46e0-9e02-b0a6eeef47db"), - // 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{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // SecurityProfile: &armcompute.SecurityProfile{ - // EncryptionAtHost: to.Ptr(true), - // }, - // StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("standard-data-science-vm"), - // Publisher: to.Ptr("microsoft-ads"), - // SKU: to.Ptr("standard-data-science-vm"), - // 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"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_FromWithNetworkInterfaceWithDnsSettings.json -func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createAScaleSetWithNetworkInterfacesWithPublicIpAddressDnsSettings() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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{ - AuxiliaryMode: to.Ptr(armcompute.NetworkInterfaceAuxiliaryModeAcceleratedConnections), - AuxiliarySKU: to.Ptr(armcompute.NetworkInterfaceAuxiliarySKUA1), - 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), - PublicIPAddressConfiguration: &armcompute.VirtualMachineScaleSetPublicIPAddressConfiguration{ - Name: to.Ptr("publicip"), - Properties: &armcompute.VirtualMachineScaleSetPublicIPAddressConfigurationProperties{ - DNSSettings: &armcompute.VirtualMachineScaleSetPublicIPAddressConfigurationDNSSettings{ - DomainNameLabel: to.Ptr("vmsstestlabel01"), - DomainNameLabelScope: to.Ptr(armcompute.DomainNameLabelScopeTypesNoReuse), - }, - IdleTimeoutInMinutes: to.Ptr[int32](10), - }, - }, - 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"), - }, - }, &armcompute.VirtualMachineScaleSetsClientBeginCreateOrUpdateOptions{IfMatch: nil, - IfNoneMatch: 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // Overprovision: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(true), - // UniqueID: to.Ptr("afa2afa8-9e49-48fb-9d18-c86323b5d064"), - // 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{ - // AuxiliaryMode: to.Ptr(armcompute.NetworkInterfaceAuxiliaryModeAcceleratedConnections), - // AuxiliarySKU: to.Ptr(armcompute.NetworkInterfaceAuxiliarySKUA1), - // DisableTCPStateTracking: to.Ptr(true), - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(true), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{nicConfig1-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // PublicIPAddressConfiguration: &armcompute.VirtualMachineScaleSetPublicIPAddressConfiguration{ - // Name: to.Ptr("publicip"), - // Properties: &armcompute.VirtualMachineScaleSetPublicIPAddressConfigurationProperties{ - // DNSSettings: &armcompute.VirtualMachineScaleSetPublicIPAddressConfigurationDNSSettings{ - // DomainNameLabel: to.Ptr("vmsstestlabel01"), - // DomainNameLabelScope: to.Ptr(armcompute.DomainNameLabelScopeTypesTenantReuse), - // }, - // IdleTimeoutInMinutes: to.Ptr[int32](10), - // }, - // }, - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }, - // { - // Name: to.Ptr("{nicConfig2-name}"), - // Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - // DisableTCPStateTracking: to.Ptr(false), - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableFpga: 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{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // LinuxConfiguration: &armcompute.LinuxConfiguration{ - // DisablePasswordAuthentication: to.Ptr(false), - // }, - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // }, - // StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - // ImageReference: &armcompute.ImageReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/images/nsgcustom"), - // }, - // 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"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithOSImageScheduledEventEnabled.json -func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createAScaleSetWithOsImageScheduledEventsEnabled() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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{ - OSImageNotificationProfile: &armcompute.OSImageNotificationProfile{ - Enable: to.Ptr(true), - NotBeforeTimeout: to.Ptr("PT15M"), - }, - }, - 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"), - }, - }, &armcompute.VirtualMachineScaleSetsClientBeginCreateOrUpdateOptions{IfMatch: nil, - IfNoneMatch: 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // Overprovision: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(true), - // UniqueID: to.Ptr("d053ec5a-8da6-495f-ab13-38216503c6d7"), - // 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{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ScheduledEventsProfile: &armcompute.ScheduledEventsProfile{ - // OSImageNotificationProfile: &armcompute.OSImageNotificationProfile{ - // Enable: to.Ptr(true), - // NotBeforeTimeout: to.Ptr("PT15M"), - // }, - // }, - // 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"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithProxyAgentSettings.json -func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createAScaleSetWithProxyAgentSettingsOfEnabledAndMode() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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{ - ProxyAgentSettings: &armcompute.ProxyAgentSettings{ - Enabled: to.Ptr(true), - Mode: to.Ptr(armcompute.ModeEnforce), - }, - }, - StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("WindowsServer"), - Publisher: to.Ptr("MicrosoftWindowsServer"), - SKU: to.Ptr("2019-Datacenter"), - Version: to.Ptr("latest"), - }, - 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"), - }, - }, &armcompute.VirtualMachineScaleSetsClientBeginCreateOrUpdateOptions{IfMatch: nil, - IfNoneMatch: 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // Overprovision: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(true), - // UniqueID: to.Ptr("b9e23088-6ffc-46e0-9e02-b0a6eeef47db"), - // 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{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // SecurityProfile: &armcompute.SecurityProfile{ - // ProxyAgentSettings: &armcompute.ProxyAgentSettings{ - // Enabled: to.Ptr(true), - // Mode: to.Ptr(armcompute.ModeEnforce), - // }, - // }, - // StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("WindowsServer"), - // Publisher: to.Ptr("MicrosoftWindowsServer"), - // SKU: to.Ptr("2019-Datacenter"), - // Version: to.Ptr("latest"), - // }, - // 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"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithResilientVMCreationPolicy.json -func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createAScaleSetWithResilientVmCreationEnabled() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "{vmss-name}", armcompute.VirtualMachineScaleSet{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineScaleSetProperties{ - Overprovision: to.Ptr(false), - ResiliencyPolicy: &armcompute.ResiliencyPolicy{ - ResilientVMCreationPolicy: &armcompute.ResilientVMCreationPolicy{ - Enabled: 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"), - }, - }, &armcompute.VirtualMachineScaleSetsClientBeginCreateOrUpdateOptions{IfMatch: nil, - IfNoneMatch: 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // Overprovision: to.Ptr(false), - // ProvisioningState: to.Ptr("Succeeded"), - // ResiliencyPolicy: &armcompute.ResiliencyPolicy{ - // ResilientVMCreationPolicy: &armcompute.ResilientVMCreationPolicy{ - // Enabled: to.Ptr(true), - // }, - // }, - // SinglePlacementGroup: to.Ptr(true), - // UniqueID: to.Ptr("d053ec5a-8da6-495f-ab13-38216503c6d7"), - // 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{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // 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"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithResilientVMDeletionPolicy.json -func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createAScaleSetWithResilientVmDeletionEnabled() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "{vmss-name}", armcompute.VirtualMachineScaleSet{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineScaleSetProperties{ - Overprovision: to.Ptr(false), - ResiliencyPolicy: &armcompute.ResiliencyPolicy{ - ResilientVMDeletionPolicy: &armcompute.ResilientVMDeletionPolicy{ - Enabled: 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"), - }, - }, &armcompute.VirtualMachineScaleSetsClientBeginCreateOrUpdateOptions{IfMatch: nil, - IfNoneMatch: 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // Overprovision: to.Ptr(false), - // ProvisioningState: to.Ptr("Succeeded"), - // ResiliencyPolicy: &armcompute.ResiliencyPolicy{ - // ResilientVMDeletionPolicy: &armcompute.ResilientVMDeletionPolicy{ - // Enabled: to.Ptr(true), - // }, - // }, - // SinglePlacementGroup: to.Ptr(true), - // UniqueID: to.Ptr("d053ec5a-8da6-495f-ab13-38216503c6d7"), - // 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{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // 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"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithSecurityPostureReference.json -func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createAScaleSetWithSecurityPostureReference() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "{vmss-name}", armcompute.VirtualMachineScaleSet{ - Location: to.Ptr("eastus2euap"), - Properties: &armcompute.VirtualMachineScaleSetProperties{ - Overprovision: to.Ptr(true), - UpgradePolicy: &armcompute.UpgradePolicy{ - AutomaticOSUpgradePolicy: &armcompute.AutomaticOSUpgradePolicy{ - EnableAutomaticOSUpgrade: to.Ptr(true), - }, - 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}"), - }, - SecurityPostureReference: &armcompute.SecurityPostureReference{ - ID: to.Ptr("/CommunityGalleries/{communityGalleryName}/securityPostures/{securityPostureName}/versions/{major.minor.patch}|{major.*}|latest"), - }, - StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("WindowsServer"), - Publisher: to.Ptr("MicrosoftWindowsServer"), - SKU: to.Ptr("2022-Datacenter"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - Name: to.Ptr("osDisk"), - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - }, - }, - }, - }, - SKU: &armcompute.SKU{ - Name: to.Ptr("Standard_A1"), - Capacity: to.Ptr[int64](3), - Tier: to.Ptr("Standard"), - }, - }, &armcompute.VirtualMachineScaleSetsClientBeginCreateOrUpdateOptions{IfMatch: nil, - IfNoneMatch: 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("eastus2euap"), - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // Overprovision: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(true), - // UniqueID: to.Ptr("d12ccb3d-ab15-4794-9836-c4196392e9f2"), - // UpgradePolicy: &armcompute.UpgradePolicy{ - // AutomaticOSUpgradePolicy: &armcompute.AutomaticOSUpgradePolicy{ - // EnableAutomaticOSUpgrade: to.Ptr(true), - // }, - // Mode: to.Ptr(armcompute.UpgradeModeAutomatic), - // }, - // VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - // NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - // NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // SecurityPostureReference: &armcompute.SecurityPostureReference{ - // ID: to.Ptr("/CommunityGalleries/{communityGalleryName}/securityPostures/{securityPostureName}/versions/{major.minor.patch}|{major.*}|latest"), - // }, - // StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("WindowsServer"), - // Publisher: to.Ptr("MicrosoftWindowsServer"), - // SKU: to.Ptr("2022-Datacenter"), - // Version: to.Ptr("latest"), - // }, - // OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - // Name: to.Ptr("osDisk"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // }, - // }, - // }, - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Standard_A1"), - // Capacity: to.Ptr[int64](3), - // Tier: to.Ptr("Standard"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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"), - }, - }, &armcompute.VirtualMachineScaleSetsClientBeginCreateOrUpdateOptions{IfMatch: nil, - IfNoneMatch: 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // Overprovision: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(true), - // UniqueID: to.Ptr("b9e23088-6ffc-46e0-9e02-b0a6eeef47db"), - // 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{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // 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"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithSecurityTypeConfidentialVMWithNonPersistedTPM.json -func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createAScaleSetWithSecurityTypeAsConfidentialVmAndNonPersistedTpmSecurityEncryptionType() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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(false), - VTpmEnabled: to.Ptr(true), - }, - }, - StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("2022-datacenter-cvm"), - Publisher: to.Ptr("UbuntuServer"), - SKU: to.Ptr("linux-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.SecurityEncryptionTypesNonPersistedTPM), - }, - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardSSDLRS), - }, - }, - }, - }, - }, - SKU: &armcompute.SKU{ - Name: to.Ptr("Standard_DC2es_v5"), - Capacity: to.Ptr[int64](3), - Tier: to.Ptr("Standard"), - }, - }, &armcompute.VirtualMachineScaleSetsClientBeginCreateOrUpdateOptions{IfMatch: nil, - IfNoneMatch: 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // Overprovision: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(true), - // UniqueID: to.Ptr("b9e23088-6ffc-46e0-9e02-b0a6eeef47db"), - // 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{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // SecurityProfile: &armcompute.SecurityProfile{ - // SecurityType: to.Ptr(armcompute.SecurityTypesConfidentialVM), - // UefiSettings: &armcompute.UefiSettings{ - // SecureBootEnabled: to.Ptr(false), - // VTpmEnabled: to.Ptr(true), - // }, - // }, - // StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("2022-datacenter-cvm"), - // Publisher: to.Ptr("UbuntuServer"), - // SKU: to.Ptr("linux-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.SecurityEncryptionTypesNonPersistedTPM), - // }, - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardSSDLRS), - // }, - // }, - // }, - // }, - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Standard_DC2es_v5"), - // Capacity: to.Ptr[int64](3), - // Tier: to.Ptr("Standard"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithServiceArtifactReference.json -func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createAScaleSetWithServiceArtifactReference() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "{vmss-name}", armcompute.VirtualMachineScaleSet{ - Location: to.Ptr("eastus2euap"), - Properties: &armcompute.VirtualMachineScaleSetProperties{ - Overprovision: to.Ptr(true), - UpgradePolicy: &armcompute.UpgradePolicy{ - AutomaticOSUpgradePolicy: &armcompute.AutomaticOSUpgradePolicy{ - EnableAutomaticOSUpgrade: to.Ptr(true), - }, - 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}"), - }, - ServiceArtifactReference: &armcompute.ServiceArtifactReference{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGalleryName/serviceArtifacts/serviceArtifactName/vmArtifactsProfiles/vmArtifactsProfilesName"), - }, - StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("WindowsServer"), - Publisher: to.Ptr("MicrosoftWindowsServer"), - SKU: to.Ptr("2022-Datacenter"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - Name: to.Ptr("osDisk"), - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - }, - }, - }, - }, - SKU: &armcompute.SKU{ - Name: to.Ptr("Standard_A1"), - Capacity: to.Ptr[int64](3), - Tier: to.Ptr("Standard"), - }, - }, &armcompute.VirtualMachineScaleSetsClientBeginCreateOrUpdateOptions{IfMatch: nil, - IfNoneMatch: 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("eastus2euap"), - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // Overprovision: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(true), - // UniqueID: to.Ptr("77b7df9a-32fe-45e3-8911-60ac9c9b9c64"), - // UpgradePolicy: &armcompute.UpgradePolicy{ - // AutomaticOSUpgradePolicy: &armcompute.AutomaticOSUpgradePolicy{ - // EnableAutomaticOSUpgrade: to.Ptr(true), - // }, - // Mode: to.Ptr(armcompute.UpgradeModeAutomatic), - // }, - // VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - // NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - // NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ServiceArtifactReference: &armcompute.ServiceArtifactReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGalleryName/serviceArtifacts/serviceArtifactName/vmArtifactsProfiles/vmArtifactsProfilesName"), - // }, - // StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("WindowsServer"), - // Publisher: to.Ptr("MicrosoftWindowsServer"), - // SKU: to.Ptr("2022-Datacenter"), - // Version: to.Ptr("latest"), - // }, - // OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - // Name: to.Ptr("osDisk"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // }, - // }, - // }, - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Standard_A1"), - // Capacity: to.Ptr[int64](3), - // Tier: to.Ptr("Standard"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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"), - }, - }, &armcompute.VirtualMachineScaleSetsClientBeginCreateOrUpdateOptions{IfMatch: nil, - IfNoneMatch: 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // Overprovision: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(true), - // UniqueID: to.Ptr("b9e23088-6ffc-46e0-9e02-b0a6eeef47db"), - // 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{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // 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"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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"), - }, - }, &armcompute.VirtualMachineScaleSetsClientBeginCreateOrUpdateOptions{IfMatch: nil, - IfNoneMatch: 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("westus"), - // Plan: &armcompute.Plan{ - // Name: to.Ptr("standard-data-science-vm"), - // Product: to.Ptr("standard-data-science-vm"), - // Publisher: to.Ptr("microsoft-ads"), - // }, - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // Overprovision: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(true), - // UniqueID: to.Ptr("b9e23088-6ffc-46e0-9e02-b0a6eeef47db"), - // 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{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("standard-data-science-vm"), - // Publisher: to.Ptr("microsoft-ads"), - // SKU: to.Ptr("standard-data-science-vm"), - // 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"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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"), - }, - }, &armcompute.VirtualMachineScaleSetsClientBeginCreateOrUpdateOptions{IfMatch: nil, - IfNoneMatch: 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // Overprovision: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(true), - // UniqueID: to.Ptr("a0134477-b9d9-484b-b0e3-205c1c089ffa"), - // 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{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // 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/nsgExistingAppGw/backendAddressPools/appGatewayBackendPool"), - // }}, - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // 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"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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"), - }, - }, &armcompute.VirtualMachineScaleSetsClientBeginCreateOrUpdateOptions{IfMatch: nil, - IfNoneMatch: 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // Overprovision: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(true), - // UniqueID: to.Ptr("ec0b21ca-51ec-414b-9323-f236ffc21479"), - // 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{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // 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/myLb/backendAddressPools/lbBackendPool"), - // }}, - // LoadBalancerInboundNatPools: []*armcompute.SubResource{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/loadBalancers/myLb/inboundNatPools/lbNatPool"), - // }}, - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // 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"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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"), - }, - }, &armcompute.VirtualMachineScaleSetsClientBeginCreateOrUpdateOptions{IfMatch: nil, - IfNoneMatch: 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // AutomaticRepairsPolicy: &armcompute.AutomaticRepairsPolicy{ - // Enabled: to.Ptr(true), - // GracePeriod: to.Ptr("PT10M"), - // }, - // Overprovision: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(true), - // UniqueID: to.Ptr("d053ec5a-8da6-495f-ab13-38216503c6d7"), - // 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{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // 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"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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"), - }, - }, &armcompute.VirtualMachineScaleSetsClientBeginCreateOrUpdateOptions{IfMatch: nil, - IfNoneMatch: 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // Overprovision: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(true), - // UniqueID: to.Ptr("d053ec5a-8da6-495f-ab13-38216503c6d7"), - // 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://nsgdiagnostic.blob.core.windows.net"), - // }, - // }, - // NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - // NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // 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"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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"), - }, - }, &armcompute.VirtualMachineScaleSetsClientBeginCreateOrUpdateOptions{IfMatch: nil, - IfNoneMatch: 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // Overprovision: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(true), - // UniqueID: to.Ptr("8042c376-4690-4c47-9fa2-fbdad70e32fa"), - // 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{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - // DataDisks: []*armcompute.VirtualMachineScaleSetDataDisk{ - // { - // Caching: to.Ptr(armcompute.CachingTypesNone), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesEmpty), - // DiskSizeGB: to.Ptr[int32](1023), - // Lun: to.Ptr[int32](0), - // ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // }, - // { - // Caching: to.Ptr(armcompute.CachingTypesNone), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesEmpty), - // DiskSizeGB: to.Ptr[int32](1023), - // Lun: to.Ptr[int32](1), - // ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // }}, - // 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"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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"), - }, - }, &armcompute.VirtualMachineScaleSetsClientBeginCreateOrUpdateOptions{IfMatch: nil, - IfNoneMatch: 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("westus"), - // Plan: &armcompute.Plan{ - // Name: to.Ptr("standard-data-science-vm"), - // Product: to.Ptr("standard-data-science-vm"), - // Publisher: to.Ptr("microsoft-ads"), - // }, - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // Overprovision: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(true), - // UniqueID: to.Ptr("b9e23088-6ffc-46e0-9e02-b0a6eeef47db"), - // 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{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("standard-data-science-vm"), - // Publisher: to.Ptr("microsoft-ads"), - // SKU: to.Ptr("standard-data-science-vm"), - // 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"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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"), - }, - }, &armcompute.VirtualMachineScaleSetsClientBeginCreateOrUpdateOptions{IfMatch: nil, - IfNoneMatch: 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("westus"), - // Plan: &armcompute.Plan{ - // Name: to.Ptr("standard-data-science-vm"), - // Product: to.Ptr("standard-data-science-vm"), - // Publisher: to.Ptr("microsoft-ads"), - // }, - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // Overprovision: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(true), - // UniqueID: to.Ptr("b9e23088-6ffc-46e0-9e02-b0a6eeef47db"), - // 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{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("standard-data-science-vm"), - // Publisher: to.Ptr("microsoft-ads"), - // SKU: to.Ptr("standard-data-science-vm"), - // 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"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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]any{}, - 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"), - }, - }, &armcompute.VirtualMachineScaleSetsClientBeginCreateOrUpdateOptions{IfMatch: nil, - IfNoneMatch: 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // Overprovision: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(true), - // UniqueID: to.Ptr("d053ec5a-8da6-495f-ab13-38216503c6d7"), - // 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://nsgdiagnostic.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]any{ - // }, - // TypeHandlerVersion: to.Ptr("{handler-version}"), - // }, - // }}, - // }, - // NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - // NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // 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"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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"), - }, - }, &armcompute.VirtualMachineScaleSetsClientBeginCreateOrUpdateOptions{IfMatch: nil, - IfNoneMatch: 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // Overprovision: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(true), - // UniqueID: to.Ptr("d053ec5a-8da6-495f-ab13-38216503c6d7"), - // 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{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // 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"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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"), - }, - }, &armcompute.VirtualMachineScaleSetsClientBeginCreateOrUpdateOptions{IfMatch: nil, - IfNoneMatch: 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // Overprovision: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(true), - // UniqueID: to.Ptr("ffb27c5c-39a5-4d4e-b307-b32598689813"), - // 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{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // 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"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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"), - }, - }, &armcompute.VirtualMachineScaleSetsClientBeginCreateOrUpdateOptions{IfMatch: nil, - IfNoneMatch: 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // Overprovision: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(true), - // UniqueID: to.Ptr("19fd38a2-f50a-42c6-9dc7-3f9cf3791225"), - // 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{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // 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_DS1_v2"), - // Capacity: to.Ptr[int64](3), - // Tier: to.Ptr("Standard"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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"), - }, - }, &armcompute.VirtualMachineScaleSetsClientBeginCreateOrUpdateOptions{IfMatch: nil, - IfNoneMatch: 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // 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), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(false), - // UniqueID: to.Ptr("d053ec5a-8da6-495f-ab13-38216503c6d7"), - // 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{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // 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"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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"), - }, - }, &armcompute.VirtualMachineScaleSetsClientBeginCreateOrUpdateOptions{IfMatch: nil, - IfNoneMatch: 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // Overprovision: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // ScaleInPolicy: &armcompute.ScaleInPolicy{ - // ForceDeletion: to.Ptr(true), - // Rules: []*armcompute.VirtualMachineScaleSetScaleInRules{ - // to.Ptr(armcompute.VirtualMachineScaleSetScaleInRulesOldestVM)}, - // }, - // SinglePlacementGroup: to.Ptr(true), - // UniqueID: to.Ptr("d053ec5a-8da6-495f-ab13-38216503c6d7"), - // 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{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // 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"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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"), - }, - }, &armcompute.VirtualMachineScaleSetsClientBeginCreateOrUpdateOptions{IfMatch: nil, - IfNoneMatch: 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // Overprovision: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(true), - // SpotRestorePolicy: &armcompute.SpotRestorePolicy{ - // Enabled: to.Ptr(true), - // RestoreTimeout: to.Ptr("PT1H"), - // }, - // UniqueID: to.Ptr("d053ec5a-8da6-495f-ab13-38216503c6d7"), - // 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{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // 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"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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"), - }, - }, &armcompute.VirtualMachineScaleSetsClientBeginCreateOrUpdateOptions{IfMatch: nil, - IfNoneMatch: 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // Overprovision: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(true), - // UniqueID: to.Ptr("fb73af19-0090-467c-9ced-b00bceab1c45"), - // 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{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // 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"), - // }}, - // }, - // }, - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // }, - // StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("UbuntuServer"), - // Publisher: to.Ptr("Canonical"), - // SKU: to.Ptr("16.04-LTS"), - // 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"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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"), - }, - }, &armcompute.VirtualMachineScaleSetsClientBeginCreateOrUpdateOptions{IfMatch: nil, - IfNoneMatch: 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // Overprovision: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(true), - // UniqueID: to.Ptr("d053ec5a-8da6-495f-ab13-38216503c6d7"), - // 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{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // 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"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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"), - }, - }, &armcompute.VirtualMachineScaleSetsClientBeginCreateOrUpdateOptions{IfMatch: nil, - IfNoneMatch: 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // Overprovision: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(true), - // UniqueID: to.Ptr("d053ec5a-8da6-495f-ab13-38216503c6d7"), - // 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://nsgdiagnostic.blob.core.windows.net"), - // }, - // }, - // NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - // NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // 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"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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")}, - }, &armcompute.VirtualMachineScaleSetsClientBeginCreateOrUpdateOptions{IfMatch: nil, - IfNoneMatch: 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("centralus"), - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // Overprovision: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(false), - // UniqueID: to.Ptr("8042c376-4690-4c47-9fa2-fbdad70e32fa"), - // 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{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - // DataDisks: []*armcompute.VirtualMachineScaleSetDataDisk{ - // { - // Caching: to.Ptr(armcompute.CachingTypesNone), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesEmpty), - // DiskSizeGB: to.Ptr[int32](1023), - // Lun: to.Ptr[int32](0), - // ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // }, - // { - // Caching: to.Ptr(armcompute.CachingTypesNone), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesEmpty), - // DiskSizeGB: to.Ptr[int32](1023), - // Lun: to.Ptr[int32](1), - // ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // }}, - // 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), - // }, - // }, - // }, - // }, - // ZoneBalance: to.Ptr(false), - // }, - // 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")}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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"), - }, - }, &armcompute.VirtualMachineScaleSetsClientBeginCreateOrUpdateOptions{IfMatch: nil, - IfNoneMatch: 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // Overprovision: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(true), - // UniqueID: to.Ptr("d053ec5a-8da6-495f-ab13-38216503c6d7"), - // 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://nsgdiagnostic.blob.core.windows.net"), - // }, - // }, - // 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{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // 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"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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"), - }, - }, &armcompute.VirtualMachineScaleSetsClientBeginCreateOrUpdateOptions{IfMatch: nil, - IfNoneMatch: 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // Overprovision: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(true), - // UniqueID: to.Ptr("d053ec5a-8da6-495f-ab13-38216503c6d7"), - // 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{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // 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"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Update_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_BeginUpdate_virtualMachineScaleSetUpdateMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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), - OSRollingUpgradeDeferral: to.Ptr(true), - }, - Mode: to.Ptr(armcompute.UpgradeModeManual), - RollingUpgradePolicy: &armcompute.RollingUpgradePolicy{ - EnableCrossZoneUpgrade: to.Ptr(true), - MaxBatchInstancePercent: to.Ptr[int32](49), - MaxSurge: to.Ptr(true), - MaxUnhealthyInstancePercent: to.Ptr[int32](81), - MaxUnhealthyUpgradedInstancePercent: to.Ptr[int32](98), - PauseTimeBetweenBatches: to.Ptr("aaaaaaaaaaaaaaa"), - PrioritizeUnhealthyInstances: to.Ptr(true), - RollbackFailedInstancesOnPolicyBreach: 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]any{}, - ProvisionAfterExtensions: []*string{ - to.Ptr("aa")}, - Publisher: to.Ptr("{extension-Publisher}"), - Settings: map[string]any{}, - 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{ - { - 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{ - { - 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"), - }, - }, &armcompute.VirtualMachineScaleSetsClientBeginUpdateOptions{IfMatch: nil, - IfNoneMatch: 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{virtualMachineScaleSetName}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "key8425": to.Ptr("aaa"), - // }, - // ExtendedLocation: &armcompute.ExtendedLocation{ - // Name: to.Ptr("aaaaaaaaaaaaaaaaaaaaa"), - // Type: to.Ptr(armcompute.ExtendedLocationTypesEdgeZone), - // }, - // Identity: &armcompute.VirtualMachineScaleSetIdentity{ - // Type: to.Ptr(armcompute.ResourceIdentityTypeSystemAssigned), - // PrincipalID: to.Ptr("aaaaaaaaaaaaaaa"), - // TenantID: to.Ptr("aaaaaaaaaaaaaaaa"), - // UserAssignedIdentities: map[string]*armcompute.UserAssignedIdentitiesValue{ - // "key3951": &armcompute.UserAssignedIdentitiesValue{ - // ClientID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // PrincipalID: to.Ptr("aaaa"), - // }, - // }, - // }, - // Plan: &armcompute.Plan{ - // Name: to.Ptr("aaaaaaaaaa"), - // Product: to.Ptr("aaaaaaaaaaaaaaaaaaaa"), - // PromotionCode: to.Ptr("aaaaaaaaaaaaaaaaaaaa"), - // Publisher: to.Ptr("aaaaaaaaaaaaaaaaaaaaaa"), - // }, - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // 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), - // HostGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // OrchestrationMode: to.Ptr(armcompute.OrchestrationModeUniform), - // Overprovision: to.Ptr(true), - // PlatformFaultDomainCount: to.Ptr[int32](1), - // ProvisioningState: to.Ptr("Succeeded"), - // 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), - // SpotRestorePolicy: &armcompute.SpotRestorePolicy{ - // Enabled: to.Ptr(true), - // RestoreTimeout: to.Ptr("aaaaaaaaaa"), - // }, - // UniqueID: to.Ptr("aaaaaaaa"), - // UpgradePolicy: &armcompute.UpgradePolicy{ - // AutomaticOSUpgradePolicy: &armcompute.AutomaticOSUpgradePolicy{ - // DisableAutomaticRollback: to.Ptr(true), - // EnableAutomaticOSUpgrade: to.Ptr(true), - // OSRollingUpgradeDeferral: to.Ptr(true), - // }, - // Mode: to.Ptr(armcompute.UpgradeModeManual), - // RollingUpgradePolicy: &armcompute.RollingUpgradePolicy{ - // EnableCrossZoneUpgrade: to.Ptr(true), - // MaxBatchInstancePercent: to.Ptr[int32](49), - // MaxSurge: to.Ptr(true), - // MaxUnhealthyInstancePercent: to.Ptr[int32](81), - // MaxUnhealthyUpgradedInstancePercent: to.Ptr[int32](98), - // PauseTimeBetweenBatches: to.Ptr("aaaaaaaaaaaaaaa"), - // PrioritizeUnhealthyInstances: to.Ptr(true), - // }, - // }, - // VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - // ApplicationProfile: &armcompute.ApplicationProfile{ - // GalleryApplications: []*armcompute.VMGalleryApplication{ - // { - // ConfigurationReference: to.Ptr("aaaaa"), - // Order: to.Ptr[int32](29), - // PackageReferenceID: to.Ptr("aaaaaaaaaa"), - // Tags: to.Ptr("aaaaaaaaaaa"), - // }}, - // }, - // BillingProfile: &armcompute.BillingProfile{ - // MaxPrice: to.Ptr[float64](-1), - // }, - // CapacityReservation: &armcompute.CapacityReservationProfile{ - // CapacityReservationGroup: &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("http://{existing-storage-account-name}.blob.core.windows.net"), - // }, - // }, - // EvictionPolicy: to.Ptr(armcompute.VirtualMachineEvictionPolicyTypesDeallocate), - // ExtensionProfile: &armcompute.VirtualMachineScaleSetExtensionProfile{ - // ExtensionsTimeBudget: to.Ptr("PT1H20M"), - // Extensions: []*armcompute.VirtualMachineScaleSetExtension{ - // { - // ID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaa"), - // Name: to.Ptr("{extension-name}"), - // Type: to.Ptr("aaaaa"), - // Properties: &armcompute.VirtualMachineScaleSetExtensionProperties{ - // Type: to.Ptr("{extension-Type}"), - // AutoUpgradeMinorVersion: to.Ptr(true), - // EnableAutomaticUpgrade: to.Ptr(true), - // ForceUpdateTag: to.Ptr("aaaaaaaaa"), - // ProtectedSettings: map[string]any{ - // }, - // ProvisionAfterExtensions: []*string{ - // to.Ptr("aa")}, - // ProvisioningState: to.Ptr("Succeeded"), - // Publisher: to.Ptr("{extension-Publisher}"), - // Settings: map[string]any{ - // }, - // SuppressFailures: to.Ptr(true), - // TypeHandlerVersion: to.Ptr("{handler-version}"), - // }, - // }}, - // }, - // LicenseType: to.Ptr("aaaaaaaaaaaa"), - // NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - // HealthProbe: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/disk123"), - // }, - // NetworkAPIVersion: to.Ptr(armcompute.NetworkAPIVersionTwoThousandTwenty1101), - // NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - // { - // Name: to.Ptr("aaaaaaaa"), - // Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - // DeleteOption: to.Ptr(armcompute.DeleteOptionsDelete), - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // to.Ptr("aaaaaaaaaaaa")}, - // }, - // EnableAcceleratedNetworking: to.Ptr(true), - // EnableFpga: to.Ptr(true), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // 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.VirtualMachineScaleSetPublicIPAddressConfiguration{ - // Name: to.Ptr("a"), - // Properties: &armcompute.VirtualMachineScaleSetPublicIPAddressConfigurationProperties{ - // DeleteOption: to.Ptr(armcompute.DeleteOptionsDelete), - // DNSSettings: &armcompute.VirtualMachineScaleSetPublicIPAddressConfigurationDNSSettings{ - // DomainNameLabel: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // }, - // IdleTimeoutInMinutes: to.Ptr[int32](3), - // 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.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.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // 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), - // }}, - // }, - // }, - // }, - // Priority: to.Ptr(armcompute.VirtualMachinePriorityTypesRegular), - // 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.VirtualMachineScaleSetStorageProfile{ - // 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"), - // ExactVersion: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // Offer: to.Ptr("WindowsServer"), - // Publisher: to.Ptr("MicrosoftWindowsServer"), - // SharedGalleryImageID: to.Ptr("aaaaaa"), - // SKU: to.Ptr("2016-Datacenter"), - // Version: to.Ptr("latest"), - // }, - // OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - // Name: to.Ptr("aaaaaaaaaaaaaaa"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // DiffDiskSettings: &armcompute.DiffDiskSettings{ - // Option: to.Ptr(armcompute.DiffDiskOptionsLocal), - // Placement: to.Ptr(armcompute.DiffDiskPlacementCacheDisk), - // }, - // 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), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // VhdContainers: []*string{ - // to.Ptr("aa")}, - // WriteAcceleratorEnabled: to.Ptr(true), - // }, - // }, - // UserData: to.Ptr("aaaaaaaaaaaaa"), - // }, - // ZoneBalance: to.Ptr(true), - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Standard_D1_v2"), - // Capacity: to.Ptr[int64](3), - // Tier: to.Ptr("Standard"), - // }, - // Zones: []*string{ - // to.Ptr("aaaaaaaaaaaaaaaaaaaa")}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Update_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_BeginUpdate_virtualMachineScaleSetUpdateMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().BeginUpdate(ctx, "rgcompute", "aaaaaaaaaaaaaa", armcompute.VirtualMachineScaleSetUpdate{}, &armcompute.VirtualMachineScaleSetsClientBeginUpdateOptions{IfMatch: nil, - IfNoneMatch: 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Location: to.Ptr("westus"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineScaleSetsClient().Get(ctx, "myResourceGroup", "myVirtualMachineScaleSet", &armcompute.VirtualMachineScaleSetsClientGetOptions{Expand: to.Ptr(armcompute.ExpandTypesForGetVMScaleSetsUserData)}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("myVirtualMachineScaleSet"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/myVirtualMachineScaleSet"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "myTag1": to.Ptr("tagValue1"), - // }, - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // DoNotRunExtensionsOnOverprovisionedVMs: to.Ptr(false), - // HostGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/hostGroups/myHostGroup"), - // }, - // Overprovision: to.Ptr(false), - // PlatformFaultDomainCount: to.Ptr[int32](1), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(false), - // UpgradePolicy: &armcompute.UpgradePolicy{ - // AutomaticOSUpgradePolicy: &armcompute.AutomaticOSUpgradePolicy{ - // EnableAutomaticOSUpgrade: to.Ptr(false), - // }, - // Mode: to.Ptr(armcompute.UpgradeModeAutomatic), - // }, - // VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - // ApplicationProfile: &armcompute.ApplicationProfile{ - // GalleryApplications: []*armcompute.VMGalleryApplication{ - // { - // ConfigurationReference: to.Ptr("https://mystorageaccount.blob.core.windows.net/configurations/settings.config"), - // 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"), - // }, - // { - // 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("myNic"), - // Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("myIPConfig"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // Primary: to.Ptr(true), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/myVNet/subnets/mySubnet"), - // }, - // }, - // }}, - // NetworkSecurityGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkSecurityGroups/myNetworkSecurityGroup"), - // }, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("admin"), - // ComputerNamePrefix: to.Ptr("myVirtualMachineScaleSet"), - // LinuxConfiguration: &armcompute.LinuxConfiguration{ - // DisablePasswordAuthentication: to.Ptr(false), - // }, - // }, - // StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - // DataDisks: []*armcompute.VirtualMachineScaleSetDataDisk{ - // }, - // DiskControllerType: to.Ptr("NVMe"), - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("databricks"), - // Publisher: to.Ptr("azuredatabricks"), - // SKU: to.Ptr("databricksworker"), - // Version: to.Ptr("3.15.2"), - // }, - // OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // DiskSizeGB: to.Ptr[int32](30), - // ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesPremiumLRS), - // }, - // }, - // }, - // UserData: to.Ptr("RXhhbXBsZSBVc2VyRGF0YQ=="), - // }, - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Standard_D2s_v3"), - // Capacity: to.Ptr[int64](4), - // Tier: to.Ptr("Standard"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineScaleSetsClient().Get(ctx, "myResourceGroup", "myVirtualMachineScaleSet", &armcompute.VirtualMachineScaleSetsClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("myVirtualMachineScaleSet"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/myVirtualMachineScaleSet"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "myTag1": to.Ptr("tagValue1"), - // }, - // Etag: to.Ptr("\"1\""), - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // DoNotRunExtensionsOnOverprovisionedVMs: to.Ptr(false), - // HostGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/hostGroups/myHostGroup"), - // }, - // Overprovision: to.Ptr(false), - // PlatformFaultDomainCount: to.Ptr[int32](1), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(false), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-27T01:02:38.313Z"); return t}()), - // UpgradePolicy: &armcompute.UpgradePolicy{ - // AutomaticOSUpgradePolicy: &armcompute.AutomaticOSUpgradePolicy{ - // EnableAutomaticOSUpgrade: to.Ptr(false), - // }, - // Mode: to.Ptr(armcompute.UpgradeModeAutomatic), - // }, - // VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - // ApplicationProfile: &armcompute.ApplicationProfile{ - // GalleryApplications: []*armcompute.VMGalleryApplication{ - // { - // ConfigurationReference: to.Ptr("https://mystorageaccount.blob.core.windows.net/configurations/settings.config"), - // 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"), - // }, - // { - // 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("myNic"), - // Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("myIPConfig"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // Primary: to.Ptr(true), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/myVNet/subnets/mySubnet"), - // }, - // }, - // }}, - // NetworkSecurityGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkSecurityGroups/myNetworkSecurityGroup"), - // }, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("admin"), - // ComputerNamePrefix: to.Ptr("myVirtualMachineScaleSet"), - // LinuxConfiguration: &armcompute.LinuxConfiguration{ - // DisablePasswordAuthentication: to.Ptr(false), - // }, - // }, - // StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - // DataDisks: []*armcompute.VirtualMachineScaleSetDataDisk{ - // }, - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("databricks"), - // Publisher: to.Ptr("azuredatabricks"), - // SKU: to.Ptr("databricksworker"), - // Version: to.Ptr("3.15.2"), - // }, - // OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // DiskSizeGB: to.Ptr[int32](30), - // ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesPremiumLRS), - // }, - // }, - // }, - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-09-27T01:03:40.313Z"); return t}()), - // UserData: to.Ptr("RXhhbXBsZSBVc2VyRGF0YQ=="), - // }, - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Standard_D2s_v3"), - // Capacity: to.Ptr[int64](4), - // Tier: to.Ptr("Standard"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineScaleSetsClient().Get(ctx, "myResourceGroup", "myVirtualMachineScaleSet", &armcompute.VirtualMachineScaleSetsClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("myVirtualMachineScaleSet"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/myVirtualMachineScaleSet"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "myTag1": to.Ptr("tagValue1"), - // }, - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // DoNotRunExtensionsOnOverprovisionedVMs: to.Ptr(false), - // HostGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/hostGroups/myHostGroup"), - // }, - // Overprovision: to.Ptr(false), - // PlatformFaultDomainCount: to.Ptr[int32](1), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(false), - // UpgradePolicy: &armcompute.UpgradePolicy{ - // AutomaticOSUpgradePolicy: &armcompute.AutomaticOSUpgradePolicy{ - // EnableAutomaticOSUpgrade: to.Ptr(false), - // }, - // Mode: to.Ptr(armcompute.UpgradeModeAutomatic), - // }, - // VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - // NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - // NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - // { - // Name: to.Ptr("myNic"), - // Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("myIPConfig"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // Primary: to.Ptr(true), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/myVNet/subnets/mySubnet"), - // }, - // }, - // }}, - // NetworkSecurityGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkSecurityGroups/myNetworkSecurityGroup"), - // }, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("admin"), - // ComputerNamePrefix: to.Ptr("myVirtualMachineScaleSet"), - // LinuxConfiguration: &armcompute.LinuxConfiguration{ - // DisablePasswordAuthentication: to.Ptr(false), - // }, - // }, - // StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - // DataDisks: []*armcompute.VirtualMachineScaleSetDataDisk{ - // }, - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("databricks"), - // Publisher: to.Ptr("azuredatabricks"), - // SKU: to.Ptr("databricksworker"), - // Version: to.Ptr("3.15.2"), - // }, - // OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // DiskSizeGB: to.Ptr[int32](30), - // ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesPremiumLRS), - // }, - // }, - // }, - // }, - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Standard_D2s_v3"), - // Capacity: to.Ptr[int64](4), - // Tier: to.Ptr("Standard"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineScaleSetsClient().Get(ctx, "myResourceGroup", "myVirtualMachineScaleSet", &armcompute.VirtualMachineScaleSetsClientGetOptions{Expand: to.Ptr(armcompute.ExpandTypesForGetVMScaleSetsUserData)}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("myVirtualMachineScaleSet"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/myVirtualMachineScaleSet"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "myTag1": to.Ptr("tagValue1"), - // }, - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // DoNotRunExtensionsOnOverprovisionedVMs: to.Ptr(false), - // HostGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/hostGroups/myHostGroup"), - // }, - // Overprovision: to.Ptr(false), - // PlatformFaultDomainCount: to.Ptr[int32](1), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(false), - // UpgradePolicy: &armcompute.UpgradePolicy{ - // AutomaticOSUpgradePolicy: &armcompute.AutomaticOSUpgradePolicy{ - // EnableAutomaticOSUpgrade: to.Ptr(false), - // }, - // Mode: to.Ptr(armcompute.UpgradeModeAutomatic), - // }, - // VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - // ApplicationProfile: &armcompute.ApplicationProfile{ - // GalleryApplications: []*armcompute.VMGalleryApplication{ - // { - // ConfigurationReference: to.Ptr("https://mystorageaccount.blob.core.windows.net/configurations/settings.config"), - // 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"), - // }, - // { - // 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("myNic"), - // Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("myIPConfig"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // Primary: to.Ptr(true), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/myVNet/subnets/mySubnet"), - // }, - // }, - // }}, - // NetworkSecurityGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkSecurityGroups/myNetworkSecurityGroup"), - // }, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("admin"), - // ComputerNamePrefix: to.Ptr("myVirtualMachineScaleSet"), - // LinuxConfiguration: &armcompute.LinuxConfiguration{ - // DisablePasswordAuthentication: to.Ptr(false), - // }, - // }, - // StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - // DataDisks: []*armcompute.VirtualMachineScaleSetDataDisk{ - // }, - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("databricks"), - // Publisher: to.Ptr("azuredatabricks"), - // SKU: to.Ptr("databricksworker"), - // Version: to.Ptr("3.15.2"), - // }, - // OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // DiskSizeGB: to.Ptr[int32](30), - // ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesPremiumLRS), - // }, - // }, - // }, - // UserData: to.Ptr("RXhhbXBsZSBVc2VyRGF0YQ=="), - // }, - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Standard_D2s_v3"), - // Capacity: to.Ptr[int64](4), - // Tier: to.Ptr("Standard"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Deallocate_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_BeginDeallocate_virtualMachineScaleSetDeallocateMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().BeginDeallocate(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaaaaa", &armcompute.VirtualMachineScaleSetsClientBeginDeallocateOptions{Hibernate: 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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Deallocate_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_BeginDeallocate_virtualMachineScaleSetDeallocateMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().BeginDeallocate(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaa", &armcompute.VirtualMachineScaleSetsClientBeginDeallocateOptions{Hibernate: 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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_DeleteInstances_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_BeginDeleteInstances_virtualMachineScaleSetDeleteInstancesMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_DeleteInstances_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_BeginDeleteInstances_virtualMachineScaleSetDeleteInstancesMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_GetInstanceView_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_GetInstanceView_virtualMachineScaleSetGetInstanceViewMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineScaleSetsClient().GetInstanceView(ctx, "rgcompute", "aaaaaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSetInstanceView = armcompute.VirtualMachineScaleSetInstanceView{ - // OrchestrationServices: []*armcompute.OrchestrationServiceSummary{ - // { - // ServiceName: to.Ptr(armcompute.OrchestrationServiceNamesAutomaticRepairs), - // ServiceState: to.Ptr(armcompute.OrchestrationServiceStateNotRunning), - // }}, - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("ProvisioningState/succeeded"), - // DisplayStatus: to.Ptr("Provisioning succeeded"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.526Z"); return t}()), - // }}, - // VirtualMachine: &armcompute.VirtualMachineScaleSetInstanceViewStatusesSummary{ - // StatusesSummary: []*armcompute.VirtualMachineStatusCodeCount{ - // { - // Code: to.Ptr("aa"), - // Count: to.Ptr[int32](21), - // }}, - // }, - // Extensions: []*armcompute.VirtualMachineScaleSetVMExtensionsSummary{ - // { - // Name: to.Ptr("aaaaaaaaaaa"), - // StatusesSummary: []*armcompute.VirtualMachineStatusCodeCount{ - // { - // Code: to.Ptr("aa"), - // Count: to.Ptr[int32](21), - // }}, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_GetInstanceView_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_GetInstanceView_virtualMachineScaleSetGetInstanceViewMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineScaleSetsClient().GetInstanceView(ctx, "rgcompute", "aaaaaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSetInstanceView = armcompute.VirtualMachineScaleSetInstanceView{ - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_List_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_NewListPager_virtualMachineScaleSetListMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualMachineScaleSetsClient().NewListPager("rgcompute", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.VirtualMachineScaleSetListResult = armcompute.VirtualMachineScaleSetListResult{ - // Value: []*armcompute.VirtualMachineScaleSet{ - // { - // Name: to.Ptr("{virtualMachineScaleSetName}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // ExtendedLocation: &armcompute.ExtendedLocation{ - // Name: to.Ptr("aaaaaaaaaaaaaaaaaaaaa"), - // Type: to.Ptr(armcompute.ExtendedLocationTypesEdgeZone), - // }, - // Identity: &armcompute.VirtualMachineScaleSetIdentity{ - // Type: to.Ptr(armcompute.ResourceIdentityTypeSystemAssigned), - // PrincipalID: to.Ptr("aaaaaaaaaaaaaaa"), - // TenantID: to.Ptr("aaaaaaaaaaaaaaaa"), - // UserAssignedIdentities: map[string]*armcompute.UserAssignedIdentitiesValue{ - // "key3951": &armcompute.UserAssignedIdentitiesValue{ - // ClientID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // PrincipalID: to.Ptr("aaaa"), - // }, - // }, - // }, - // Plan: &armcompute.Plan{ - // Name: to.Ptr("aaaaaaaaaa"), - // Product: to.Ptr("aaaaaaaaaaaaaaaaaaaa"), - // PromotionCode: to.Ptr("aaaaaaaaaaaaaaaaaaaa"), - // Publisher: to.Ptr("aaaaaaaaaaaaaaaaaaaaaa"), - // }, - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // AdditionalCapabilities: &armcompute.AdditionalCapabilities{ - // HibernationEnabled: to.Ptr(true), - // UltraSSDEnabled: to.Ptr(true), - // }, - // AutomaticRepairsPolicy: &armcompute.AutomaticRepairsPolicy{ - // Enabled: to.Ptr(true), - // GracePeriod: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaa"), - // }, - // DoNotRunExtensionsOnOverprovisionedVMs: to.Ptr(true), - // HostGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // OrchestrationMode: to.Ptr(armcompute.OrchestrationModeUniform), - // Overprovision: to.Ptr(true), - // PlatformFaultDomainCount: to.Ptr[int32](1), - // ProvisioningState: to.Ptr("Succeeded"), - // ProximityPlacementGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // ScaleInPolicy: &armcompute.ScaleInPolicy{ - // ForceDeletion: to.Ptr(true), - // Rules: []*armcompute.VirtualMachineScaleSetScaleInRules{ - // to.Ptr(armcompute.VirtualMachineScaleSetScaleInRulesDefault)}, - // }, - // SinglePlacementGroup: to.Ptr(true), - // SpotRestorePolicy: &armcompute.SpotRestorePolicy{ - // Enabled: to.Ptr(true), - // RestoreTimeout: to.Ptr("aaaaaaaaaa"), - // }, - // UniqueID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"), - // UpgradePolicy: &armcompute.UpgradePolicy{ - // AutomaticOSUpgradePolicy: &armcompute.AutomaticOSUpgradePolicy{ - // DisableAutomaticRollback: to.Ptr(true), - // EnableAutomaticOSUpgrade: to.Ptr(true), - // OSRollingUpgradeDeferral: to.Ptr(true), - // UseRollingUpgradePolicy: to.Ptr(true), - // }, - // Mode: to.Ptr(armcompute.UpgradeModeAutomatic), - // RollingUpgradePolicy: &armcompute.RollingUpgradePolicy{ - // EnableCrossZoneUpgrade: to.Ptr(true), - // MaxBatchInstancePercent: to.Ptr[int32](49), - // MaxSurge: to.Ptr(true), - // MaxUnhealthyInstancePercent: to.Ptr[int32](81), - // MaxUnhealthyUpgradedInstancePercent: to.Ptr[int32](98), - // PauseTimeBetweenBatches: to.Ptr("aaaaaaaaaaaaaaa"), - // PrioritizeUnhealthyInstances: to.Ptr(true), - // RollbackFailedInstancesOnPolicyBreach: to.Ptr(true), - // }, - // }, - // VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - // ApplicationProfile: &armcompute.ApplicationProfile{ - // GalleryApplications: []*armcompute.VMGalleryApplication{ - // { - // ConfigurationReference: to.Ptr("aaaaa"), - // Order: to.Ptr[int32](29), - // PackageReferenceID: to.Ptr("aaaaaaaaaa"), - // Tags: to.Ptr("aaaaaaaaaaa"), - // }}, - // }, - // BillingProfile: &armcompute.BillingProfile{ - // MaxPrice: to.Ptr[float64](4), - // }, - // CapacityReservation: &armcompute.CapacityReservationProfile{ - // CapacityReservationGroup: &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("aaaaaaaaaaaaaaaaaaa"), - // }, - // }, - // EvictionPolicy: to.Ptr(armcompute.VirtualMachineEvictionPolicyTypesDeallocate), - // ExtensionProfile: &armcompute.VirtualMachineScaleSetExtensionProfile{ - // ExtensionsTimeBudget: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaa"), - // Extensions: []*armcompute.VirtualMachineScaleSetExtension{ - // { - // ID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaa"), - // Name: to.Ptr("aa"), - // Type: to.Ptr("aaaaa"), - // Properties: &armcompute.VirtualMachineScaleSetExtensionProperties{ - // Type: to.Ptr("aaaaaaaa"), - // AutoUpgradeMinorVersion: to.Ptr(true), - // EnableAutomaticUpgrade: to.Ptr(true), - // ForceUpdateTag: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // ProtectedSettings: map[string]any{ - // }, - // ProvisionAfterExtensions: []*string{ - // to.Ptr("aaaaaaaaaaaaaa")}, - // ProvisioningState: to.Ptr("Succeeded"), - // Publisher: to.Ptr("aaaaaaaaaaaaa"), - // Settings: map[string]any{ - // }, - // SuppressFailures: to.Ptr(true), - // TypeHandlerVersion: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // }, - // }}, - // }, - // LicenseType: to.Ptr("aaaa"), - // NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - // HealthProbe: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/restorePointCollections/rpcName/restorePoints/restorePointName/diskRestorePoints/testingexcludedisk_OsDisk_1_74cdaedcea50483d9833c96adefa100f_22b4bdfe-6c54-4f72-84d8-85d8860f0c57"), - // }, - // NetworkAPIVersion: to.Ptr(armcompute.NetworkAPIVersionTwoThousandTwenty1101), - // NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - // { - // Name: to.Ptr("myNic"), - // Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - // DeleteOption: to.Ptr(armcompute.DeleteOptionsDelete), - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // to.Ptr("aaaaaaaaaaaa")}, - // }, - // EnableAcceleratedNetworking: to.Ptr(true), - // EnableFpga: to.Ptr(true), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("myIPConfig"), - // 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/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/myVNet/subnets/mySubnet"), - // }, - // }, - // }}, - // NetworkSecurityGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/myNetworkSecurityGroup"), - // }, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("admin"), - // ComputerNamePrefix: to.Ptr("{virtualMachineScaleSetName}"), - // CustomData: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // 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"), - // }}, - // }, - // }, - // 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), - // EnableHotpatching: to.Ptr(true), - // PatchMode: to.Ptr(armcompute.WindowsVMGuestPatchModeManual), - // }, - // ProvisionVMAgent: to.Ptr(true), - // TimeZone: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // WinRM: &armcompute.WinRMConfiguration{ - // Listeners: []*armcompute.WinRMListener{ - // { - // CertificateURL: to.Ptr("aaaaaaaaaaaaaaaaaaaaaa"), - // Protocol: to.Ptr(armcompute.ProtocolTypesHTTP), - // }}, - // }, - // }, - // }, - // Priority: to.Ptr(armcompute.VirtualMachinePriorityTypesRegular), - // ScheduledEventsProfile: &armcompute.ScheduledEventsProfile{ - // TerminateNotificationProfile: &armcompute.TerminateNotificationProfile{ - // Enable: to.Ptr(true), - // NotBeforeTimeout: to.Ptr("aa"), - // }, - // }, - // 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.VirtualMachineScaleSetStorageProfile{ - // DataDisks: []*armcompute.VirtualMachineScaleSetDataDisk{ - // }, - // ImageReference: &armcompute.ImageReference{ - // ID: to.Ptr("aaaaaaaaaa"), - // ExactVersion: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"), - // Offer: to.Ptr("databricks"), - // Publisher: to.Ptr("azuredatabricks"), - // SharedGalleryImageID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaa"), - // SKU: to.Ptr("databricksworker"), - // Version: to.Ptr("3.15.2"), - // }, - // OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - // Name: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // DiffDiskSettings: &armcompute.DiffDiskSettings{ - // Option: to.Ptr(armcompute.DiffDiskOptionsLocal), - // Placement: to.Ptr(armcompute.DiffDiskPlacementCacheDisk), - // }, - // DiskSizeGB: to.Ptr[int32](30), - // Image: &armcompute.VirtualHardDisk{ - // URI: to.Ptr("https://{storageAccountName}.blob.core.windows.net/{containerName}/{vhdName}.vhd"), - // }, - // ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - // DiskEncryptionSet: &armcompute.DiskEncryptionSetParameters{ - // ID: to.Ptr("aaaaaaaaaaaa"), - // }, - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesPremiumLRS), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // VhdContainers: []*string{ - // to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa")}, - // WriteAcceleratorEnabled: to.Ptr(true), - // }, - // }, - // UserData: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaa"), - // }, - // ZoneBalance: to.Ptr(true), - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Standard_D2s_v3"), - // Capacity: to.Ptr[int64](4), - // Tier: to.Ptr("Standard"), - // }, - // Zones: []*string{ - // to.Ptr("aaaaaaa")}, - // }, - // { - // Name: to.Ptr("{virtualMachineScaleSetName}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}1"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // ExtendedLocation: &armcompute.ExtendedLocation{ - // Name: to.Ptr("aaaaaaaaaaaaaaaaaaaaa"), - // Type: to.Ptr(armcompute.ExtendedLocationTypesEdgeZone), - // }, - // Identity: &armcompute.VirtualMachineScaleSetIdentity{ - // Type: to.Ptr(armcompute.ResourceIdentityTypeSystemAssigned), - // PrincipalID: to.Ptr("aaaaaaaaaaaaaaa"), - // TenantID: to.Ptr("aaaaaaaaaaaaaaaa"), - // UserAssignedIdentities: map[string]*armcompute.UserAssignedIdentitiesValue{ - // "key3951": &armcompute.UserAssignedIdentitiesValue{ - // ClientID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // PrincipalID: to.Ptr("aaaa"), - // }, - // }, - // }, - // Plan: &armcompute.Plan{ - // Name: to.Ptr("aaaaaaaaaa"), - // Product: to.Ptr("aaaaaaaaaaaaaaaaaaaa"), - // PromotionCode: to.Ptr("aaaaaaaaaaaaaaaaaaaa"), - // Publisher: to.Ptr("aaaaaaaaaaaaaaaaaaaaaa"), - // }, - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // AdditionalCapabilities: &armcompute.AdditionalCapabilities{ - // HibernationEnabled: to.Ptr(true), - // UltraSSDEnabled: to.Ptr(true), - // }, - // AutomaticRepairsPolicy: &armcompute.AutomaticRepairsPolicy{ - // Enabled: to.Ptr(true), - // GracePeriod: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaa"), - // }, - // DoNotRunExtensionsOnOverprovisionedVMs: to.Ptr(true), - // HostGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // OrchestrationMode: to.Ptr(armcompute.OrchestrationModeUniform), - // Overprovision: to.Ptr(true), - // PlatformFaultDomainCount: to.Ptr[int32](1), - // ProvisioningState: to.Ptr("Succeeded"), - // ProximityPlacementGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // ScaleInPolicy: &armcompute.ScaleInPolicy{ - // ForceDeletion: to.Ptr(true), - // Rules: []*armcompute.VirtualMachineScaleSetScaleInRules{ - // to.Ptr(armcompute.VirtualMachineScaleSetScaleInRulesDefault)}, - // }, - // SinglePlacementGroup: to.Ptr(true), - // SpotRestorePolicy: &armcompute.SpotRestorePolicy{ - // Enabled: to.Ptr(true), - // RestoreTimeout: to.Ptr("aaaaaaaaaa"), - // }, - // UniqueID: to.Ptr("aaaaa"), - // UpgradePolicy: &armcompute.UpgradePolicy{ - // AutomaticOSUpgradePolicy: &armcompute.AutomaticOSUpgradePolicy{ - // DisableAutomaticRollback: to.Ptr(true), - // EnableAutomaticOSUpgrade: to.Ptr(true), - // OSRollingUpgradeDeferral: to.Ptr(true), - // UseRollingUpgradePolicy: to.Ptr(true), - // }, - // Mode: to.Ptr(armcompute.UpgradeModeAutomatic), - // RollingUpgradePolicy: &armcompute.RollingUpgradePolicy{ - // EnableCrossZoneUpgrade: to.Ptr(true), - // MaxBatchInstancePercent: to.Ptr[int32](49), - // MaxSurge: to.Ptr(true), - // MaxUnhealthyInstancePercent: to.Ptr[int32](81), - // MaxUnhealthyUpgradedInstancePercent: to.Ptr[int32](98), - // PauseTimeBetweenBatches: to.Ptr("aaaaaaaaaaaaaaa"), - // PrioritizeUnhealthyInstances: to.Ptr(true), - // }, - // }, - // VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - // ApplicationProfile: &armcompute.ApplicationProfile{ - // GalleryApplications: []*armcompute.VMGalleryApplication{ - // { - // ConfigurationReference: to.Ptr("aaaaa"), - // Order: to.Ptr[int32](29), - // PackageReferenceID: to.Ptr("aaaaaaaaaa"), - // Tags: to.Ptr("aaaaaaaaaaa"), - // }}, - // }, - // BillingProfile: &armcompute.BillingProfile{ - // MaxPrice: to.Ptr[float64](4), - // }, - // CapacityReservation: &armcompute.CapacityReservationProfile{ - // CapacityReservationGroup: &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("aaaaaaaaaaaaaaaaaaa"), - // }, - // }, - // EvictionPolicy: to.Ptr(armcompute.VirtualMachineEvictionPolicyTypesDeallocate), - // ExtensionProfile: &armcompute.VirtualMachineScaleSetExtensionProfile{ - // ExtensionsTimeBudget: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaa"), - // Extensions: []*armcompute.VirtualMachineScaleSetExtension{ - // { - // ID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaa"), - // Name: to.Ptr("aa"), - // Type: to.Ptr("aaaaa"), - // Properties: &armcompute.VirtualMachineScaleSetExtensionProperties{ - // Type: to.Ptr("aaaaaaaa"), - // AutoUpgradeMinorVersion: to.Ptr(true), - // EnableAutomaticUpgrade: to.Ptr(true), - // ForceUpdateTag: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // ProtectedSettings: map[string]any{ - // }, - // ProvisionAfterExtensions: []*string{ - // to.Ptr("aaaaaaaaaaaaaa")}, - // ProvisioningState: to.Ptr("Succeeded"), - // Publisher: to.Ptr("aaaaaaaaaaaaa"), - // Settings: map[string]any{ - // }, - // SuppressFailures: to.Ptr(true), - // TypeHandlerVersion: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // }, - // }}, - // }, - // LicenseType: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"), - // NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - // HealthProbe: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/restorePointCollections/rpcName/restorePoints/restorePointName/diskRestorePoints/testingexcludedisk_OsDisk_1_74cdaedcea50483d9833c96adefa100f_22b4bdfe-6c54-4f72-84d8-85d8860f0c57"), - // }, - // NetworkAPIVersion: to.Ptr(armcompute.NetworkAPIVersionTwoThousandTwenty1101), - // NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - // { - // Name: to.Ptr("myNic1"), - // Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - // DeleteOption: to.Ptr(armcompute.DeleteOptionsDelete), - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // to.Ptr("aaaaaaaaaaaa")}, - // }, - // EnableAcceleratedNetworking: to.Ptr(true), - // EnableFpga: to.Ptr(true), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("myIPConfig"), - // 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/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/myVNet/subnets/mySubnet"), - // }, - // }, - // }}, - // NetworkSecurityGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/myNetworkSecurityGroup"), - // }, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("admin"), - // ComputerNamePrefix: to.Ptr("{virtualMachineScaleSetName}"), - // CustomData: to.Ptr("a"), - // 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"), - // }}, - // }, - // }, - // 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), - // EnableHotpatching: to.Ptr(true), - // PatchMode: to.Ptr(armcompute.WindowsVMGuestPatchModeManual), - // }, - // ProvisionVMAgent: to.Ptr(true), - // TimeZone: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // WinRM: &armcompute.WinRMConfiguration{ - // Listeners: []*armcompute.WinRMListener{ - // { - // CertificateURL: to.Ptr("aaaaaaaaaaaaaaaaaaaaaa"), - // Protocol: to.Ptr(armcompute.ProtocolTypesHTTP), - // }}, - // }, - // }, - // }, - // Priority: to.Ptr(armcompute.VirtualMachinePriorityTypesRegular), - // ScheduledEventsProfile: &armcompute.ScheduledEventsProfile{ - // TerminateNotificationProfile: &armcompute.TerminateNotificationProfile{ - // Enable: to.Ptr(true), - // NotBeforeTimeout: to.Ptr("aa"), - // }, - // }, - // 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.VirtualMachineScaleSetStorageProfile{ - // DataDisks: []*armcompute.VirtualMachineScaleSetDataDisk{ - // }, - // ImageReference: &armcompute.ImageReference{ - // ID: to.Ptr("aaa"), - // ExactVersion: to.Ptr("aa"), - // Offer: to.Ptr("databricks"), - // Publisher: to.Ptr("azuredatabricks"), - // SharedGalleryImageID: to.Ptr("aaaaaaa"), - // SKU: to.Ptr("databricksworker"), - // Version: to.Ptr("3.15.2"), - // }, - // OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - // Name: to.Ptr("a"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // DiffDiskSettings: &armcompute.DiffDiskSettings{ - // Option: to.Ptr(armcompute.DiffDiskOptionsLocal), - // Placement: to.Ptr(armcompute.DiffDiskPlacementCacheDisk), - // }, - // DiskSizeGB: to.Ptr[int32](30), - // Image: &armcompute.VirtualHardDisk{ - // URI: to.Ptr("https://{storageAccountName}.blob.core.windows.net/{containerName}/{vhdName}.vhd"), - // }, - // ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - // DiskEncryptionSet: &armcompute.DiskEncryptionSetParameters{ - // ID: to.Ptr("aaaaaaaaaaaa"), - // }, - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesPremiumLRS), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // VhdContainers: []*string{ - // to.Ptr("aaaaaaaaaaaaaaaa")}, - // WriteAcceleratorEnabled: to.Ptr(true), - // }, - // }, - // UserData: to.Ptr("aaaaaaaaaaaaaaaaaaaaaa"), - // }, - // ZoneBalance: to.Ptr(true), - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Standard_D2s_v3"), - // Capacity: to.Ptr[int64](4), - // Tier: to.Ptr("Standard"), - // }, - // Zones: []*string{ - // to.Ptr("aaaaaaaa")}, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_List_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_NewListPager_virtualMachineScaleSetListMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualMachineScaleSetsClient().NewListPager("rgcompute", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.VirtualMachineScaleSetListResult = armcompute.VirtualMachineScaleSetListResult{ - // Value: []*armcompute.VirtualMachineScaleSet{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/rgcompute/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}"), - // Location: to.Ptr("eastus"), - // }, - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/rgcompute/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}"), - // Location: to.Ptr("eastus"), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_ListAll_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_NewListAllPager_virtualMachineScaleSetListAllMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualMachineScaleSetsClient().NewListAllPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.VirtualMachineScaleSetListWithLinkResult = armcompute.VirtualMachineScaleSetListWithLinkResult{ - // Value: []*armcompute.VirtualMachineScaleSet{ - // { - // Name: to.Ptr("{virtualMachineScaleSetName}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "key8425": to.Ptr("aaa"), - // }, - // ExtendedLocation: &armcompute.ExtendedLocation{ - // Name: to.Ptr("aaaaaaaaaaaaaaaaaaaaa"), - // Type: to.Ptr(armcompute.ExtendedLocationTypesEdgeZone), - // }, - // Identity: &armcompute.VirtualMachineScaleSetIdentity{ - // Type: to.Ptr(armcompute.ResourceIdentityTypeSystemAssigned), - // PrincipalID: to.Ptr("aaaaaaaaaaaaaaa"), - // TenantID: to.Ptr("aaaaaaaaaaaaaaaa"), - // UserAssignedIdentities: map[string]*armcompute.UserAssignedIdentitiesValue{ - // "key3951": &armcompute.UserAssignedIdentitiesValue{ - // ClientID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // PrincipalID: to.Ptr("aaaa"), - // }, - // }, - // }, - // Plan: &armcompute.Plan{ - // Name: to.Ptr("aaaaaaaaaa"), - // Product: to.Ptr("aaaaaaaaaaaaaaaaaaaa"), - // PromotionCode: to.Ptr("aaaaaaaaaaaaaaaaaaaa"), - // Publisher: to.Ptr("aaaaaaaaaaaaaaaaaaaaaa"), - // }, - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // AdditionalCapabilities: &armcompute.AdditionalCapabilities{ - // HibernationEnabled: to.Ptr(true), - // UltraSSDEnabled: to.Ptr(true), - // }, - // AutomaticRepairsPolicy: &armcompute.AutomaticRepairsPolicy{ - // Enabled: to.Ptr(true), - // GracePeriod: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaa"), - // }, - // DoNotRunExtensionsOnOverprovisionedVMs: to.Ptr(true), - // HostGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // OrchestrationMode: to.Ptr(armcompute.OrchestrationModeUniform), - // Overprovision: to.Ptr(true), - // PlatformFaultDomainCount: to.Ptr[int32](1), - // ProvisioningState: to.Ptr("Succeeded"), - // ProximityPlacementGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // ScaleInPolicy: &armcompute.ScaleInPolicy{ - // ForceDeletion: to.Ptr(true), - // Rules: []*armcompute.VirtualMachineScaleSetScaleInRules{ - // to.Ptr(armcompute.VirtualMachineScaleSetScaleInRulesDefault)}, - // }, - // SinglePlacementGroup: to.Ptr(true), - // SpotRestorePolicy: &armcompute.SpotRestorePolicy{ - // Enabled: to.Ptr(true), - // RestoreTimeout: to.Ptr("aaaaaaaaaa"), - // }, - // UniqueID: to.Ptr("aaaaaaaa"), - // UpgradePolicy: &armcompute.UpgradePolicy{ - // AutomaticOSUpgradePolicy: &armcompute.AutomaticOSUpgradePolicy{ - // DisableAutomaticRollback: to.Ptr(true), - // EnableAutomaticOSUpgrade: to.Ptr(true), - // OSRollingUpgradeDeferral: to.Ptr(true), - // }, - // Mode: to.Ptr(armcompute.UpgradeModeManual), - // RollingUpgradePolicy: &armcompute.RollingUpgradePolicy{ - // EnableCrossZoneUpgrade: to.Ptr(true), - // MaxBatchInstancePercent: to.Ptr[int32](49), - // MaxSurge: to.Ptr(true), - // MaxUnhealthyInstancePercent: to.Ptr[int32](81), - // MaxUnhealthyUpgradedInstancePercent: to.Ptr[int32](98), - // PauseTimeBetweenBatches: to.Ptr("aaaaaaaaaaaaaaa"), - // PrioritizeUnhealthyInstances: to.Ptr(true), - // RollbackFailedInstancesOnPolicyBreach: to.Ptr(true), - // }, - // }, - // VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - // ApplicationProfile: &armcompute.ApplicationProfile{ - // GalleryApplications: []*armcompute.VMGalleryApplication{ - // { - // ConfigurationReference: to.Ptr("aaaaa"), - // Order: to.Ptr[int32](29), - // PackageReferenceID: to.Ptr("aaaaaaaaaa"), - // Tags: to.Ptr("aaaaaaaaaaa"), - // }}, - // }, - // BillingProfile: &armcompute.BillingProfile{ - // MaxPrice: to.Ptr[float64](4), - // }, - // CapacityReservation: &armcompute.CapacityReservationProfile{ - // CapacityReservationGroup: &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("aaaaaaaaaaaaaaaaaaa"), - // }, - // }, - // EvictionPolicy: to.Ptr(armcompute.VirtualMachineEvictionPolicyTypesDeallocate), - // ExtensionProfile: &armcompute.VirtualMachineScaleSetExtensionProfile{ - // ExtensionsTimeBudget: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaa"), - // Extensions: []*armcompute.VirtualMachineScaleSetExtension{ - // { - // ID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaa"), - // Name: to.Ptr("aa"), - // Type: to.Ptr("aaaaa"), - // Properties: &armcompute.VirtualMachineScaleSetExtensionProperties{ - // Type: to.Ptr("aaaaaaaa"), - // AutoUpgradeMinorVersion: to.Ptr(true), - // EnableAutomaticUpgrade: to.Ptr(true), - // ForceUpdateTag: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // ProtectedSettings: map[string]any{ - // }, - // ProvisionAfterExtensions: []*string{ - // to.Ptr("aaaaaaaaaaaaaa")}, - // ProvisioningState: to.Ptr("Succeeded"), - // Publisher: to.Ptr("aaaaaaaaaaaaa"), - // Settings: map[string]any{ - // }, - // SuppressFailures: to.Ptr(true), - // TypeHandlerVersion: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // }, - // }}, - // }, - // LicenseType: to.Ptr("aaaaaaaaaa"), - // NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - // HealthProbe: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/restorePointCollections/rpcName/restorePoints/restorePointName/diskRestorePoints/testingexcludedisk_OsDisk_1_74cdaedcea50483d9833c96adefa100f_22b4bdfe-6c54-4f72-84d8-85d8860f0c57"), - // }, - // NetworkAPIVersion: to.Ptr(armcompute.NetworkAPIVersionTwoThousandTwenty1101), - // NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - // DeleteOption: to.Ptr(armcompute.DeleteOptionsDelete), - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // to.Ptr("aaaaaaaaaaaa")}, - // }, - // EnableAcceleratedNetworking: to.Ptr(true), - // EnableFpga: to.Ptr(true), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // 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"), - // DomainNameLabelScope: to.Ptr(armcompute.DomainNameLabelScopeTypesTenantReuse), - // }, - // 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/{existing-virtual-network-name}/subnets/{existing-subnet-name}"), - // }, - // }, - // }}, - // NetworkSecurityGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // 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("aaa"), - // KeyData: to.Ptr("aaaaaa"), - // }}, - // }, - // }, - // 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), - // EnableHotpatching: to.Ptr(true), - // PatchMode: to.Ptr(armcompute.WindowsVMGuestPatchModeManual), - // }, - // ProvisionVMAgent: to.Ptr(true), - // TimeZone: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // WinRM: &armcompute.WinRMConfiguration{ - // Listeners: []*armcompute.WinRMListener{ - // { - // CertificateURL: to.Ptr("aaaaaaaaaaaaaaaaaaaaaa"), - // Protocol: to.Ptr(armcompute.ProtocolTypesHTTP), - // }}, - // }, - // }, - // }, - // Priority: to.Ptr(armcompute.VirtualMachinePriorityTypesRegular), - // ScheduledEventsProfile: &armcompute.ScheduledEventsProfile{ - // TerminateNotificationProfile: &armcompute.TerminateNotificationProfile{ - // Enable: to.Ptr(true), - // NotBeforeTimeout: to.Ptr("aa"), - // }, - // }, - // 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.VirtualMachineScaleSetStorageProfile{ - // DataDisks: []*armcompute.VirtualMachineScaleSetDataDisk{ - // { - // Name: to.Ptr("aaaaaaaaaaaaaa"), - // Caching: to.Ptr(armcompute.CachingTypesNone), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // DiskIOPSReadWrite: to.Ptr[int64](11), - // DiskMBpsReadWrite: to.Ptr[int64](13), - // DiskSizeGB: to.Ptr[int32](11), - // Lun: to.Ptr[int32](24), - // 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("a"), - // ExactVersion: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // Offer: to.Ptr("WindowsServer"), - // Publisher: to.Ptr("MicrosoftWindowsServer"), - // SharedGalleryImageID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaa"), - // SKU: to.Ptr("2016-Datacenter"), - // Version: to.Ptr("latest"), - // }, - // OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - // Name: to.Ptr("aaaaaaaaaaaaaaa"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // DiffDiskSettings: &armcompute.DiffDiskSettings{ - // Option: to.Ptr(armcompute.DiffDiskOptionsLocal), - // Placement: to.Ptr(armcompute.DiffDiskPlacementCacheDisk), - // }, - // DiskSizeGB: to.Ptr[int32](30), - // Image: &armcompute.VirtualHardDisk{ - // URI: to.Ptr("https://{storageAccountName}.blob.core.windows.net/{containerName}/{vhdName}.vhd"), - // }, - // ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - // DiskEncryptionSet: &armcompute.DiskEncryptionSetParameters{ - // ID: to.Ptr("aaaaaaaaaaaa"), - // }, - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // VhdContainers: []*string{ - // to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaa")}, - // WriteAcceleratorEnabled: to.Ptr(true), - // }, - // }, - // UserData: to.Ptr("aaa"), - // }, - // ZoneBalance: to.Ptr(true), - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Standard_D1_v2"), - // Capacity: to.Ptr[int64](3), - // Tier: to.Ptr("Standard"), - // }, - // Zones: []*string{ - // to.Ptr("aaaaaaaaaaaaaaaaaaaa")}, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_ListAll_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_NewListAllPager_virtualMachineScaleSetListAllMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualMachineScaleSetsClient().NewListAllPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.VirtualMachineScaleSetListWithLinkResult = armcompute.VirtualMachineScaleSetListWithLinkResult{ - // Value: []*armcompute.VirtualMachineScaleSet{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}"), - // Location: to.Ptr("westus"), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_ListSkus_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_NewListSKUsPager_virtualMachineScaleSetListSkusMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualMachineScaleSetsClient().NewListSKUsPager("rgcompute", "aaaaaa", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.VirtualMachineScaleSetListSKUsResult = armcompute.VirtualMachineScaleSetListSKUsResult{ - // Value: []*armcompute.VirtualMachineScaleSetSKU{ - // { - // Capacity: &armcompute.VirtualMachineScaleSetSKUCapacity{ - // DefaultCapacity: to.Ptr[int64](20), - // Maximum: to.Ptr[int64](27), - // Minimum: to.Ptr[int64](22), - // ScaleType: to.Ptr(armcompute.VirtualMachineScaleSetSKUScaleTypeAutomatic), - // }, - // ResourceType: to.Ptr("aaaaaaaaaaaaaaaaa"), - // SKU: &armcompute.SKU{ - // Name: to.Ptr("DSv3-Type1"), - // Capacity: to.Ptr[int64](7), - // Tier: to.Ptr("aaa"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_ListSkus_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_NewListSKUsPager_virtualMachineScaleSetListSkusMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualMachineScaleSetsClient().NewListSKUsPager("rgcompute", "aaaaaaaaaaaaaaaa", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.VirtualMachineScaleSetListSKUsResult = armcompute.VirtualMachineScaleSetListSKUsResult{ - // Value: []*armcompute.VirtualMachineScaleSetSKU{ - // { - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_GetOSUpgradeHistory_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_NewGetOSUpgradeHistoryPager_virtualMachineScaleSetGetOsUpgradeHistoryMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualMachineScaleSetsClient().NewGetOSUpgradeHistoryPager("rgcompute", "aaaaaa", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.VirtualMachineScaleSetListOSUpgradeHistory = armcompute.VirtualMachineScaleSetListOSUpgradeHistory{ - // Value: []*armcompute.UpgradeOperationHistoricalStatusInfo{ - // { - // Type: to.Ptr("aaaaaaaaaaaaaaaaaaa"), - // Location: to.Ptr("aaaaaaaaaaaaa"), - // Properties: &armcompute.UpgradeOperationHistoricalStatusInfoProperties{ - // Error: &armcompute.APIError{ - // Code: to.Ptr("aaaaaaa"), - // Innererror: &armcompute.InnerError{ - // Errordetail: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Exceptiontype: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // }, - // Message: to.Ptr("aaaaaaaaa"), - // Target: to.Ptr("aaaaaaa"), - // Details: []*armcompute.APIErrorBase{ - // { - // Code: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Message: to.Ptr("aa"), - // Target: to.Ptr("aaaa"), - // }}, - // }, - // Progress: &armcompute.RollingUpgradeProgressInfo{ - // FailedInstanceCount: to.Ptr[int32](25), - // InProgressInstanceCount: to.Ptr[int32](20), - // PendingInstanceCount: to.Ptr[int32](27), - // SuccessfulInstanceCount: to.Ptr[int32](6), - // }, - // RollbackInfo: &armcompute.RollbackStatusInfo{ - // FailedRolledbackInstanceCount: to.Ptr[int32](2), - // RollbackError: &armcompute.APIError{ - // Code: to.Ptr("aaaaaaa"), - // Innererror: &armcompute.InnerError{ - // Errordetail: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Exceptiontype: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // }, - // Message: to.Ptr("aaaaaaaaa"), - // Target: to.Ptr("aaaaaaa"), - // Details: []*armcompute.APIErrorBase{ - // { - // Code: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Message: to.Ptr("aa"), - // Target: to.Ptr("aaaa"), - // }}, - // }, - // SuccessfullyRolledbackInstanceCount: to.Ptr[int32](12), - // }, - // RunningStatus: &armcompute.UpgradeOperationHistoryStatus{ - // Code: to.Ptr(armcompute.UpgradeStateRollingForward), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T13:05:40.443Z"); return t}()), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T13:05:40.442Z"); return t}()), - // }, - // StartedBy: to.Ptr(armcompute.UpgradeOperationInvokerUnknown), - // TargetImageReference: &armcompute.ImageReference{ - // ID: to.Ptr("aaaaaaaaaaaaaaaaaaa"), - // ExactVersion: to.Ptr("aaaaaaa"), - // Offer: to.Ptr("WindowsServer"), - // Publisher: to.Ptr("MicrosoftWindowsServer"), - // SharedGalleryImageID: to.Ptr("aaaaaa"), - // SKU: to.Ptr("2016-Datacenter"), - // Version: to.Ptr("latest"), - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_GetOSUpgradeHistory_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_NewGetOSUpgradeHistoryPager_virtualMachineScaleSetGetOsUpgradeHistoryMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualMachineScaleSetsClient().NewGetOSUpgradeHistoryPager("rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaaa", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.VirtualMachineScaleSetListOSUpgradeHistory = armcompute.VirtualMachineScaleSetListOSUpgradeHistory{ - // Value: []*armcompute.UpgradeOperationHistoricalStatusInfo{ - // { - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_PowerOff_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_BeginPowerOff_virtualMachineScaleSetPowerOffMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_PowerOff_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_BeginPowerOff_virtualMachineScaleSetPowerOffMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Restart_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_BeginRestart_virtualMachineScaleSetRestartMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Restart_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_BeginRestart_virtualMachineScaleSetRestartMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Start_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_BeginStart_virtualMachineScaleSetStartMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Start_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_BeginStart_virtualMachineScaleSetStartMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Reapply_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_BeginReapply_virtualMachineScaleSetsReapplyMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().BeginReapply(ctx, "VirtualMachineScaleSetReapplyTestRG", "VMSSReapply-Test-ScaleSet", 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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Reapply_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_BeginReapply_virtualMachineScaleSetsReapplyMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().BeginReapply(ctx, "VirtualMachineScaleSetReapplyTestRG", "VMSSReapply-Test-ScaleSet", 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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Redeploy_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_BeginRedeploy_virtualMachineScaleSetRedeployMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Redeploy_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_BeginRedeploy_virtualMachineScaleSetRedeployMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_PerformMaintenance_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_BeginPerformMaintenance_virtualMachineScaleSetPerformMaintenanceMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_PerformMaintenance_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_BeginPerformMaintenance_virtualMachineScaleSetPerformMaintenanceMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_UpdateInstances_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_BeginUpdateInstances_virtualMachineScaleSetUpdateInstancesMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_UpdateInstances_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_BeginUpdateInstances_virtualMachineScaleSetUpdateInstancesMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Reimage_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_BeginReimage_virtualMachineScaleSetReimageMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Reimage_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_BeginReimage_virtualMachineScaleSetReimageMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_ReimageAll_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_BeginReimageAll_virtualMachineScaleSetReimageAllMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_ReimageAll_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_BeginReimageAll_virtualMachineScaleSetReimageAllMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_ApproveRollingUpgrade.json -func ExampleVirtualMachineScaleSetsClient_BeginApproveRollingUpgrade() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().BeginApproveRollingUpgrade(ctx, "rgcompute", "vmssToApproveRollingUpgradeOn", &armcompute.VirtualMachineScaleSetsClientBeginApproveRollingUpgradeOptions{VMInstanceIDs: &armcompute.VirtualMachineScaleSetVMInstanceIDs{ - InstanceIDs: []*string{ - to.Ptr("0"), - to.Ptr("1"), - to.Ptr("2")}, - }, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_ForceRecoveryServiceFabricPlatformUpdateDomainWalk_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_ForceRecoveryServiceFabricPlatformUpdateDomainWalk_virtualMachineScaleSetForceRecoveryServiceFabricPlatformUpdateDomainWalkMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineScaleSetsClient().ForceRecoveryServiceFabricPlatformUpdateDomainWalk(ctx, "rgcompute", "aaaaaaaaaaaaaaaa", 30, &armcompute.VirtualMachineScaleSetsClientForceRecoveryServiceFabricPlatformUpdateDomainWalkOptions{Zone: nil, - PlacementGroupID: nil, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RecoveryWalkResponse = armcompute.RecoveryWalkResponse{ - // NextPlatformUpdateDomain: to.Ptr[int32](7), - // WalkPerformed: to.Ptr(true), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_ForceRecoveryServiceFabricPlatformUpdateDomainWalk_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_ForceRecoveryServiceFabricPlatformUpdateDomainWalk_virtualMachineScaleSetForceRecoveryServiceFabricPlatformUpdateDomainWalkMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineScaleSetsClient().ForceRecoveryServiceFabricPlatformUpdateDomainWalk(ctx, "rgcompute", "aaaaaaaaaaaa", 9, &armcompute.VirtualMachineScaleSetsClientForceRecoveryServiceFabricPlatformUpdateDomainWalkOptions{Zone: nil, - PlacementGroupID: nil, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RecoveryWalkResponse = armcompute.RecoveryWalkResponse{ - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_ConvertToSinglePlacementGroup_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_ConvertToSinglePlacementGroup_virtualMachineScaleSetConvertToSinglePlacementGroupMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewVirtualMachineScaleSetsClient().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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_ConvertToSinglePlacementGroup_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_ConvertToSinglePlacementGroup_virtualMachineScaleSetConvertToSinglePlacementGroupMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewVirtualMachineScaleSetsClient().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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_SetOrchestrationServiceState_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_BeginSetOrchestrationServiceState_virtualMachineScaleSetSetOrchestrationServiceStateMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_SetOrchestrationServiceState_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_BeginSetOrchestrationServiceState_virtualMachineScaleSetSetOrchestrationServiceStateMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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_example_test.go b/sdk/resourcemanager/compute/armcompute/virtualmachinescalesetvmextensions_client_example_test.go deleted file mode 100644 index e111905a41a6..000000000000 --- a/sdk/resourcemanager/compute/armcompute/virtualmachinescalesetvmextensions_client_example_test.go +++ /dev/null @@ -1,226 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package 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/v5" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMExtension_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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetVMExtensionsClient().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]any{ - "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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSetVMExtension = armcompute.VirtualMachineScaleSetVMExtension{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/myvmScaleSet/virtualMachines/0/extensions/myVMExtension"), - // Name: to.Ptr("myVMExtension"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets/virtualMachines/extensions"), - // Properties: &armcompute.VirtualMachineExtensionProperties{ - // Type: to.Ptr("extType"), - // AutoUpgradeMinorVersion: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // Publisher: to.Ptr("extPublisher"), - // Settings: map[string]any{ - // "UserName": "xyz@microsoft.com", - // }, - // TypeHandlerVersion: to.Ptr("1.2"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMExtension_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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetVMExtensionsClient().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]any{ - "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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSetVMExtension = armcompute.VirtualMachineScaleSetVMExtension{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/myvmScaleSet/virtualMachines/0/extensions/myVMExtension"), - // Name: to.Ptr("myVMExtension"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets/virtualMachines/extensions"), - // Properties: &armcompute.VirtualMachineExtensionProperties{ - // Type: to.Ptr("extType"), - // AutoUpgradeMinorVersion: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // Publisher: to.Ptr("extPublisher"), - // Settings: map[string]any{ - // "UserName": "xyz@microsoft.com", - // }, - // TypeHandlerVersion: to.Ptr("1.2"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMExtension_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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetVMExtensionsClient().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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMExtension_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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineScaleSetVMExtensionsClient().Get(ctx, "myResourceGroup", "myvmScaleSet", "0", "myVMExtension", &armcompute.VirtualMachineScaleSetVMExtensionsClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSetVMExtension = armcompute.VirtualMachineScaleSetVMExtension{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/myvmScaleSet/virtualMachines/0/extensions/myVMExtension"), - // Name: to.Ptr("myVMExtension"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets/virtualMachines/extensions"), - // Properties: &armcompute.VirtualMachineExtensionProperties{ - // Type: to.Ptr("extType"), - // AutoUpgradeMinorVersion: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // Publisher: to.Ptr("extPublisher"), - // Settings: map[string]any{ - // "UserName": "xyz@microsoft.com", - // }, - // TypeHandlerVersion: to.Ptr("1.2"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMExtension_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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineScaleSetVMExtensionsClient().List(ctx, "myResourceGroup", "myvmScaleSet", "0", &armcompute.VirtualMachineScaleSetVMExtensionsClientListOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSetVMExtensionsListResult = armcompute.VirtualMachineScaleSetVMExtensionsListResult{ - // Value: []*armcompute.VirtualMachineScaleSetVMExtension{ - // { - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/myvmScaleSet/virtualMachines/0/extensions/myVMExtension"), - // Name: to.Ptr("myVMExtension"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets/virtualMachines/extensions"), - // Properties: &armcompute.VirtualMachineExtensionProperties{ - // Type: to.Ptr("extType"), - // AutoUpgradeMinorVersion: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // Publisher: to.Ptr("extPublisher"), - // Settings: map[string]any{ - // "UserName": "xyz@microsoft.com", - // }, - // TypeHandlerVersion: to.Ptr("1.2"), - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/myvmScaleSet/virtualMachines/0/extensions/myVMExtension1"), - // Name: to.Ptr("myVMExtension1"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets/virtualMachines/extensions"), - // Properties: &armcompute.VirtualMachineExtensionProperties{ - // Type: to.Ptr("extType1"), - // AutoUpgradeMinorVersion: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // Publisher: to.Ptr("extPublisher1"), - // Settings: map[string]any{ - // "UserName": "xyz@microsoft.com", - // }, - // TypeHandlerVersion: to.Ptr("1.0"), - // }, - // }}, - // } -} 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 2e1710eaa35e..000000000000 --- a/sdk/resourcemanager/compute/armcompute/virtualmachinescalesetvmruncommands_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. -// DO NOT EDIT. - -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/v5" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetVMRunCommandsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myvmScaleSet", "0", "myRunCommand", armcompute.VirtualMachineRunCommand{ - Location: to.Ptr("West US"), - Properties: &armcompute.VirtualMachineRunCommandProperties{ - AsyncExecution: to.Ptr(false), - ErrorBlobManagedIdentity: &armcompute.RunCommandManagedIdentity{}, - ErrorBlobURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/mycontainer/MyScriptError.txt"), - OutputBlobManagedIdentity: &armcompute.RunCommandManagedIdentity{ - ClientID: to.Ptr("22d35efb-0c99-4041-8c5b-6d24db33a69a"), - }, - OutputBlobURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/myscriptoutputcontainer/MyScriptoutput.txt"), - 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{ - ScriptURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/scriptcontainer/MyScript.ps1"), - ScriptURIManagedIdentity: &armcompute.RunCommandManagedIdentity{ - ObjectID: to.Ptr("4231e4d2-33e4-4e23-96b2-17888afa6072"), - }, - }, - TimeoutInSeconds: to.Ptr[int32](3600), - TreatFailureAsDeploymentFailure: 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineRunCommand = armcompute.VirtualMachineRunCommand{ - // Name: to.Ptr("myRunCommand"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets/virtualMachines/runCommands"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/myvmScaleSet/virtualMachines/0/runCommands/myRunCommand"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineRunCommandProperties{ - // AsyncExecution: to.Ptr(false), - // ErrorBlobURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/mycontainer/MyScriptError.txt"), - // OutputBlobURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/myscriptoutputcontainer/MyScriptoutput.txt"), - // Parameters: []*armcompute.RunCommandInputParameter{ - // { - // Name: to.Ptr("param1"), - // Value: to.Ptr("value1"), - // }, - // { - // Name: to.Ptr("param2"), - // Value: to.Ptr("value2"), - // }}, - // ProvisioningState: to.Ptr("Succeeded"), - // RunAsUser: to.Ptr("user1"), - // Source: &armcompute.VirtualMachineRunCommandScriptSource{ - // ScriptURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/scriptcontainer/MyScript.ps1"), - // }, - // TimeoutInSeconds: to.Ptr[int32](3600), - // TreatFailureAsDeploymentFailure: to.Ptr(true), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetVMRunCommandsClient().BeginUpdate(ctx, "myResourceGroup", "myvmScaleSet", "0", "myRunCommand", armcompute.VirtualMachineRunCommandUpdate{ - Properties: &armcompute.VirtualMachineRunCommandProperties{ - Source: &armcompute.VirtualMachineRunCommandScriptSource{ - ScriptURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/scriptcontainer/MyScript.ps1"), - ScriptURIManagedIdentity: &armcompute.RunCommandManagedIdentity{ - ObjectID: to.Ptr("4231e4d2-33e4-4e23-96b2-17888afa6072"), - }, - }, - }, - }, 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineRunCommand = armcompute.VirtualMachineRunCommand{ - // Name: to.Ptr("myRunCommand"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets/virtualMachines/runCommands"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/myvmScaleSet/virtualMachines/0/runCommands/myRunCommand"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "tag1": to.Ptr("value1"), - // "tag2": to.Ptr("value2"), - // }, - // Properties: &armcompute.VirtualMachineRunCommandProperties{ - // AsyncExecution: to.Ptr(false), - // ErrorBlobURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/mycontainer/MyScriptError.txt"), - // OutputBlobURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/myscriptoutputcontainer/MyScriptoutput.txt"), - // Parameters: []*armcompute.RunCommandInputParameter{ - // { - // Name: to.Ptr("param1"), - // Value: to.Ptr("value1"), - // }, - // { - // Name: to.Ptr("param2"), - // Value: to.Ptr("value2"), - // }}, - // ProvisioningState: to.Ptr("Succeeded"), - // RunAsUser: to.Ptr("user1"), - // Source: &armcompute.VirtualMachineRunCommandScriptSource{ - // ScriptURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/scriptcontainer/MyScript.ps1"), - // }, - // TimeoutInSeconds: to.Ptr[int32](3600), - // TreatFailureAsDeploymentFailure: to.Ptr(false), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetVMRunCommandsClient().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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineScaleSetVMRunCommandsClient().Get(ctx, "myResourceGroup", "myvmScaleSet", "0", "myRunCommand", &armcompute.VirtualMachineScaleSetVMRunCommandsClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineRunCommand = armcompute.VirtualMachineRunCommand{ - // Name: to.Ptr("myRunCommand"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets/virtualMachines/runCommands"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/myvmScaleSet/virtualMachines/0/runCommands/myRunCommand"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "tag1": to.Ptr("value1"), - // "tag2": to.Ptr("value2"), - // }, - // Properties: &armcompute.VirtualMachineRunCommandProperties{ - // AsyncExecution: to.Ptr(false), - // ErrorBlobURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/mycontainer/MyScriptError.txt"), - // OutputBlobURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/myscriptoutputcontainer/MyScriptoutput.txt"), - // Parameters: []*armcompute.RunCommandInputParameter{ - // { - // Name: to.Ptr("param1"), - // Value: to.Ptr("value1"), - // }, - // { - // Name: to.Ptr("param2"), - // Value: to.Ptr("value2"), - // }}, - // ProvisioningState: to.Ptr("Succeeded"), - // RunAsUser: to.Ptr("user1"), - // Source: &armcompute.VirtualMachineRunCommandScriptSource{ - // ScriptURI: to.Ptr("https://gist.githubusercontent.com/myusername/75fd3634w7511116063c60bcc50bee0/raw/04a4c68ac9e1d36asfasdc64bd1d889b104c7abdb8/HelloWorld.ps1"), - // }, - // TimeoutInSeconds: to.Ptr[int32](3600), - // TreatFailureAsDeploymentFailure: to.Ptr(false), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualMachineScaleSetVMRunCommandsClient().NewListPager("myResourceGroup", "myvmScaleSet", "0", &armcompute.VirtualMachineScaleSetVMRunCommandsClientListOptions{Expand: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.VirtualMachineRunCommandsListResult = armcompute.VirtualMachineRunCommandsListResult{ - // Value: []*armcompute.VirtualMachineRunCommand{ - // { - // Name: to.Ptr("myRunCommand"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets/virtualMachines/runCommands"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/myvmScaleSet/virtualMachines/0/runCommands/myRunCommand"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineRunCommandProperties{ - // AsyncExecution: to.Ptr(false), - // ErrorBlobURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/mycontainer/MyScriptError.txt"), - // OutputBlobURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/myscriptoutputcontainer/MyScriptoutput.txt"), - // Parameters: []*armcompute.RunCommandInputParameter{ - // { - // Name: to.Ptr("param1"), - // Value: to.Ptr("value1"), - // }, - // { - // Name: to.Ptr("param2"), - // Value: to.Ptr("value2"), - // }}, - // ProvisioningState: to.Ptr("Succeeded"), - // RunAsUser: to.Ptr("user1"), - // Source: &armcompute.VirtualMachineRunCommandScriptSource{ - // Script: to.Ptr("Write-Host Hello World! ; Remove-Item C: est estFile.txt"), - // }, - // TimeoutInSeconds: to.Ptr[int32](0), - // TreatFailureAsDeploymentFailure: to.Ptr(false), - // }, - // }}, - // } - } -} 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 a1913fa75d44..000000000000 --- a/sdk/resourcemanager/compute/armcompute/virtualmachinescalesetvms_client_example_test.go +++ /dev/null @@ -1,2535 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package 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/v5" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Reimage_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetVMsClient_BeginReimage_virtualMachineScaleSetVmReimageMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetVMsClient().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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Reimage_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetVMsClient_BeginReimage_virtualMachineScaleSetVmReimageMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetVMsClient().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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_ReimageAll_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetVMsClient_BeginReimageAll_virtualMachineScaleSetVmReimageAllMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetVMsClient().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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_ReimageAll_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetVMsClient_BeginReimageAll_virtualMachineScaleSetVmReimageAllMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetVMsClient().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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_ApproveRollingUpgrade.json -func ExampleVirtualMachineScaleSetVMsClient_BeginApproveRollingUpgrade() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetVMsClient().BeginApproveRollingUpgrade(ctx, "rgcompute", "vmssToApproveRollingUpgradeOn", "0123", 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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Deallocate_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetVMsClient_BeginDeallocate_virtualMachineScaleSetVmDeallocateMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetVMsClient().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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Deallocate_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetVMsClient_BeginDeallocate_virtualMachineScaleSetVmDeallocateMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetVMsClient().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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Update_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetVMsClient_BeginUpdate_virtualMachineScaleSetVmUpdateMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetVMsClient().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{ - { - 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{ - { - 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"), - }, - }, &armcompute.VirtualMachineScaleSetVMsClientBeginUpdateOptions{IfMatch: nil, - IfNoneMatch: 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSetVM = armcompute.VirtualMachineScaleSetVM{ - // Name: to.Ptr("{vmss-vm-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}/virtualMachines/0"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // }, - // InstanceID: to.Ptr("aaaaaaaaaaaa"), - // 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{ - // AssignedHost: to.Ptr("aaaaaaa"), - // BootDiagnostics: &armcompute.BootDiagnosticsInstanceView{ - // ConsoleScreenshotBlobURI: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaa"), - // SerialConsoleLogBlobURI: to.Ptr("aaaaaaaa"), - // 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"), - // }}, - // }, - // LatestModelApplied: to.Ptr(true), - // LicenseType: to.Ptr("aaaaaaaaaa"), - // ModelDefinitionApplied: to.Ptr("VirtualMachineScaleSet"), - // 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{ - // { - // 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{ - // { - // 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{ - // 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), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // 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), - // DiskIOPSReadWrite: to.Ptr[int64](18), - // DiskMBpsReadWrite: to.Ptr[int64](29), - // 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"), - // ExactVersion: to.Ptr("4.127.20180315"), - // 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=="), - // VMID: to.Ptr("42af9fdf-b906-4ad7-9905-8316209ff619"), - // }, - // Resources: []*armcompute.VirtualMachineExtension{ - // { - // Name: to.Ptr("CustomScriptExtension-DSC"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines/extensions"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM/extensions/CustomScriptExtension-DSC"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // }, - // Properties: &armcompute.VirtualMachineExtensionProperties{ - // Type: to.Ptr("CustomScriptExtension"), - // AutoUpgradeMinorVersion: to.Ptr(true), - // EnableAutomaticUpgrade: to.Ptr(true), - // ForceUpdateTag: to.Ptr("aaaaaaa"), - // 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]any{ - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // Publisher: to.Ptr("Microsoft.Compute"), - // Settings: map[string]any{ - // }, - // SuppressFailures: to.Ptr(true), - // TypeHandlerVersion: to.Ptr("1.9"), - // }, - // }}, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Classic"), - // Capacity: to.Ptr[int64](29), - // Tier: to.Ptr("aaaaaaaaaaaaaa"), - // }, - // Zones: []*string{ - // to.Ptr("a")}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Update_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetVMsClient_BeginUpdate_virtualMachineScaleSetVmUpdateMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetVMsClient().BeginUpdate(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaa", armcompute.VirtualMachineScaleSetVM{ - Location: to.Ptr("westus"), - }, &armcompute.VirtualMachineScaleSetVMsClientBeginUpdateOptions{IfMatch: nil, - IfNoneMatch: 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSetVM = armcompute.VirtualMachineScaleSetVM{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}/virtualMachines/0"), - // Location: to.Ptr("westus"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetVMsClient().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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineScaleSetVMsClient().Get(ctx, "myResourceGroup", "{vmss-name}", "0", &armcompute.VirtualMachineScaleSetVMsClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSetVM = armcompute.VirtualMachineScaleSetVM{ - // Name: to.Ptr("{vmss-vm-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}/virtualMachines/0"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "myTag1": to.Ptr("tagValue1"), - // }, - // Etag: to.Ptr("\"1\""), - // Properties: &armcompute.VirtualMachineScaleSetVMProperties{ - // DiagnosticsProfile: &armcompute.DiagnosticsProfile{ - // BootDiagnostics: &armcompute.BootDiagnostics{ - // Enabled: to.Ptr(true), - // }, - // }, - // HardwareProfile: &armcompute.HardwareProfile{ - // }, - // LatestModelApplied: to.Ptr(true), - // ModelDefinitionApplied: to.Ptr("VirtualMachineScaleSet"), - // NetworkProfile: &armcompute.NetworkProfile{ - // NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}/virtualMachines/0/networkInterfaces/vmsstestnetconfig5415"), - // }}, - // }, - // NetworkProfileConfiguration: &armcompute.VirtualMachineScaleSetVMNetworkProfileConfiguration{ - // NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - // { - // Name: to.Ptr("vmsstestnetconfig5415"), - // Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(false), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("vmsstestnetconfig9693"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/vn4071/subnets/sn5503"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("Foo12"), - // AllowExtensionOperations: to.Ptr(true), - // ComputerName: to.Ptr("test000000"), - // RequireGuestProvisionSignal: to.Ptr(true), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // { - // Name: to.Ptr("vmss3176_vmss3176_0_disk2_6c4f554bdafa49baa780eb2d128ff39d"), - // Caching: to.Ptr(armcompute.CachingTypesNone), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesEmpty), - // DiskSizeGB: to.Ptr[int32](128), - // 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"), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // ToBeDetached: to.Ptr(false), - // }}, - // ImageReference: &armcompute.ImageReference{ - // ExactVersion: to.Ptr("4.127.20180315"), - // Offer: to.Ptr("WindowsServer"), - // Publisher: to.Ptr("MicrosoftWindowsServer"), - // 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), - // DiskSizeGB: to.Ptr[int32](127), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/vmss3176_vmss3176_0_OsDisk_1_6d72b805e50e4de6830303c5055077fc"), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }, - // UserData: to.Ptr("RXhhbXBsZSBVc2VyRGF0YQ=="), - // VMID: to.Ptr("42af9fdf-b906-4ad7-9905-8316209ff619"), - // }, - // Resources: []*armcompute.VirtualMachineExtension{ - // { - // Name: to.Ptr("CustomScriptExtension-DSC"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines/extensions"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM/extensions/CustomScriptExtension-DSC"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "displayName": to.Ptr("CustomScriptExtension-DSC"), - // }, - // Properties: &armcompute.VirtualMachineExtensionProperties{ - // Type: to.Ptr("CustomScriptExtension"), - // AutoUpgradeMinorVersion: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // Publisher: to.Ptr("Microsoft.Compute"), - // Settings: map[string]any{ - // }, - // TypeHandlerVersion: to.Ptr("1.9"), - // }, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineScaleSetVMsClient().Get(ctx, "myResourceGroup", "{vmss-name}", "0", &armcompute.VirtualMachineScaleSetVMsClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSetVM = armcompute.VirtualMachineScaleSetVM{ - // Name: to.Ptr("{vmss-vm-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}/virtualMachines/0"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "myTag1": to.Ptr("tagValue1"), - // }, - // Etag: to.Ptr("\"1\""), - // Properties: &armcompute.VirtualMachineScaleSetVMProperties{ - // DiagnosticsProfile: &armcompute.DiagnosticsProfile{ - // BootDiagnostics: &armcompute.BootDiagnostics{ - // Enabled: to.Ptr(true), - // }, - // }, - // HardwareProfile: &armcompute.HardwareProfile{ - // VMSizeProperties: &armcompute.VMSizeProperties{ - // VCPUsAvailable: to.Ptr[int32](1), - // VCPUsPerCore: to.Ptr[int32](1), - // }, - // }, - // LatestModelApplied: to.Ptr(true), - // ModelDefinitionApplied: to.Ptr("VirtualMachineScaleSet"), - // NetworkProfile: &armcompute.NetworkProfile{ - // NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}/virtualMachines/0/networkInterfaces/vmsstestnetconfig5415"), - // }}, - // }, - // NetworkProfileConfiguration: &armcompute.VirtualMachineScaleSetVMNetworkProfileConfiguration{ - // NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - // { - // Name: to.Ptr("vmsstestnetconfig5415"), - // Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(false), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("vmsstestnetconfig9693"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/vn4071/subnets/sn5503"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("Foo12"), - // AllowExtensionOperations: to.Ptr(true), - // ComputerName: to.Ptr("test000000"), - // RequireGuestProvisionSignal: to.Ptr(true), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // { - // Name: to.Ptr("vmss3176_vmss3176_0_disk2_6c4f554bdafa49baa780eb2d128ff39d"), - // Caching: to.Ptr(armcompute.CachingTypesNone), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesEmpty), - // DiskSizeGB: to.Ptr[int32](128), - // 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"), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // ToBeDetached: to.Ptr(false), - // }}, - // ImageReference: &armcompute.ImageReference{ - // ExactVersion: to.Ptr("4.127.20180315"), - // Offer: to.Ptr("WindowsServer"), - // Publisher: to.Ptr("MicrosoftWindowsServer"), - // 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), - // DiskSizeGB: to.Ptr[int32](127), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/vmss3176_vmss3176_0_OsDisk_1_6d72b805e50e4de6830303c5055077fc"), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }, - // UserData: to.Ptr("RXhhbXBsZSBVc2VyRGF0YQ=="), - // VMID: to.Ptr("42af9fdf-b906-4ad7-9905-8316209ff619"), - // }, - // Resources: []*armcompute.VirtualMachineExtension{ - // { - // Name: to.Ptr("CustomScriptExtension-DSC"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines/extensions"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM/extensions/CustomScriptExtension-DSC"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "displayName": to.Ptr("CustomScriptExtension-DSC"), - // }, - // Properties: &armcompute.VirtualMachineExtensionProperties{ - // Type: to.Ptr("CustomScriptExtension"), - // AutoUpgradeMinorVersion: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // Publisher: to.Ptr("Microsoft.Compute"), - // Settings: map[string]any{ - // }, - // TypeHandlerVersion: to.Ptr("1.9"), - // }, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineScaleSetVMsClient().GetInstanceView(ctx, "myResourceGroup", "myVirtualMachineScaleSet", "0", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSetVMInstanceView = armcompute.VirtualMachineScaleSetVMInstanceView{ - // AssignedHost: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/hostGroups/myHostGroup/hosts/myHost"), - // Disks: []*armcompute.DiskInstanceView{ - // { - // Name: to.Ptr("myOSDisk"), - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("ProvisioningState/succeeded"), - // DisplayStatus: to.Ptr("Provisioning succeeded"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-09-01T04:58:58.088Z"); return t}()), - // }}, - // }}, - // PlatformFaultDomain: to.Ptr[int32](0), - // PlatformUpdateDomain: to.Ptr[int32](0), - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("ProvisioningState/succeeded"), - // DisplayStatus: to.Ptr("Provisioning succeeded"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-05T04:59:58.185Z"); return t}()), - // }, - // { - // Code: to.Ptr("PowerState/running"), - // DisplayStatus: to.Ptr("VM running"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // }}, - // VMAgent: &armcompute.VirtualMachineAgentInstanceView{ - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("ProvisioningState/Unavailable"), - // DisplayStatus: to.Ptr("Not Ready"), - // Level: to.Ptr(armcompute.StatusLevelTypesWarning), - // Message: to.Ptr("VM status blob is found but not yet populated."), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-09-01T05:00:32.000Z"); return t}()), - // }}, - // VMAgentVersion: to.Ptr("Unknown"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_List_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetVMsClient_NewListPager_virtualMachineScaleSetVmListMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualMachineScaleSetVMsClient().NewListPager("rgcompute", "aaaaaaaaaaaaaaaaaaaaaa", &armcompute.VirtualMachineScaleSetVMsClientListOptions{Filter: to.Ptr("aaaaaaaaaaaaaa"), - Select: to.Ptr("aaaaaaaaaaaaaaaaaaaaa"), - Expand: to.Ptr("aaaaaaaaaaaaa"), - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.VirtualMachineScaleSetVMListResult = armcompute.VirtualMachineScaleSetVMListResult{ - // Value: []*armcompute.VirtualMachineScaleSetVM{ - // { - // Name: to.Ptr("{vmss-vm-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}/virtualMachines/0"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // }, - // InstanceID: to.Ptr("aaaaaaaaaaaa"), - // 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{ - // AssignedHost: to.Ptr("aaaaaaa"), - // BootDiagnostics: &armcompute.BootDiagnosticsInstanceView{ - // ConsoleScreenshotBlobURI: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaa"), - // SerialConsoleLogBlobURI: to.Ptr("aaaaaaaa"), - // 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"), - // }}, - // }, - // LatestModelApplied: to.Ptr(true), - // LicenseType: to.Ptr("aaaaaaaaaa"), - // ModelDefinitionApplied: to.Ptr("VirtualMachineScaleSet"), - // 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{ - // { - // 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{ - // { - // 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{ - // 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), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // 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), - // DiskIOPSReadWrite: to.Ptr[int64](18), - // DiskMBpsReadWrite: to.Ptr[int64](29), - // 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"), - // ExactVersion: to.Ptr("4.127.20180315"), - // 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), - // }, - // }, - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-27T01:02:38.313Z"); return t}()), - // UserData: to.Ptr("RXhhbXBsZSBVc2VyRGF0YQ=="), - // VMID: to.Ptr("42af9fdf-b906-4ad7-9905-8316209ff619"), - // }, - // Resources: []*armcompute.VirtualMachineExtension{ - // { - // Name: to.Ptr("CustomScriptExtension-DSC"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines/extensions"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM/extensions/CustomScriptExtension-DSC"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // }, - // Properties: &armcompute.VirtualMachineExtensionProperties{ - // Type: to.Ptr("CustomScriptExtension"), - // AutoUpgradeMinorVersion: to.Ptr(true), - // EnableAutomaticUpgrade: to.Ptr(true), - // ForceUpdateTag: to.Ptr("aaaaaaa"), - // 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]any{ - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // Publisher: to.Ptr("Microsoft.Compute"), - // Settings: map[string]any{ - // }, - // SuppressFailures: to.Ptr(true), - // TypeHandlerVersion: to.Ptr("1.9"), - // }, - // }}, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Classic"), - // Capacity: to.Ptr[int64](29), - // Tier: to.Ptr("aaaaaaaaaaaaaa"), - // }, - // Zones: []*string{ - // to.Ptr("a")}, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_List_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetVMsClient_NewListPager_virtualMachineScaleSetVmListMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualMachineScaleSetVMsClient().NewListPager("rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaaaaa", &armcompute.VirtualMachineScaleSetVMsClientListOptions{Filter: nil, - Select: nil, - Expand: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.VirtualMachineScaleSetVMListResult = armcompute.VirtualMachineScaleSetVMListResult{ - // Value: []*armcompute.VirtualMachineScaleSetVM{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}/virtualMachines/0"), - // Location: to.Ptr("westus"), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_PowerOff_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetVMsClient_BeginPowerOff_virtualMachineScaleSetVmPowerOffMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetVMsClient().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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_PowerOff_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetVMsClient_BeginPowerOff_virtualMachineScaleSetVmPowerOffMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetVMsClient().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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Restart_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetVMsClient_BeginRestart_virtualMachineScaleSetVmRestartMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetVMsClient().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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Restart_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetVMsClient_BeginRestart_virtualMachineScaleSetVmRestartMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetVMsClient().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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Start_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetVMsClient_BeginStart_virtualMachineScaleSetVmStartMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetVMsClient().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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Start_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetVMsClient_BeginStart_virtualMachineScaleSetVmStartMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetVMsClient().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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Redeploy_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetVMsClient_BeginRedeploy_virtualMachineScaleSetVmRedeployMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetVMsClient().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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Redeploy_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetVMsClient_BeginRedeploy_virtualMachineScaleSetVmRedeployMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetVMsClient().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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineScaleSetVMsClient().RetrieveBootDiagnosticsData(ctx, "ResourceGroup", "myvmScaleSet", "0", &armcompute.VirtualMachineScaleSetVMsClientRetrieveBootDiagnosticsDataOptions{SasURIExpirationTimeInMinutes: to.Ptr[int32](60)}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RetrieveBootDiagnosticsDataResult = armcompute.RetrieveBootDiagnosticsDataResult{ - // ConsoleScreenshotBlobURI: to.Ptr("https://storageuri/myvmScaleSetinstance.screenshot.bmp?{saskey}"), - // SerialConsoleLogBlobURI: to.Ptr("https://storageuri/myvmScaleSetinstance.serialconsole.log?{saskey}"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_PerformMaintenance_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetVMsClient_BeginPerformMaintenance_virtualMachineScaleSetVmPerformMaintenanceMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetVMsClient().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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_PerformMaintenance_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetVMsClient_BeginPerformMaintenance_virtualMachineScaleSetVmPerformMaintenanceMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetVMsClient().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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewVirtualMachineScaleSetVMsClient().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/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_AttachDetachDataDisks_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetVMsClient_BeginAttachDetachDataDisks_virtualMachineScaleSetVmAttachDetachDataDisksMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetVMsClient().BeginAttachDetachDataDisks(ctx, "rgcompute", "azure-vmscaleset", "0", armcompute.AttachDetachDataDisksRequest{ - DataDisksToAttach: []*armcompute.DataDisksToAttach{ - { - DiskID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/vmss3176_vmss3176_0_disk2_6c4f554bdafa49baa780eb2d128ff39d"), - Lun: to.Ptr[int32](1), - }, - { - DiskID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/vmss3176_vmss3176_2_disk3_7d5e664bdafa49baa780eb2d128ff38e"), - Lun: to.Ptr[int32](2), - }}, - DataDisksToDetach: []*armcompute.DataDisksToDetach{ - { - DetachOption: to.Ptr(armcompute.DiskDetachOptionTypesForceDetach), - DiskID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/vmss3176_vmss3176_1_disk1_1a4e784bdafa49baa780eb2d128ff65x"), - }, - { - DetachOption: to.Ptr(armcompute.DiskDetachOptionTypesForceDetach), - DiskID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/vmss3176_vmss3176_4_disk4_4d4e784bdafa49baa780eb2d256ff41z"), - }}, - }, 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.StorageProfile = armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // { - // Name: to.Ptr("vmss3176_vmss3176_0_disk2_6c4f554bdafa49baa780eb2d128ff39d"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesAttach), - // DiskSizeGB: to.Ptr[int32](30), - // 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"), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesPremiumLRS), - // }, - // }, - // { - // Name: to.Ptr("vmss3176_vmss3176_2_disk3_7d5e664bdafa49baa780eb2d128ff38e"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesAttach), - // DiskSizeGB: to.Ptr[int32](100), - // Lun: to.Ptr[int32](2), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/vmss3176_vmss3176_2_disk3_7d5e664bdafa49baa780eb2d128ff38e"), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesPremiumLRS), - // }, - // }}, - // 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("myOsDisk"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // DiskSizeGB: to.Ptr[int32](30), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myOsDisk"), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesPremiumLRS), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_AttachDetachDataDisks_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetVMsClient_BeginAttachDetachDataDisks_virtualMachineScaleSetVmAttachDetachDataDisksMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetVMsClient().BeginAttachDetachDataDisks(ctx, "rgcompute", "azure-vmscaleset", "0", armcompute.AttachDetachDataDisksRequest{ - DataDisksToAttach: []*armcompute.DataDisksToAttach{ - { - DiskID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/vmss3176_vmss3176_0_disk2_6c4f554bdafa49baa780eb2d128ff39d"), - }}, - DataDisksToDetach: []*armcompute.DataDisksToDetach{ - { - DiskID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/vmss3176_vmss3176_1_disk1_1a4e784bdafa49baa780eb2d128ff65x"), - }}, - }, 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.StorageProfile = armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // { - // Name: to.Ptr("vmss3176_vmss3176_0_disk2_6c4f554bdafa49baa780eb2d128ff39d"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesAttach), - // DiskSizeGB: to.Ptr[int32](30), - // Lun: to.Ptr[int32](0), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/vmss3176_vmss3176_0_disk2_6c4f554bdafa49baa780eb2d128ff39d"), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesPremiumLRS), - // }, - // }}, - // 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("myOsDisk"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // DiskSizeGB: to.Ptr[int32](30), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myOsDisk"), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesPremiumLRS), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetVMsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RunCommandResult = armcompute.RunCommandResult{ - // Value: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("ComponentStatus/StdOut/succeeded"), - // DisplayStatus: to.Ptr("Provisioning succeeded"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("Hello World!"), - // }, - // { - // Code: to.Ptr("ComponentStatus/StdErr/succeeded"), - // DisplayStatus: to.Ptr("Provisioning succeeded"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr(""), - // }}, - // } -} 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 ef03b4f459f8..000000000000 --- a/sdk/resourcemanager/compute/armcompute/virtualmachinesizes_client_example_test.go +++ /dev/null @@ -1,89 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package 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/v5" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualMachineSizesClient().NewListPager("-e", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.VirtualMachineSizeListResult = armcompute.VirtualMachineSizeListResult{ - // Value: []*armcompute.VirtualMachineSize{ - // { - // Name: to.Ptr("Standard_A1_V2"), - // MaxDataDiskCount: to.Ptr[int32](2), - // MemoryInMB: to.Ptr[int32](2048), - // NumberOfCores: to.Ptr[int32](1), - // OSDiskSizeInMB: to.Ptr[int32](1047552), - // ResourceDiskSizeInMB: to.Ptr[int32](10240), - // }, - // { - // Name: to.Ptr("Standard_A2_V2"), - // MaxDataDiskCount: to.Ptr[int32](4), - // MemoryInMB: to.Ptr[int32](4096), - // NumberOfCores: to.Ptr[int32](2), - // OSDiskSizeInMB: to.Ptr[int32](1047552), - // ResourceDiskSizeInMB: to.Ptr[int32](20480), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualMachineSizesClient().NewListPager("._..", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.VirtualMachineSizeListResult = armcompute.VirtualMachineSizeListResult{ - // } - } -}