forked from vmware-archive/atc
-
Notifications
You must be signed in to change notification settings - Fork 1
/
plan.go
115 lines (91 loc) · 3.15 KB
/
plan.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
package atc
type Plan struct {
ID PlanID `json:"id"`
Attempts []int `json:"attempts,omitempty"`
Aggregate *AggregatePlan `json:"aggregate,omitempty"`
Do *DoPlan `json:"do,omitempty"`
Get *GetPlan `json:"get,omitempty"`
Put *PutPlan `json:"put,omitempty"`
Task *TaskPlan `json:"task,omitempty"`
Ensure *EnsurePlan `json:"ensure,omitempty"`
OnSuccess *OnSuccessPlan `json:"on_success,omitempty"`
OnFailure *OnFailurePlan `json:"on_failure,omitempty"`
Try *TryPlan `json:"try,omitempty"`
DependentGet *DependentGetPlan `json:"dependent_get,omitempty"`
Timeout *TimeoutPlan `json:"timeout,omitempty"`
Retry *RetryPlan `json:"retry,omitempty"`
}
type PlanID string
type DependentGetPlan struct {
Type string `json:"type"`
Name string `json:"name,omitempty"`
Resource string `json:"resource"`
Params Params `json:"params,omitempty"`
Tags Tags `json:"tags,omitempty"`
Source Source `json:"source"`
VersionedResourceTypes VersionedResourceTypes `json:"resource_types,omitempty"`
}
func (plan DependentGetPlan) GetPlan() GetPlan {
return GetPlan{
Type: plan.Type,
Name: plan.Name,
Resource: plan.Resource,
Source: plan.Source,
Tags: plan.Tags,
Params: plan.Params,
VersionedResourceTypes: plan.VersionedResourceTypes,
}
}
type OnFailurePlan struct {
Step Plan `json:"step"`
Next Plan `json:"on_failure"`
}
type EnsurePlan struct {
Step Plan `json:"step"`
Next Plan `json:"ensure"`
}
type OnSuccessPlan struct {
Step Plan `json:"step"`
Next Plan `json:"on_success"`
}
type TimeoutPlan struct {
Step Plan `json:"step"`
Duration string `json:"duration"`
}
type TryPlan struct {
Step Plan `json:"step"`
}
type AggregatePlan []Plan
type DoPlan []Plan
type GetPlan struct {
Type string `json:"type"`
Name string `json:"name,omitempty"`
Resource string `json:"resource"`
Source Source `json:"source"`
Params Params `json:"params,omitempty"`
Version Version `json:"version,omitempty"`
Tags Tags `json:"tags,omitempty"`
VersionedResourceTypes VersionedResourceTypes `json:"resource_types,omitempty"`
}
type PutPlan struct {
Type string `json:"type"`
Name string `json:"name,omitempty"`
Resource string `json:"resource"`
Source Source `json:"source"`
Params Params `json:"params,omitempty"`
Tags Tags `json:"tags,omitempty"`
VersionedResourceTypes VersionedResourceTypes `json:"resource_types,omitempty"`
}
type TaskPlan struct {
Name string `json:"name,omitempty"`
Privileged bool `json:"privileged"`
Tags Tags `json:"tags,omitempty"`
ConfigPath string `json:"config_path,omitempty"`
Config *TaskConfig `json:"config,omitempty"`
Params Params `json:"params,omitempty"`
InputMapping map[string]string `json:"input_mapping,omitempty"`
OutputMapping map[string]string `json:"output_mapping,omitempty"`
ImageArtifactName string `json:"image,omitempty"`
VersionedResourceTypes VersionedResourceTypes `json:"resource_types,omitempty"`
}
type RetryPlan []Plan