/
policyTemplate.go
325 lines (274 loc) · 11.3 KB
/
policyTemplate.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
// Code generated by the Pulumi Terraform Bridge (tfgen) Tool DO NOT EDIT.
// *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
package verifiedpermissions
import (
"context"
"reflect"
"errors"
"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/internal"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Resource for managing an AWS Verified Permissions Policy Template.
//
// ## Example Usage
//
// ### Basic Usage
//
// <!--Start PulumiCodeChooser -->
// ```go
// package main
//
// import (
//
// "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/verifiedpermissions"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := verifiedpermissions.NewPolicyTemplate(ctx, "example", &verifiedpermissions.PolicyTemplateArgs{
// PolicyStoreId: pulumi.Any(exampleAwsVerifiedpermissionsPolicyStore.Id),
// Statement: pulumi.String("permit (principal in ?principal, action in PhotoFlash::Action::\"FullPhotoAccess\", resource == ?resource) unless { resource.IsPrivate };"),
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
// <!--End PulumiCodeChooser -->
//
// ## Import
//
// Using `pulumi import`, import Verified Permissions Policy Store using the `policy_store_id:policy_template_id`. For example:
//
// ```sh
// $ pulumi import aws:verifiedpermissions/policyTemplate:PolicyTemplate example policyStoreId:policyTemplateId
// ```
type PolicyTemplate struct {
pulumi.CustomResourceState
// The date the Policy Store was created.
CreatedDate pulumi.StringOutput `pulumi:"createdDate"`
// Provides a description for the policy template.
Description pulumi.StringPtrOutput `pulumi:"description"`
// The ID of the Policy Store.
PolicyStoreId pulumi.StringOutput `pulumi:"policyStoreId"`
// The ID of the Policy Store.
PolicyTemplateId pulumi.StringOutput `pulumi:"policyTemplateId"`
// Defines the content of the statement, written in Cedar policy language.
//
// The following arguments are optional:
Statement pulumi.StringOutput `pulumi:"statement"`
}
// NewPolicyTemplate registers a new resource with the given unique name, arguments, and options.
func NewPolicyTemplate(ctx *pulumi.Context,
name string, args *PolicyTemplateArgs, opts ...pulumi.ResourceOption) (*PolicyTemplate, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.PolicyStoreId == nil {
return nil, errors.New("invalid value for required argument 'PolicyStoreId'")
}
if args.Statement == nil {
return nil, errors.New("invalid value for required argument 'Statement'")
}
opts = internal.PkgResourceDefaultOpts(opts)
var resource PolicyTemplate
err := ctx.RegisterResource("aws:verifiedpermissions/policyTemplate:PolicyTemplate", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetPolicyTemplate gets an existing PolicyTemplate 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 GetPolicyTemplate(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *PolicyTemplateState, opts ...pulumi.ResourceOption) (*PolicyTemplate, error) {
var resource PolicyTemplate
err := ctx.ReadResource("aws:verifiedpermissions/policyTemplate:PolicyTemplate", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering PolicyTemplate resources.
type policyTemplateState struct {
// The date the Policy Store was created.
CreatedDate *string `pulumi:"createdDate"`
// Provides a description for the policy template.
Description *string `pulumi:"description"`
// The ID of the Policy Store.
PolicyStoreId *string `pulumi:"policyStoreId"`
// The ID of the Policy Store.
PolicyTemplateId *string `pulumi:"policyTemplateId"`
// Defines the content of the statement, written in Cedar policy language.
//
// The following arguments are optional:
Statement *string `pulumi:"statement"`
}
type PolicyTemplateState struct {
// The date the Policy Store was created.
CreatedDate pulumi.StringPtrInput
// Provides a description for the policy template.
Description pulumi.StringPtrInput
// The ID of the Policy Store.
PolicyStoreId pulumi.StringPtrInput
// The ID of the Policy Store.
PolicyTemplateId pulumi.StringPtrInput
// Defines the content of the statement, written in Cedar policy language.
//
// The following arguments are optional:
Statement pulumi.StringPtrInput
}
func (PolicyTemplateState) ElementType() reflect.Type {
return reflect.TypeOf((*policyTemplateState)(nil)).Elem()
}
type policyTemplateArgs struct {
// Provides a description for the policy template.
Description *string `pulumi:"description"`
// The ID of the Policy Store.
PolicyStoreId string `pulumi:"policyStoreId"`
// Defines the content of the statement, written in Cedar policy language.
//
// The following arguments are optional:
Statement string `pulumi:"statement"`
}
// The set of arguments for constructing a PolicyTemplate resource.
type PolicyTemplateArgs struct {
// Provides a description for the policy template.
Description pulumi.StringPtrInput
// The ID of the Policy Store.
PolicyStoreId pulumi.StringInput
// Defines the content of the statement, written in Cedar policy language.
//
// The following arguments are optional:
Statement pulumi.StringInput
}
func (PolicyTemplateArgs) ElementType() reflect.Type {
return reflect.TypeOf((*policyTemplateArgs)(nil)).Elem()
}
type PolicyTemplateInput interface {
pulumi.Input
ToPolicyTemplateOutput() PolicyTemplateOutput
ToPolicyTemplateOutputWithContext(ctx context.Context) PolicyTemplateOutput
}
func (*PolicyTemplate) ElementType() reflect.Type {
return reflect.TypeOf((**PolicyTemplate)(nil)).Elem()
}
func (i *PolicyTemplate) ToPolicyTemplateOutput() PolicyTemplateOutput {
return i.ToPolicyTemplateOutputWithContext(context.Background())
}
func (i *PolicyTemplate) ToPolicyTemplateOutputWithContext(ctx context.Context) PolicyTemplateOutput {
return pulumi.ToOutputWithContext(ctx, i).(PolicyTemplateOutput)
}
// PolicyTemplateArrayInput is an input type that accepts PolicyTemplateArray and PolicyTemplateArrayOutput values.
// You can construct a concrete instance of `PolicyTemplateArrayInput` via:
//
// PolicyTemplateArray{ PolicyTemplateArgs{...} }
type PolicyTemplateArrayInput interface {
pulumi.Input
ToPolicyTemplateArrayOutput() PolicyTemplateArrayOutput
ToPolicyTemplateArrayOutputWithContext(context.Context) PolicyTemplateArrayOutput
}
type PolicyTemplateArray []PolicyTemplateInput
func (PolicyTemplateArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*PolicyTemplate)(nil)).Elem()
}
func (i PolicyTemplateArray) ToPolicyTemplateArrayOutput() PolicyTemplateArrayOutput {
return i.ToPolicyTemplateArrayOutputWithContext(context.Background())
}
func (i PolicyTemplateArray) ToPolicyTemplateArrayOutputWithContext(ctx context.Context) PolicyTemplateArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(PolicyTemplateArrayOutput)
}
// PolicyTemplateMapInput is an input type that accepts PolicyTemplateMap and PolicyTemplateMapOutput values.
// You can construct a concrete instance of `PolicyTemplateMapInput` via:
//
// PolicyTemplateMap{ "key": PolicyTemplateArgs{...} }
type PolicyTemplateMapInput interface {
pulumi.Input
ToPolicyTemplateMapOutput() PolicyTemplateMapOutput
ToPolicyTemplateMapOutputWithContext(context.Context) PolicyTemplateMapOutput
}
type PolicyTemplateMap map[string]PolicyTemplateInput
func (PolicyTemplateMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*PolicyTemplate)(nil)).Elem()
}
func (i PolicyTemplateMap) ToPolicyTemplateMapOutput() PolicyTemplateMapOutput {
return i.ToPolicyTemplateMapOutputWithContext(context.Background())
}
func (i PolicyTemplateMap) ToPolicyTemplateMapOutputWithContext(ctx context.Context) PolicyTemplateMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(PolicyTemplateMapOutput)
}
type PolicyTemplateOutput struct{ *pulumi.OutputState }
func (PolicyTemplateOutput) ElementType() reflect.Type {
return reflect.TypeOf((**PolicyTemplate)(nil)).Elem()
}
func (o PolicyTemplateOutput) ToPolicyTemplateOutput() PolicyTemplateOutput {
return o
}
func (o PolicyTemplateOutput) ToPolicyTemplateOutputWithContext(ctx context.Context) PolicyTemplateOutput {
return o
}
// The date the Policy Store was created.
func (o PolicyTemplateOutput) CreatedDate() pulumi.StringOutput {
return o.ApplyT(func(v *PolicyTemplate) pulumi.StringOutput { return v.CreatedDate }).(pulumi.StringOutput)
}
// Provides a description for the policy template.
func (o PolicyTemplateOutput) Description() pulumi.StringPtrOutput {
return o.ApplyT(func(v *PolicyTemplate) pulumi.StringPtrOutput { return v.Description }).(pulumi.StringPtrOutput)
}
// The ID of the Policy Store.
func (o PolicyTemplateOutput) PolicyStoreId() pulumi.StringOutput {
return o.ApplyT(func(v *PolicyTemplate) pulumi.StringOutput { return v.PolicyStoreId }).(pulumi.StringOutput)
}
// The ID of the Policy Store.
func (o PolicyTemplateOutput) PolicyTemplateId() pulumi.StringOutput {
return o.ApplyT(func(v *PolicyTemplate) pulumi.StringOutput { return v.PolicyTemplateId }).(pulumi.StringOutput)
}
// Defines the content of the statement, written in Cedar policy language.
//
// The following arguments are optional:
func (o PolicyTemplateOutput) Statement() pulumi.StringOutput {
return o.ApplyT(func(v *PolicyTemplate) pulumi.StringOutput { return v.Statement }).(pulumi.StringOutput)
}
type PolicyTemplateArrayOutput struct{ *pulumi.OutputState }
func (PolicyTemplateArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*PolicyTemplate)(nil)).Elem()
}
func (o PolicyTemplateArrayOutput) ToPolicyTemplateArrayOutput() PolicyTemplateArrayOutput {
return o
}
func (o PolicyTemplateArrayOutput) ToPolicyTemplateArrayOutputWithContext(ctx context.Context) PolicyTemplateArrayOutput {
return o
}
func (o PolicyTemplateArrayOutput) Index(i pulumi.IntInput) PolicyTemplateOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *PolicyTemplate {
return vs[0].([]*PolicyTemplate)[vs[1].(int)]
}).(PolicyTemplateOutput)
}
type PolicyTemplateMapOutput struct{ *pulumi.OutputState }
func (PolicyTemplateMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*PolicyTemplate)(nil)).Elem()
}
func (o PolicyTemplateMapOutput) ToPolicyTemplateMapOutput() PolicyTemplateMapOutput {
return o
}
func (o PolicyTemplateMapOutput) ToPolicyTemplateMapOutputWithContext(ctx context.Context) PolicyTemplateMapOutput {
return o
}
func (o PolicyTemplateMapOutput) MapIndex(k pulumi.StringInput) PolicyTemplateOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *PolicyTemplate {
return vs[0].(map[string]*PolicyTemplate)[vs[1].(string)]
}).(PolicyTemplateOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*PolicyTemplateInput)(nil)).Elem(), &PolicyTemplate{})
pulumi.RegisterInputType(reflect.TypeOf((*PolicyTemplateArrayInput)(nil)).Elem(), PolicyTemplateArray{})
pulumi.RegisterInputType(reflect.TypeOf((*PolicyTemplateMapInput)(nil)).Elem(), PolicyTemplateMap{})
pulumi.RegisterOutputType(PolicyTemplateOutput{})
pulumi.RegisterOutputType(PolicyTemplateArrayOutput{})
pulumi.RegisterOutputType(PolicyTemplateMapOutput{})
}