-
Notifications
You must be signed in to change notification settings - Fork 13
/
OpenShiftClusters_CreateOrUpdate.go
80 lines (77 loc) · 3.18 KB
/
OpenShiftClusters_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
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
78
79
80
package armredhatopenshift_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/redhatopenshift/armredhatopenshift"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2022-04-01/examples/OpenShiftClusters_CreateOrUpdate.json
func ExampleOpenShiftClustersClient_BeginCreateOrUpdate() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
client, err := armredhatopenshift.NewOpenShiftClustersClient("subscriptionId", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := client.BeginCreateOrUpdate(ctx,
"resourceGroup",
"resourceName",
armredhatopenshift.OpenShiftCluster{
Location: to.Ptr("location"),
Tags: map[string]*string{
"key": to.Ptr("value"),
},
Properties: &armredhatopenshift.OpenShiftClusterProperties{
ApiserverProfile: &armredhatopenshift.APIServerProfile{
Visibility: to.Ptr(armredhatopenshift.VisibilityPublic),
},
ClusterProfile: &armredhatopenshift.ClusterProfile{
Domain: to.Ptr("cluster.location.aroapp.io"),
FipsValidatedModules: to.Ptr(armredhatopenshift.FipsValidatedModulesEnabled),
PullSecret: to.Ptr("{\"auths\":{\"registry.connect.redhat.com\":{\"auth\":\"\"},\"registry.redhat.io\":{\"auth\":\"\"}}}"),
ResourceGroupID: to.Ptr("/subscriptions/subscriptionId/resourceGroups/clusterResourceGroup"),
},
ConsoleProfile: &armredhatopenshift.ConsoleProfile{},
IngressProfiles: []*armredhatopenshift.IngressProfile{
{
Name: to.Ptr("default"),
Visibility: to.Ptr(armredhatopenshift.VisibilityPublic),
}},
MasterProfile: &armredhatopenshift.MasterProfile{
EncryptionAtHost: to.Ptr(armredhatopenshift.EncryptionAtHostEnabled),
SubnetID: to.Ptr("/subscriptions/subscriptionId/resourceGroups/vnetResourceGroup/providers/Microsoft.Network/virtualNetworks/vnet/subnets/master"),
VMSize: to.Ptr("Standard_D8s_v3"),
},
NetworkProfile: &armredhatopenshift.NetworkProfile{
PodCidr: to.Ptr("10.128.0.0/14"),
ServiceCidr: to.Ptr("172.30.0.0/16"),
},
ServicePrincipalProfile: &armredhatopenshift.ServicePrincipalProfile{
ClientID: to.Ptr("clientId"),
ClientSecret: to.Ptr("clientSecret"),
},
WorkerProfiles: []*armredhatopenshift.WorkerProfile{
{
Name: to.Ptr("worker"),
Count: to.Ptr[int32](3),
DiskSizeGB: to.Ptr[int32](128),
SubnetID: to.Ptr("/subscriptions/subscriptionId/resourceGroups/vnetResourceGroup/providers/Microsoft.Network/virtualNetworks/vnet/subnets/worker"),
VMSize: to.Ptr("Standard_D2s_v3"),
}},
},
},
nil)
if err != nil {
log.Fatalf("failed 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
}