-
Notifications
You must be signed in to change notification settings - Fork 17
/
parameter.go
427 lines (394 loc) · 18.2 KB
/
parameter.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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
// Code generated by pulumi-language-go DO NOT EDIT.
// *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
package ssm
import (
"context"
"reflect"
"errors"
"github.com/pulumi/pulumi-aws-native/sdk/go/aws/internal"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// The “AWS::SSM::Parameter“ resource creates an SSM parameter in SYSlong Parameter Store.
//
// To create an SSM parameter, you must have the IAMlong (IAM) permissions ``ssm:PutParameter`` and ``ssm:AddTagsToResource``. On stack creation, CFNlong adds the following three tags to the parameter: ``aws:cloudformation:stack-name``, ``aws:cloudformation:logical-id``, and ``aws:cloudformation:stack-id``, in addition to any custom tags you specify.
// To add, update, or remove tags during stack update, you must have IAM permissions for both ``ssm:AddTagsToResource`` and ``ssm:RemoveTagsFromResource``. For more information, see [Managing Access Using Policies](https://docs.aws.amazon.com/systems-manager/latest/userguide/security-iam.html#security_iam_access-manage) in the *User Guide*.
// For information about valid values for parameters, see [About requirements and constraints for parameter names](https://docs.aws.amazon.com/systems-manager/latest/userguide/sysman-paramstore-su-create.html#sysman-parameter-name-constraints) in the *User Guide* and [PutParameter](https://docs.aws.amazon.com/systems-manager/latest/APIReference/API_PutParameter.html) in the *API Reference*.
//
// ## Example Usage
// ### Example
//
// ```go
// package main
//
// import (
//
// "github.com/pulumi/pulumi-aws-native/sdk/go/aws/ssm"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := ssm.NewParameter(ctx, "basicParameter", &ssm.ParameterArgs{
// Name: pulumi.String("command"),
// Type: ssm.ParameterTypeString,
// Value: pulumi.String("date"),
// Description: pulumi.String("SSM Parameter for running date command."),
// AllowedPattern: pulumi.String("^[a-zA-Z]{1,10}$"),
// Tags: pulumi.StringMap{
// "environment": pulumi.String("DEV"),
// },
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
// ### Example
//
// ```go
// package main
//
// import (
//
// "github.com/pulumi/pulumi-aws-native/sdk/go/aws/ssm"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := ssm.NewParameter(ctx, "basicParameter", &ssm.ParameterArgs{
// Name: pulumi.String("command"),
// Type: ssm.ParameterTypeString,
// Value: pulumi.String("date"),
// Description: pulumi.String("SSM Parameter for running date command."),
// AllowedPattern: pulumi.String("^[a-zA-Z]{1,10}$"),
// Tags: pulumi.StringMap{
// "environment": pulumi.String("DEV"),
// },
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
// ### Example
//
// ```go
// package main
//
// import (
//
// "github.com/pulumi/pulumi-aws-native/sdk/go/aws/ssm"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := ssm.NewParameter(ctx, "basicParameter", &ssm.ParameterArgs{
// Name: pulumi.String("commands"),
// Type: ssm.ParameterTypeStringList,
// Value: pulumi.String("date,ls"),
// Description: pulumi.String("SSM Parameter of type StringList."),
// AllowedPattern: pulumi.String("^[a-zA-Z]{1,10}$"),
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
// ### Example
//
// ```go
// package main
//
// import (
//
// "github.com/pulumi/pulumi-aws-native/sdk/go/aws/ssm"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := ssm.NewParameter(ctx, "basicParameter", &ssm.ParameterArgs{
// Name: pulumi.String("commands"),
// Type: ssm.ParameterTypeStringList,
// Value: pulumi.String("date,ls"),
// Description: pulumi.String("SSM Parameter of type StringList."),
// AllowedPattern: pulumi.String("^[a-zA-Z]{1,10}$"),
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
// ### Example
//
// ```go
// package main
//
// import (
//
// "github.com/pulumi/pulumi-aws-native/sdk/go/aws/ssm"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := ssm.NewParameter(ctx, "basicParameter", &ssm.ParameterArgs{
// Name: pulumi.String("command"),
// Type: ssm.ParameterTypeString,
// Value: pulumi.String("date"),
// Tier: ssm.ParameterTierAdvanced,
// Policies: pulumi.String("[{\"Type\":\"Expiration\",\"Version\":\"1.0\",\"Attributes\":{\"Timestamp\":\"2020-05-13T00:00:00.000Z\"}},{\"Type\":\"ExpirationNotification\",\"Version\":\"1.0\",\"Attributes\":{\"Before\":\"5\",\"Unit\":\"Days\"}},{\"Type\":\"NoChangeNotification\",\"Version\":\"1.0\",\"Attributes\":{\"After\":\"60\",\"Unit\":\"Days\"}}]"),
// Description: pulumi.String("SSM Parameter for running date command."),
// AllowedPattern: pulumi.String("^[a-zA-Z]{1,10}$"),
// Tags: pulumi.StringMap{
// "environment": pulumi.String("DEV"),
// },
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
// ### Example
//
// ```go
// package main
//
// import (
//
// "github.com/pulumi/pulumi-aws-native/sdk/go/aws/ssm"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := ssm.NewParameter(ctx, "basicParameter", &ssm.ParameterArgs{
// Name: pulumi.String("command"),
// Type: ssm.ParameterTypeString,
// Value: pulumi.String("date"),
// Tier: ssm.ParameterTierAdvanced,
// Policies: pulumi.String("[{\"Type\":\"Expiration\",\"Version\":\"1.0\",\"Attributes\":{\"Timestamp\":\"2020-05-13T00:00:00.000Z\"}},{\"Type\":\"ExpirationNotification\",\"Version\":\"1.0\",\"Attributes\":{\"Before\":\"5\",\"Unit\":\"Days\"}},{\"Type\":\"NoChangeNotification\",\"Version\":\"1.0\",\"Attributes\":{\"After\":\"60\",\"Unit\":\"Days\"}}]"),
// Description: pulumi.String("SSM Parameter for running date command."),
// AllowedPattern: pulumi.String("^[a-zA-Z]{1,10}$"),
// Tags: pulumi.StringMap{
// "environment": pulumi.String("DEV"),
// },
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
type Parameter struct {
pulumi.CustomResourceState
// A regular expression used to validate the parameter value. For example, for ``String`` types with values restricted to numbers, you can specify the following: ``AllowedPattern=^\d+$``
AllowedPattern pulumi.StringPtrOutput `pulumi:"allowedPattern"`
// The data type of the parameter, such as ``text`` or ``aws:ec2:image``. The default is ``text``.
DataType ParameterDataTypePtrOutput `pulumi:"dataType"`
// Information about the parameter.
Description pulumi.StringPtrOutput `pulumi:"description"`
// The name of the parameter.
// The maximum length constraint listed below includes capacity for additional system attributes that aren't part of the name. The maximum length for a parameter name, including the full length of the parameter Amazon Resource Name (ARN), is 1011 characters. For example, the length of the following parameter name is 65 characters, not 20 characters: ``arn:aws:ssm:us-east-2:111222333444:parameter/ExampleParameterName``
Name pulumi.StringPtrOutput `pulumi:"name"`
// Information about the policies assigned to a parameter.
// [Assigning parameter policies](https://docs.aws.amazon.com/systems-manager/latest/userguide/parameter-store-policies.html) in the *User Guide*.
Policies pulumi.StringPtrOutput `pulumi:"policies"`
// Optional metadata that you assign to a resource in the form of an arbitrary set of tags (key-value pairs). Tags enable you to categorize a resource in different ways, such as by purpose, owner, or environment. For example, you might want to tag a SYS parameter to identify the type of resource to which it applies, the environment, or the type of configuration data referenced by the parameter.
Tags pulumi.StringMapOutput `pulumi:"tags"`
// The parameter tier.
Tier ParameterTierPtrOutput `pulumi:"tier"`
// The type of parameter.
Type ParameterTypeOutput `pulumi:"type"`
// The parameter value.
// If type is ``StringList``, the system returns a comma-separated string with no spaces between commas in the ``Value`` field.
Value pulumi.StringOutput `pulumi:"value"`
}
// NewParameter registers a new resource with the given unique name, arguments, and options.
func NewParameter(ctx *pulumi.Context,
name string, args *ParameterArgs, opts ...pulumi.ResourceOption) (*Parameter, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.Type == nil {
return nil, errors.New("invalid value for required argument 'Type'")
}
if args.Value == nil {
return nil, errors.New("invalid value for required argument 'Value'")
}
replaceOnChanges := pulumi.ReplaceOnChanges([]string{
"name",
})
opts = append(opts, replaceOnChanges)
opts = internal.PkgResourceDefaultOpts(opts)
var resource Parameter
err := ctx.RegisterResource("aws-native:ssm:Parameter", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetParameter gets an existing Parameter resource's state with the given name, ID, and optional
// state properties that are used to uniquely qualify the lookup (nil if not required).
func GetParameter(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *ParameterState, opts ...pulumi.ResourceOption) (*Parameter, error) {
var resource Parameter
err := ctx.ReadResource("aws-native:ssm:Parameter", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering Parameter resources.
type parameterState struct {
}
type ParameterState struct {
}
func (ParameterState) ElementType() reflect.Type {
return reflect.TypeOf((*parameterState)(nil)).Elem()
}
type parameterArgs struct {
// A regular expression used to validate the parameter value. For example, for ``String`` types with values restricted to numbers, you can specify the following: ``AllowedPattern=^\d+$``
AllowedPattern *string `pulumi:"allowedPattern"`
// The data type of the parameter, such as ``text`` or ``aws:ec2:image``. The default is ``text``.
DataType *ParameterDataType `pulumi:"dataType"`
// Information about the parameter.
Description *string `pulumi:"description"`
// The name of the parameter.
// The maximum length constraint listed below includes capacity for additional system attributes that aren't part of the name. The maximum length for a parameter name, including the full length of the parameter Amazon Resource Name (ARN), is 1011 characters. For example, the length of the following parameter name is 65 characters, not 20 characters: ``arn:aws:ssm:us-east-2:111222333444:parameter/ExampleParameterName``
Name *string `pulumi:"name"`
// Information about the policies assigned to a parameter.
// [Assigning parameter policies](https://docs.aws.amazon.com/systems-manager/latest/userguide/parameter-store-policies.html) in the *User Guide*.
Policies *string `pulumi:"policies"`
// Optional metadata that you assign to a resource in the form of an arbitrary set of tags (key-value pairs). Tags enable you to categorize a resource in different ways, such as by purpose, owner, or environment. For example, you might want to tag a SYS parameter to identify the type of resource to which it applies, the environment, or the type of configuration data referenced by the parameter.
Tags map[string]string `pulumi:"tags"`
// The parameter tier.
Tier *ParameterTier `pulumi:"tier"`
// The type of parameter.
Type ParameterType `pulumi:"type"`
// The parameter value.
// If type is ``StringList``, the system returns a comma-separated string with no spaces between commas in the ``Value`` field.
Value string `pulumi:"value"`
}
// The set of arguments for constructing a Parameter resource.
type ParameterArgs struct {
// A regular expression used to validate the parameter value. For example, for ``String`` types with values restricted to numbers, you can specify the following: ``AllowedPattern=^\d+$``
AllowedPattern pulumi.StringPtrInput
// The data type of the parameter, such as ``text`` or ``aws:ec2:image``. The default is ``text``.
DataType ParameterDataTypePtrInput
// Information about the parameter.
Description pulumi.StringPtrInput
// The name of the parameter.
// The maximum length constraint listed below includes capacity for additional system attributes that aren't part of the name. The maximum length for a parameter name, including the full length of the parameter Amazon Resource Name (ARN), is 1011 characters. For example, the length of the following parameter name is 65 characters, not 20 characters: ``arn:aws:ssm:us-east-2:111222333444:parameter/ExampleParameterName``
Name pulumi.StringPtrInput
// Information about the policies assigned to a parameter.
// [Assigning parameter policies](https://docs.aws.amazon.com/systems-manager/latest/userguide/parameter-store-policies.html) in the *User Guide*.
Policies pulumi.StringPtrInput
// Optional metadata that you assign to a resource in the form of an arbitrary set of tags (key-value pairs). Tags enable you to categorize a resource in different ways, such as by purpose, owner, or environment. For example, you might want to tag a SYS parameter to identify the type of resource to which it applies, the environment, or the type of configuration data referenced by the parameter.
Tags pulumi.StringMapInput
// The parameter tier.
Tier ParameterTierPtrInput
// The type of parameter.
Type ParameterTypeInput
// The parameter value.
// If type is ``StringList``, the system returns a comma-separated string with no spaces between commas in the ``Value`` field.
Value pulumi.StringInput
}
func (ParameterArgs) ElementType() reflect.Type {
return reflect.TypeOf((*parameterArgs)(nil)).Elem()
}
type ParameterInput interface {
pulumi.Input
ToParameterOutput() ParameterOutput
ToParameterOutputWithContext(ctx context.Context) ParameterOutput
}
func (*Parameter) ElementType() reflect.Type {
return reflect.TypeOf((**Parameter)(nil)).Elem()
}
func (i *Parameter) ToParameterOutput() ParameterOutput {
return i.ToParameterOutputWithContext(context.Background())
}
func (i *Parameter) ToParameterOutputWithContext(ctx context.Context) ParameterOutput {
return pulumi.ToOutputWithContext(ctx, i).(ParameterOutput)
}
type ParameterOutput struct{ *pulumi.OutputState }
func (ParameterOutput) ElementType() reflect.Type {
return reflect.TypeOf((**Parameter)(nil)).Elem()
}
func (o ParameterOutput) ToParameterOutput() ParameterOutput {
return o
}
func (o ParameterOutput) ToParameterOutputWithContext(ctx context.Context) ParameterOutput {
return o
}
// A regular expression used to validate the parameter value. For example, for “String“ types with values restricted to numbers, you can specify the following: “AllowedPattern=^\d+$“
func (o ParameterOutput) AllowedPattern() pulumi.StringPtrOutput {
return o.ApplyT(func(v *Parameter) pulumi.StringPtrOutput { return v.AllowedPattern }).(pulumi.StringPtrOutput)
}
// The data type of the parameter, such as “text“ or “aws:ec2:image“. The default is “text“.
func (o ParameterOutput) DataType() ParameterDataTypePtrOutput {
return o.ApplyT(func(v *Parameter) ParameterDataTypePtrOutput { return v.DataType }).(ParameterDataTypePtrOutput)
}
// Information about the parameter.
func (o ParameterOutput) Description() pulumi.StringPtrOutput {
return o.ApplyT(func(v *Parameter) pulumi.StringPtrOutput { return v.Description }).(pulumi.StringPtrOutput)
}
// The name of the parameter.
//
// The maximum length constraint listed below includes capacity for additional system attributes that aren't part of the name. The maximum length for a parameter name, including the full length of the parameter Amazon Resource Name (ARN), is 1011 characters. For example, the length of the following parameter name is 65 characters, not 20 characters: ``arn:aws:ssm:us-east-2:111222333444:parameter/ExampleParameterName``
func (o ParameterOutput) Name() pulumi.StringPtrOutput {
return o.ApplyT(func(v *Parameter) pulumi.StringPtrOutput { return v.Name }).(pulumi.StringPtrOutput)
}
// Information about the policies assigned to a parameter.
//
// [Assigning parameter policies](https://docs.aws.amazon.com/systems-manager/latest/userguide/parameter-store-policies.html) in the *User Guide*.
func (o ParameterOutput) Policies() pulumi.StringPtrOutput {
return o.ApplyT(func(v *Parameter) pulumi.StringPtrOutput { return v.Policies }).(pulumi.StringPtrOutput)
}
// Optional metadata that you assign to a resource in the form of an arbitrary set of tags (key-value pairs). Tags enable you to categorize a resource in different ways, such as by purpose, owner, or environment. For example, you might want to tag a SYS parameter to identify the type of resource to which it applies, the environment, or the type of configuration data referenced by the parameter.
func (o ParameterOutput) Tags() pulumi.StringMapOutput {
return o.ApplyT(func(v *Parameter) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput)
}
// The parameter tier.
func (o ParameterOutput) Tier() ParameterTierPtrOutput {
return o.ApplyT(func(v *Parameter) ParameterTierPtrOutput { return v.Tier }).(ParameterTierPtrOutput)
}
// The type of parameter.
func (o ParameterOutput) Type() ParameterTypeOutput {
return o.ApplyT(func(v *Parameter) ParameterTypeOutput { return v.Type }).(ParameterTypeOutput)
}
// The parameter value.
//
// If type is ``StringList``, the system returns a comma-separated string with no spaces between commas in the ``Value`` field.
func (o ParameterOutput) Value() pulumi.StringOutput {
return o.ApplyT(func(v *Parameter) pulumi.StringOutput { return v.Value }).(pulumi.StringOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*ParameterInput)(nil)).Elem(), &Parameter{})
pulumi.RegisterOutputType(ParameterOutput{})
}