This repository has been archived by the owner on Jun 1, 2022. It is now read-only.
generated from pulumi/pulumi-component-provider-go-boilerplate
/
assumableRole.go
252 lines (210 loc) · 8.86 KB
/
assumableRole.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
// Code generated by Pulumi SDK Generator DO NOT EDIT.
// *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
package awsiam
import (
"context"
"reflect"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
type AssumableRole struct {
pulumi.ResourceState
InstanceProfile pulumi.StringMapOutput `pulumi:"instanceProfile"`
Role pulumi.StringMapOutput `pulumi:"role"`
}
// NewAssumableRole registers a new resource with the given unique name, arguments, and options.
func NewAssumableRole(ctx *pulumi.Context,
name string, args *AssumableRoleArgs, opts ...pulumi.ResourceOption) (*AssumableRole, error) {
if args == nil {
args = &AssumableRoleArgs{}
}
if isZero(args.AttachAdminPolicy) {
args.AttachAdminPolicy = pulumi.BoolPtr(false)
}
if isZero(args.AttachPoweruserPolicy) {
args.AttachPoweruserPolicy = pulumi.BoolPtr(false)
}
if isZero(args.AttachReadonlyPolicy) {
args.AttachReadonlyPolicy = pulumi.BoolPtr(false)
}
if isZero(args.CustomRoleTrustPolicy) {
args.CustomRoleTrustPolicy = pulumi.StringPtr("")
}
if isZero(args.ForceDetachPolicies) {
args.ForceDetachPolicies = pulumi.BoolPtr(false)
}
if isZero(args.MaxSessionDuration) {
args.MaxSessionDuration = pulumi.IntPtr(3600)
}
if isZero(args.MfaAge) {
args.MfaAge = pulumi.IntPtr(86400)
}
if args.Role != nil {
args.Role = args.Role.ToRoleWithMFAPtrOutput().ApplyT(func(v *RoleWithMFA) *RoleWithMFA { return v.Defaults() }).(RoleWithMFAPtrOutput)
}
var resource AssumableRole
err := ctx.RegisterRemoteComponentResource("aws-iam:index:AssumableRole", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
type assumableRoleArgs struct {
// Whether to attach an admin policy to a role.
AttachAdminPolicy *bool `pulumi:"attachAdminPolicy"`
// Whether to attach a poweruser policy to a role.
AttachPoweruserPolicy *bool `pulumi:"attachPoweruserPolicy"`
// Whether to attach a readonly policy to a role.
AttachReadonlyPolicy *bool `pulumi:"attachReadonlyPolicy"`
// A custom role trust policy.
CustomRoleTrustPolicy *string `pulumi:"customRoleTrustPolicy"`
// Whether policies should be detached from this role when destroying.
ForceDetachPolicies *bool `pulumi:"forceDetachPolicies"`
// Maximum CLI/API session duration in seconds between 3600 and 43200.
MaxSessionDuration *int `pulumi:"maxSessionDuration"`
// Max age of valid MFA (in seconds) for roles which require MFA.
MfaAge *int `pulumi:"mfaAge"`
// An IAM role that requires MFA.
Role *RoleWithMFA `pulumi:"role"`
// STS ExternalId condition values to use with a role (when MFA is not required).
RoleStsExternalIds []string `pulumi:"roleStsExternalIds"`
// A map of tags to add.
Tags map[string]string `pulumi:"tags"`
// Actions of STS.
TrustedRoleActions []string `pulumi:"trustedRoleActions"`
// ARNs of AWS entities who can assume these roles.
TrustedRoleArns []string `pulumi:"trustedRoleArns"`
// AWS Services that can assume these roles.
TrustedRoleServices []string `pulumi:"trustedRoleServices"`
}
// The set of arguments for constructing a AssumableRole resource.
type AssumableRoleArgs struct {
// Whether to attach an admin policy to a role.
AttachAdminPolicy pulumi.BoolPtrInput
// Whether to attach a poweruser policy to a role.
AttachPoweruserPolicy pulumi.BoolPtrInput
// Whether to attach a readonly policy to a role.
AttachReadonlyPolicy pulumi.BoolPtrInput
// A custom role trust policy.
CustomRoleTrustPolicy pulumi.StringPtrInput
// Whether policies should be detached from this role when destroying.
ForceDetachPolicies pulumi.BoolPtrInput
// Maximum CLI/API session duration in seconds between 3600 and 43200.
MaxSessionDuration pulumi.IntPtrInput
// Max age of valid MFA (in seconds) for roles which require MFA.
MfaAge pulumi.IntPtrInput
// An IAM role that requires MFA.
Role RoleWithMFAPtrInput
// STS ExternalId condition values to use with a role (when MFA is not required).
RoleStsExternalIds pulumi.StringArrayInput
// A map of tags to add.
Tags pulumi.StringMapInput
// Actions of STS.
TrustedRoleActions pulumi.StringArrayInput
// ARNs of AWS entities who can assume these roles.
TrustedRoleArns pulumi.StringArrayInput
// AWS Services that can assume these roles.
TrustedRoleServices pulumi.StringArrayInput
}
func (AssumableRoleArgs) ElementType() reflect.Type {
return reflect.TypeOf((*assumableRoleArgs)(nil)).Elem()
}
type AssumableRoleInput interface {
pulumi.Input
ToAssumableRoleOutput() AssumableRoleOutput
ToAssumableRoleOutputWithContext(ctx context.Context) AssumableRoleOutput
}
func (*AssumableRole) ElementType() reflect.Type {
return reflect.TypeOf((**AssumableRole)(nil)).Elem()
}
func (i *AssumableRole) ToAssumableRoleOutput() AssumableRoleOutput {
return i.ToAssumableRoleOutputWithContext(context.Background())
}
func (i *AssumableRole) ToAssumableRoleOutputWithContext(ctx context.Context) AssumableRoleOutput {
return pulumi.ToOutputWithContext(ctx, i).(AssumableRoleOutput)
}
// AssumableRoleArrayInput is an input type that accepts AssumableRoleArray and AssumableRoleArrayOutput values.
// You can construct a concrete instance of `AssumableRoleArrayInput` via:
//
// AssumableRoleArray{ AssumableRoleArgs{...} }
type AssumableRoleArrayInput interface {
pulumi.Input
ToAssumableRoleArrayOutput() AssumableRoleArrayOutput
ToAssumableRoleArrayOutputWithContext(context.Context) AssumableRoleArrayOutput
}
type AssumableRoleArray []AssumableRoleInput
func (AssumableRoleArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*AssumableRole)(nil)).Elem()
}
func (i AssumableRoleArray) ToAssumableRoleArrayOutput() AssumableRoleArrayOutput {
return i.ToAssumableRoleArrayOutputWithContext(context.Background())
}
func (i AssumableRoleArray) ToAssumableRoleArrayOutputWithContext(ctx context.Context) AssumableRoleArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(AssumableRoleArrayOutput)
}
// AssumableRoleMapInput is an input type that accepts AssumableRoleMap and AssumableRoleMapOutput values.
// You can construct a concrete instance of `AssumableRoleMapInput` via:
//
// AssumableRoleMap{ "key": AssumableRoleArgs{...} }
type AssumableRoleMapInput interface {
pulumi.Input
ToAssumableRoleMapOutput() AssumableRoleMapOutput
ToAssumableRoleMapOutputWithContext(context.Context) AssumableRoleMapOutput
}
type AssumableRoleMap map[string]AssumableRoleInput
func (AssumableRoleMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*AssumableRole)(nil)).Elem()
}
func (i AssumableRoleMap) ToAssumableRoleMapOutput() AssumableRoleMapOutput {
return i.ToAssumableRoleMapOutputWithContext(context.Background())
}
func (i AssumableRoleMap) ToAssumableRoleMapOutputWithContext(ctx context.Context) AssumableRoleMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(AssumableRoleMapOutput)
}
type AssumableRoleOutput struct{ *pulumi.OutputState }
func (AssumableRoleOutput) ElementType() reflect.Type {
return reflect.TypeOf((**AssumableRole)(nil)).Elem()
}
func (o AssumableRoleOutput) ToAssumableRoleOutput() AssumableRoleOutput {
return o
}
func (o AssumableRoleOutput) ToAssumableRoleOutputWithContext(ctx context.Context) AssumableRoleOutput {
return o
}
type AssumableRoleArrayOutput struct{ *pulumi.OutputState }
func (AssumableRoleArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*AssumableRole)(nil)).Elem()
}
func (o AssumableRoleArrayOutput) ToAssumableRoleArrayOutput() AssumableRoleArrayOutput {
return o
}
func (o AssumableRoleArrayOutput) ToAssumableRoleArrayOutputWithContext(ctx context.Context) AssumableRoleArrayOutput {
return o
}
func (o AssumableRoleArrayOutput) Index(i pulumi.IntInput) AssumableRoleOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *AssumableRole {
return vs[0].([]*AssumableRole)[vs[1].(int)]
}).(AssumableRoleOutput)
}
type AssumableRoleMapOutput struct{ *pulumi.OutputState }
func (AssumableRoleMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*AssumableRole)(nil)).Elem()
}
func (o AssumableRoleMapOutput) ToAssumableRoleMapOutput() AssumableRoleMapOutput {
return o
}
func (o AssumableRoleMapOutput) ToAssumableRoleMapOutputWithContext(ctx context.Context) AssumableRoleMapOutput {
return o
}
func (o AssumableRoleMapOutput) MapIndex(k pulumi.StringInput) AssumableRoleOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *AssumableRole {
return vs[0].(map[string]*AssumableRole)[vs[1].(string)]
}).(AssumableRoleOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*AssumableRoleInput)(nil)).Elem(), &AssumableRole{})
pulumi.RegisterInputType(reflect.TypeOf((*AssumableRoleArrayInput)(nil)).Elem(), AssumableRoleArray{})
pulumi.RegisterInputType(reflect.TypeOf((*AssumableRoleMapInput)(nil)).Elem(), AssumableRoleMap{})
pulumi.RegisterOutputType(AssumableRoleOutput{})
pulumi.RegisterOutputType(AssumableRoleArrayOutput{})
pulumi.RegisterOutputType(AssumableRoleMapOutput{})
}