1
|
|
|
package ssm |
2
|
|
|
|
3
|
|
|
import ( |
4
|
|
|
"time" |
5
|
|
|
|
6
|
|
|
SDK "github.com/aws/aws-sdk-go-v2/service/ssm" |
7
|
|
|
"github.com/evalphobia/aws-sdk-go-v2-wrapper/private/pointers" |
8
|
|
|
) |
9
|
|
|
|
10
|
|
|
type Parameter struct { |
|
|
|
|
11
|
|
|
ARN string |
12
|
|
|
DataType string |
13
|
|
|
LastModifiedDate time.Time |
14
|
|
|
Name string |
15
|
|
|
Selector string |
16
|
|
|
SourceResult string |
17
|
|
|
Type ParameterType |
18
|
|
|
Value string |
19
|
|
|
Version int64 |
20
|
|
|
} |
21
|
|
|
|
22
|
|
|
func newParameter(o *SDK.Parameter) Parameter { |
23
|
|
|
result := Parameter{} |
24
|
|
|
if o == nil { |
25
|
|
|
return result |
26
|
|
|
} |
27
|
|
|
|
28
|
|
|
if o.ARN != nil { |
29
|
|
|
result.ARN = *o.ARN |
30
|
|
|
} |
31
|
|
|
if o.DataType != nil { |
32
|
|
|
result.DataType = *o.DataType |
33
|
|
|
} |
34
|
|
|
if o.LastModifiedDate != nil { |
35
|
|
|
result.LastModifiedDate = *o.LastModifiedDate |
36
|
|
|
} |
37
|
|
|
if o.Name != nil { |
38
|
|
|
result.Name = *o.Name |
39
|
|
|
} |
40
|
|
|
if o.Selector != nil { |
41
|
|
|
result.Selector = *o.Selector |
42
|
|
|
} |
43
|
|
|
if o.SourceResult != nil { |
44
|
|
|
result.SourceResult = *o.SourceResult |
45
|
|
|
} |
46
|
|
|
result.Type = ParameterType(o.Type) |
47
|
|
|
if o.Value != nil { |
48
|
|
|
result.Value = *o.Value |
49
|
|
|
} |
50
|
|
|
if o.Version != nil { |
51
|
|
|
result.Version = *o.Version |
52
|
|
|
} |
53
|
|
|
return result |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
type ParameterHistory struct { |
|
|
|
|
57
|
|
|
AllowedPattern string |
58
|
|
|
DataType string |
59
|
|
|
Description string |
60
|
|
|
KeyID string |
61
|
|
|
Labels []string |
62
|
|
|
LastModifiedDate time.Time |
63
|
|
|
LastModifiedUser string |
64
|
|
|
Name string |
65
|
|
|
Policies []ParameterInlinePolicy |
66
|
|
|
Tier ParameterTier |
67
|
|
|
Type ParameterType |
68
|
|
|
Value string |
69
|
|
|
Version int64 |
70
|
|
|
} |
71
|
|
|
|
72
|
|
|
func newParameterHistoryList(list []*SDK.ParameterHistory) []ParameterHistory { |
73
|
|
|
if len(list) == 0 { |
74
|
|
|
return nil |
75
|
|
|
} |
76
|
|
|
|
77
|
|
|
results := make([]ParameterHistory, len(list)) |
78
|
|
|
for i, v := range list { |
79
|
|
|
results[i] = newParameterHistory(v) |
80
|
|
|
} |
81
|
|
|
return results |
82
|
|
|
} |
83
|
|
|
|
84
|
|
|
func newParameterHistory(o *SDK.ParameterHistory) ParameterHistory { |
85
|
|
|
result := ParameterHistory{} |
86
|
|
|
if o == nil { |
87
|
|
|
return result |
88
|
|
|
} |
89
|
|
|
|
90
|
|
|
if o.AllowedPattern != nil { |
91
|
|
|
result.AllowedPattern = *o.AllowedPattern |
92
|
|
|
} |
93
|
|
|
if o.DataType != nil { |
94
|
|
|
result.DataType = *o.DataType |
95
|
|
|
} |
96
|
|
|
if o.Description != nil { |
97
|
|
|
result.Description = *o.Description |
98
|
|
|
} |
99
|
|
|
if o.KeyId != nil { |
100
|
|
|
result.KeyID = *o.KeyId |
101
|
|
|
} |
102
|
|
|
if o.LastModifiedDate != nil { |
103
|
|
|
result.LastModifiedDate = *o.LastModifiedDate |
104
|
|
|
} |
105
|
|
|
if o.LastModifiedUser != nil { |
106
|
|
|
result.LastModifiedUser = *o.LastModifiedUser |
107
|
|
|
} |
108
|
|
|
if o.Name != nil { |
109
|
|
|
result.Name = *o.Name |
110
|
|
|
} |
111
|
|
|
if o.Value != nil { |
112
|
|
|
result.Value = *o.Value |
113
|
|
|
} |
114
|
|
|
if o.Version != nil { |
115
|
|
|
result.Version = *o.Version |
116
|
|
|
} |
117
|
|
|
|
118
|
|
|
result.Labels = o.Labels |
119
|
|
|
result.Policies = newParameterInlinePolicyList(o.Policies) |
120
|
|
|
result.Tier = ParameterTier(o.Tier) |
121
|
|
|
result.Type = ParameterType(o.Type) |
122
|
|
|
return result |
123
|
|
|
} |
124
|
|
|
|
125
|
|
|
type ParameterInlinePolicy struct { |
|
|
|
|
126
|
|
|
PolicyStatus string |
127
|
|
|
PolicyText string |
128
|
|
|
PolicyType string |
129
|
|
|
} |
130
|
|
|
|
131
|
|
|
func newParameterInlinePolicyList(list []SDK.ParameterInlinePolicy) []ParameterInlinePolicy { |
132
|
|
|
if len(list) == 0 { |
133
|
|
|
return nil |
134
|
|
|
} |
135
|
|
|
|
136
|
|
|
results := make([]ParameterInlinePolicy, len(list)) |
137
|
|
|
for i := range list { |
138
|
|
|
results[i] = newParameterInlinePolicy(&list[i]) |
139
|
|
|
} |
140
|
|
|
return results |
141
|
|
|
} |
142
|
|
|
|
143
|
|
|
func newParameterInlinePolicy(o *SDK.ParameterInlinePolicy) ParameterInlinePolicy { |
144
|
|
|
result := ParameterInlinePolicy{} |
145
|
|
|
if o == nil { |
146
|
|
|
return result |
147
|
|
|
} |
148
|
|
|
|
149
|
|
|
if o.PolicyStatus != nil { |
150
|
|
|
result.PolicyStatus = *o.PolicyStatus |
151
|
|
|
} |
152
|
|
|
if o.PolicyText != nil { |
153
|
|
|
result.PolicyText = *o.PolicyText |
154
|
|
|
} |
155
|
|
|
if o.PolicyType != nil { |
156
|
|
|
result.PolicyType = *o.PolicyType |
157
|
|
|
} |
158
|
|
|
return result |
159
|
|
|
} |
160
|
|
|
|
161
|
|
|
type ParameterMetadata struct { |
|
|
|
|
162
|
|
|
AllowedPattern string |
163
|
|
|
DataType string |
164
|
|
|
Description string |
165
|
|
|
KeyID string |
166
|
|
|
LastModifiedDate time.Time |
167
|
|
|
LastModifiedUser string |
168
|
|
|
Name string |
169
|
|
|
Policies []ParameterInlinePolicy |
170
|
|
|
Tier ParameterTier |
171
|
|
|
Type ParameterType |
172
|
|
|
Version int64 |
173
|
|
|
} |
174
|
|
|
|
175
|
|
|
func newParameterMetadata(o SDK.ParameterMetadata) ParameterMetadata { |
176
|
|
|
result := ParameterMetadata{} |
177
|
|
|
|
178
|
|
|
if o.AllowedPattern != nil { |
179
|
|
|
result.AllowedPattern = *o.AllowedPattern |
180
|
|
|
} |
181
|
|
|
if o.DataType != nil { |
182
|
|
|
result.DataType = *o.DataType |
183
|
|
|
} |
184
|
|
|
if o.Description != nil { |
185
|
|
|
result.Description = *o.Description |
186
|
|
|
} |
187
|
|
|
if o.KeyId != nil { |
188
|
|
|
result.KeyID = *o.KeyId |
189
|
|
|
} |
190
|
|
|
if o.LastModifiedDate != nil { |
191
|
|
|
result.LastModifiedDate = *o.LastModifiedDate |
192
|
|
|
} |
193
|
|
|
if o.LastModifiedUser != nil { |
194
|
|
|
result.LastModifiedUser = *o.LastModifiedUser |
195
|
|
|
} |
196
|
|
|
if o.Name != nil { |
197
|
|
|
result.Name = *o.Name |
198
|
|
|
} |
199
|
|
|
if o.Version != nil { |
200
|
|
|
result.Version = *o.Version |
201
|
|
|
} |
202
|
|
|
|
203
|
|
|
result.Policies = newParameterInlinePolicyList(o.Policies) |
204
|
|
|
result.Tier = ParameterTier(o.Tier) |
205
|
|
|
result.Type = ParameterType(o.Type) |
206
|
|
|
return result |
207
|
|
|
} |
208
|
|
|
|
209
|
|
|
type ParameterStringFilter struct { |
|
|
|
|
210
|
|
|
Key string |
211
|
|
|
Option string |
212
|
|
|
Values []string |
213
|
|
|
} |
214
|
|
|
|
215
|
|
|
func (v ParameterStringFilter) ToSDK() SDK.ParameterStringFilter { |
|
|
|
|
216
|
|
|
o := SDK.ParameterStringFilter{} |
217
|
|
|
if v.Key != "" { |
218
|
|
|
o.Key = pointers.String(v.Key) |
219
|
|
|
} |
220
|
|
|
if v.Option != "" { |
221
|
|
|
o.Option = pointers.String(v.Option) |
222
|
|
|
} |
223
|
|
|
o.Values = v.Values |
224
|
|
|
return o |
225
|
|
|
} |
226
|
|
|
|
227
|
|
|
type Tag struct { |
|
|
|
|
228
|
|
|
Key string |
229
|
|
|
Value string |
230
|
|
|
} |
231
|
|
|
|
232
|
|
|
func (r Tag) ToSDK() SDK.Tag { |
|
|
|
|
233
|
|
|
o := SDK.Tag{} |
234
|
|
|
|
235
|
|
|
if r.Key != "" { |
236
|
|
|
o.Key = pointers.String(r.Key) |
237
|
|
|
} |
238
|
|
|
if r.Value != "" { |
239
|
|
|
o.Value = pointers.String(r.Value) |
240
|
|
|
} |
241
|
|
|
return o |
242
|
|
|
} |
243
|
|
|
|