-
Notifications
You must be signed in to change notification settings - Fork 12
/
ListExperimentExecutionsDetails.go
123 lines (120 loc) · 7.09 KB
/
ListExperimentExecutionsDetails.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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
package armchaos_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/chaos/armchaos"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/chaos/resource-manager/Microsoft.Chaos/preview/2021-09-15-preview/examples/ListExperimentExecutionsDetails.json
func ExampleExperimentsClient_NewListExecutionDetailsPager() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armchaos.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
pager := clientFactory.NewExperimentsClient().NewListExecutionDetailsPager("exampleRG", "exampleExperiment", 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.ExperimentExecutionDetailsListResult = armchaos.ExperimentExecutionDetailsListResult{
// Value: []*armchaos.ExperimentExecutionDetails{
// {
// Name: to.Ptr("f24500ad-744e-4a26-864b-b76199eac333"),
// Type: to.Ptr("Microsoft.Chaos/experiments/executionDetails"),
// ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Chaos/experiments/exampleExperiment/executionDetails/f24500ad-744e-4a26-864b-b76199eac333"),
// Properties: &armchaos.ExperimentExecutionDetailsProperties{
// CreatedDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-14T21:52:42.917983Z"); return t}()),
// ExperimentID: to.Ptr("f24500ad-744e-4a26-864b-b76199eac333"),
// FailureReason: to.Ptr("Dependency failure"),
// LastActionDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-14T21:52:52.2552574Z"); return t}()),
// RunInformation: &armchaos.ExperimentExecutionDetailsPropertiesRunInformation{
// Steps: []*armchaos.StepStatus{
// {
// Branches: []*armchaos.BranchStatus{
// {
// Actions: []*armchaos.ActionStatus{
// {
// ActionID: to.Ptr("59499d33-6751-4b6e-a1f6-58f4d56a040a"),
// ActionName: to.Ptr("urn:provider:agent-v2:Microsoft.Azure.Chaos.Fault.CPUPressureAllProcessors"),
// EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-14T13:56:13.6270153-08:00"); return t}()),
// StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-14T13:56:13.6270153-08:00"); return t}()),
// Status: to.Ptr("failed"),
// Targets: []*armchaos.ExperimentExecutionActionTargetDetailsProperties{
// {
// Status: to.Ptr("succeeded"),
// Target: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Compute/virtualMachines/VM1"),
// TargetCompletedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-02T17:30:55+00:00"); return t}()),
// TargetFailedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-02T16:30:55+00:00"); return t}()),
// }},
// }},
// BranchID: to.Ptr("FirstBranch"),
// BranchName: to.Ptr("FirstBranch"),
// Status: to.Ptr("failed"),
// }},
// Status: to.Ptr("failed"),
// StepID: to.Ptr("FirstStep"),
// StepName: to.Ptr("FirstStep"),
// }},
// },
// StartDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-14T21:52:52.2552574Z"); return t}()),
// Status: to.Ptr("failed"),
// StopDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-14T21:56:18.9281956Z"); return t}()),
// },
// },
// {
// Name: to.Ptr("14d98367-52ef-4596-be4f-53fc81bbfc33"),
// Type: to.Ptr("Microsoft.Chaos/experiments/executionDetails"),
// ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Chaos/experiments/exampleExperiment/executionDetails/14d98367-52ef-4596-be4f-53fc81bbfc33"),
// Properties: &armchaos.ExperimentExecutionDetailsProperties{
// CreatedDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-14T21:52:42.917983Z"); return t}()),
// ExperimentID: to.Ptr("14d98367-52ef-4596-be4f-53fc81bbfc33"),
// FailureReason: to.Ptr(""),
// LastActionDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-14T21:52:52.2552574Z"); return t}()),
// RunInformation: &armchaos.ExperimentExecutionDetailsPropertiesRunInformation{
// Steps: []*armchaos.StepStatus{
// {
// Branches: []*armchaos.BranchStatus{
// {
// Actions: []*armchaos.ActionStatus{
// {
// ActionID: to.Ptr("59499d33-6751-4b6e-a1f6-58f4d56a040a"),
// ActionName: to.Ptr("urn:provider:agent-v2:Microsoft.Azure.Chaos.Fault.CPUPressureAllProcessors"),
// EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-14T13:56:13.6270153-08:00"); return t}()),
// StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-14T13:56:13.6270153-08:00"); return t}()),
// Status: to.Ptr("success"),
// Targets: []*armchaos.ExperimentExecutionActionTargetDetailsProperties{
// {
// Status: to.Ptr("succeeded"),
// Target: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Compute/virtualMachines/VM1"),
// TargetCompletedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-02T17:30:55+00:00"); return t}()),
// TargetFailedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-02T16:30:55+00:00"); return t}()),
// }},
// }},
// BranchID: to.Ptr("FirstBranch"),
// BranchName: to.Ptr("FirstBranch"),
// Status: to.Ptr("success"),
// }},
// Status: to.Ptr("success"),
// StepID: to.Ptr("FirstStep"),
// StepName: to.Ptr("FirstStep"),
// }},
// },
// StartDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-14T21:52:52.2552574Z"); return t}()),
// Status: to.Ptr("success"),
// StopDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-14T21:56:18.9281956Z"); return t}()),
// },
// }},
// }
}
}