-
Notifications
You must be signed in to change notification settings - Fork 11
/
VirtualMachineExtensions_CreateOrUpdate_MaximumSet_Gen.go
77 lines (73 loc) · 2.79 KB
/
VirtualMachineExtensions_CreateOrUpdate_MaximumSet_Gen.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
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/v3"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/stable/2022-03-01/ComputeRP/examples/virtualMachineExamples/VirtualMachineExtensions_CreateOrUpdate_MaximumSet_Gen.json
func ExampleVirtualMachineExtensionsClient_BeginCreateOrUpdate() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
client, err := armcompute.NewVirtualMachineExtensionsClient("{subscription-id}", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := client.BeginCreateOrUpdate(ctx,
"rgcompute",
"aaaaaaaaaaaaaaaaaaaaaaaa",
"aaaaaaaaaaaaa",
armcompute.VirtualMachineExtension{
Location: to.Ptr("westus"),
Tags: map[string]*string{
"key9183": to.Ptr("aa"),
},
Properties: &armcompute.VirtualMachineExtensionProperties{
Type: to.Ptr("extType"),
AutoUpgradeMinorVersion: to.Ptr(true),
EnableAutomaticUpgrade: to.Ptr(true),
ForceUpdateTag: to.Ptr("a"),
InstanceView: &armcompute.VirtualMachineExtensionInstanceView{
Name: to.Ptr("aaaaaaaaaaaaaaaaa"),
Type: to.Ptr("aaaaaaaaa"),
Statuses: []*armcompute.InstanceViewStatus{
{
Code: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"),
DisplayStatus: to.Ptr("aaaaaa"),
Level: to.Ptr(armcompute.StatusLevelTypesInfo),
Message: to.Ptr("a"),
Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.522Z"); return t }()),
}},
Substatuses: []*armcompute.InstanceViewStatus{
{
Code: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"),
DisplayStatus: to.Ptr("aaaaaa"),
Level: to.Ptr(armcompute.StatusLevelTypesInfo),
Message: to.Ptr("a"),
Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.522Z"); return t }()),
}},
TypeHandlerVersion: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaa"),
},
ProtectedSettings: map[string]interface{}{},
Publisher: to.Ptr("extPublisher"),
Settings: map[string]interface{}{},
SuppressFailures: to.Ptr(true),
TypeHandlerVersion: to.Ptr("1.2"),
},
},
nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// TODO: use response item
_ = res
}