-
Notifications
You must be signed in to change notification settings - Fork 13
/
Machines_CreateOrUpdate.go
43 lines (40 loc) · 1.45 KB
/
Machines_CreateOrUpdate.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
package armhybridcompute_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/hybridcompute/armhybridcompute"
)
// x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2021-06-10-preview/examples/Machines_CreateOrUpdate.json
func ExampleMachinesClient_CreateOrUpdate() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
client := armhybridcompute.NewMachinesClient("<subscription-id>", cred, nil)
res, err := client.CreateOrUpdate(ctx,
"<resource-group-name>",
"<machine-name>",
armhybridcompute.Machine{
Location: to.StringPtr("<location>"),
Identity: &armhybridcompute.Identity{
Type: to.StringPtr("<type>"),
},
Properties: &armhybridcompute.MachineProperties{
ClientPublicKey: to.StringPtr("<client-public-key>"),
LocationData: &armhybridcompute.LocationData{
Name: to.StringPtr("<name>"),
},
ParentClusterResourceID: to.StringPtr("<parent-cluster-resource-id>"),
PrivateLinkScopeResourceID: to.StringPtr("<private-link-scope-resource-id>"),
VMID: to.StringPtr("<vmid>"),
},
},
nil)
if err != nil {
log.Fatal(err)
}
log.Printf("Response result: %#v\n", res.MachinesClientCreateOrUpdateResult)
}