-
Notifications
You must be signed in to change notification settings - Fork 11
/
ContainerGroupsGetPriority.go
105 lines (102 loc) · 5.16 KB
/
ContainerGroupsGetPriority.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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
package armcontainerinstance_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerinstance/armcontainerinstance/v2"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/71121282e39bccae590462648e77bca283df6d2b/specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2022-10-01-preview/examples/ContainerGroupsGetPriority.json
func ExampleContainerGroupsClient_Get_containerGroupsGetWithPriority() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcontainerinstance.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewContainerGroupsClient().Get(ctx, "demo", "demo1", 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.ContainerGroup = armcontainerinstance.ContainerGroup{
// Properties: &armcontainerinstance.ContainerGroupPropertiesProperties{
// Containers: []*armcontainerinstance.Container{
// {
// Name: to.Ptr("test-container-001"),
// Properties: &armcontainerinstance.ContainerProperties{
// Command: []*string{
// to.Ptr("/bin/sh"),
// to.Ptr("-c"),
// to.Ptr("sleep 10")},
// EnvironmentVariables: []*armcontainerinstance.EnvironmentVariable{
// },
// Image: to.Ptr("alpine:latest"),
// InstanceView: &armcontainerinstance.ContainerPropertiesInstanceView{
// CurrentState: &armcontainerinstance.ContainerState{
// DetailStatus: to.Ptr("Completed"),
// ExitCode: to.Ptr[int32](0),
// FinishTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-11T19:33:55.565Z"); return t}()),
// StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-11T19:33:44.217Z"); return t}()),
// State: to.Ptr("Terminated"),
// },
// Events: []*armcontainerinstance.Event{
// {
// Name: to.Ptr("Pulling"),
// Type: to.Ptr("Normal"),
// Count: to.Ptr[int32](2),
// FirstTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-11T19:28:22Z"); return t}()),
// LastTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-11T19:32:09Z"); return t}()),
// Message: to.Ptr("pulling image \"alpine@sha256:1304f174557314a7ed9eddb4eab12fed12cb0cd9809e4c28f29af86979a3c870\""),
// },
// {
// Name: to.Ptr("Pulled"),
// Type: to.Ptr("Normal"),
// Count: to.Ptr[int32](2),
// FirstTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-11T19:32:08Z"); return t}()),
// LastTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-11T19:32:38Z"); return t}()),
// Message: to.Ptr("Successfully pulled image \"alpine@sha256:1304f174557314a7ed9eddb4eab12fed12cb0cd9809e4c28f29af86979a3c870\""),
// },
// {
// Name: to.Ptr("Started"),
// Type: to.Ptr("Normal"),
// Count: to.Ptr[int32](1),
// FirstTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-11T19:33:44Z"); return t}()),
// LastTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-11T19:33:44Z"); return t}()),
// Message: to.Ptr("Started container"),
// }},
// RestartCount: to.Ptr[int32](0),
// },
// Ports: []*armcontainerinstance.ContainerPort{
// },
// Resources: &armcontainerinstance.ResourceRequirements{
// Requests: &armcontainerinstance.ResourceRequests{
// CPU: to.Ptr[float64](1),
// MemoryInGB: to.Ptr[float64](1),
// },
// },
// },
// }},
// InitContainers: []*armcontainerinstance.InitContainerDefinition{
// },
// InstanceView: &armcontainerinstance.ContainerGroupPropertiesInstanceView{
// Events: []*armcontainerinstance.Event{
// },
// State: to.Ptr("Succeeded"),
// },
// OSType: to.Ptr(armcontainerinstance.OperatingSystemTypesLinux),
// Priority: to.Ptr(armcontainerinstance.ContainerGroupPrioritySpot),
// ProvisioningState: to.Ptr("Succeeded"),
// RestartPolicy: to.Ptr(armcontainerinstance.ContainerGroupRestartPolicyNever),
// SKU: to.Ptr(armcontainerinstance.ContainerGroupSKUStandard),
// },
// Name: to.Ptr("demo1"),
// Type: to.Ptr("Microsoft.ContainerInstance/containerGroups"),
// ID: to.Ptr("/subscriptions/subId/resourceGroups/demo/providers/Microsoft.ContainerInstance/containerGroups/demo1"),
// Location: to.Ptr("eastus"),
// }
}