-
Notifications
You must be signed in to change notification settings - Fork 17
/
awsiam_SamlPrincipal.go
291 lines (252 loc) · 6.67 KB
/
awsiam_SamlPrincipal.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
package awsiam
import (
_init_ "github.com/aws/aws-cdk-go/awscdk/jsii"
_jsii_ "github.com/aws/jsii-runtime-go/runtime"
)
// Principal entity that represents a SAML federated identity provider.
//
// Example:
// provider := iam.NewSamlProvider(this, jsii.String("Provider"), &samlProviderProps{
// metadataDocument: iam.samlMetadataDocument.fromFile(jsii.String("/path/to/saml-metadata-document.xml")),
// })
// principal := iam.NewSamlPrincipal(provider, map[string]interface{}{
// "StringEquals": map[string]*string{
// "SAML:iss": jsii.String("issuer"),
// },
// })
//
// Experimental.
type SamlPrincipal interface {
FederatedPrincipal
// When this Principal is used in an AssumeRole policy, the action to use.
// Experimental.
AssumeRoleAction() *string
// The conditions under which the policy is in effect.
//
// See [the IAM documentation](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_condition.html).
// Experimental.
Conditions() *map[string]interface{}
// federated identity provider (i.e. 'cognito-identity.amazonaws.com' for users authenticated through Cognito).
// Experimental.
Federated() *string
// The principal to grant permissions to.
// Experimental.
GrantPrincipal() IPrincipal
// Return the policy fragment that identifies this principal in a Policy.
// Experimental.
PolicyFragment() PrincipalPolicyFragment
// The AWS account ID of this principal.
//
// Can be undefined when the account is not known
// (for example, for service principals).
// Can be a Token - in that case,
// it's assumed to be AWS::AccountId.
// Experimental.
PrincipalAccount() *string
// Add the princpial to the AssumeRolePolicyDocument.
//
// Add the statements to the AssumeRolePolicyDocument necessary to give this principal
// permissions to assume the given role.
// Experimental.
AddToAssumeRolePolicy(document PolicyDocument)
// Add to the policy of this principal.
// Experimental.
AddToPolicy(statement PolicyStatement) *bool
// Add to the policy of this principal.
// Experimental.
AddToPrincipalPolicy(_statement PolicyStatement) *AddToPrincipalPolicyResult
// Return whether or not this principal is equal to the given principal.
// Experimental.
DedupeString() *string
// JSON-ify the principal.
//
// Used when JSON.stringify() is called
// Experimental.
ToJSON() *map[string]*[]*string
// Returns a string representation of an object.
// Experimental.
ToString() *string
// Returns a new PrincipalWithConditions using this principal as the base, with the passed conditions added.
//
// When there is a value for the same operator and key in both the principal and the
// conditions parameter, the value from the conditions parameter will be used.
//
// Returns: a new PrincipalWithConditions object.
// Experimental.
WithConditions(conditions *map[string]interface{}) PrincipalBase
// Returns a new principal using this principal as the base, with session tags enabled.
//
// Returns: a new SessionTagsPrincipal object.
// Experimental.
WithSessionTags() PrincipalBase
}
// The jsii proxy struct for SamlPrincipal
type jsiiProxy_SamlPrincipal struct {
jsiiProxy_FederatedPrincipal
}
func (j *jsiiProxy_SamlPrincipal) AssumeRoleAction() *string {
var returns *string
_jsii_.Get(
j,
"assumeRoleAction",
&returns,
)
return returns
}
func (j *jsiiProxy_SamlPrincipal) Conditions() *map[string]interface{} {
var returns *map[string]interface{}
_jsii_.Get(
j,
"conditions",
&returns,
)
return returns
}
func (j *jsiiProxy_SamlPrincipal) Federated() *string {
var returns *string
_jsii_.Get(
j,
"federated",
&returns,
)
return returns
}
func (j *jsiiProxy_SamlPrincipal) GrantPrincipal() IPrincipal {
var returns IPrincipal
_jsii_.Get(
j,
"grantPrincipal",
&returns,
)
return returns
}
func (j *jsiiProxy_SamlPrincipal) PolicyFragment() PrincipalPolicyFragment {
var returns PrincipalPolicyFragment
_jsii_.Get(
j,
"policyFragment",
&returns,
)
return returns
}
func (j *jsiiProxy_SamlPrincipal) PrincipalAccount() *string {
var returns *string
_jsii_.Get(
j,
"principalAccount",
&returns,
)
return returns
}
// Experimental.
func NewSamlPrincipal(samlProvider ISamlProvider, conditions *map[string]interface{}) SamlPrincipal {
_init_.Initialize()
if err := validateNewSamlPrincipalParameters(samlProvider, conditions); err != nil {
panic(err)
}
j := jsiiProxy_SamlPrincipal{}
_jsii_.Create(
"monocdk.aws_iam.SamlPrincipal",
[]interface{}{samlProvider, conditions},
&j,
)
return &j
}
// Experimental.
func NewSamlPrincipal_Override(s SamlPrincipal, samlProvider ISamlProvider, conditions *map[string]interface{}) {
_init_.Initialize()
_jsii_.Create(
"monocdk.aws_iam.SamlPrincipal",
[]interface{}{samlProvider, conditions},
s,
)
}
func (s *jsiiProxy_SamlPrincipal) AddToAssumeRolePolicy(document PolicyDocument) {
if err := s.validateAddToAssumeRolePolicyParameters(document); err != nil {
panic(err)
}
_jsii_.InvokeVoid(
s,
"addToAssumeRolePolicy",
[]interface{}{document},
)
}
func (s *jsiiProxy_SamlPrincipal) AddToPolicy(statement PolicyStatement) *bool {
if err := s.validateAddToPolicyParameters(statement); err != nil {
panic(err)
}
var returns *bool
_jsii_.Invoke(
s,
"addToPolicy",
[]interface{}{statement},
&returns,
)
return returns
}
func (s *jsiiProxy_SamlPrincipal) AddToPrincipalPolicy(_statement PolicyStatement) *AddToPrincipalPolicyResult {
if err := s.validateAddToPrincipalPolicyParameters(_statement); err != nil {
panic(err)
}
var returns *AddToPrincipalPolicyResult
_jsii_.Invoke(
s,
"addToPrincipalPolicy",
[]interface{}{_statement},
&returns,
)
return returns
}
func (s *jsiiProxy_SamlPrincipal) DedupeString() *string {
var returns *string
_jsii_.Invoke(
s,
"dedupeString",
nil, // no parameters
&returns,
)
return returns
}
func (s *jsiiProxy_SamlPrincipal) ToJSON() *map[string]*[]*string {
var returns *map[string]*[]*string
_jsii_.Invoke(
s,
"toJSON",
nil, // no parameters
&returns,
)
return returns
}
func (s *jsiiProxy_SamlPrincipal) ToString() *string {
var returns *string
_jsii_.Invoke(
s,
"toString",
nil, // no parameters
&returns,
)
return returns
}
func (s *jsiiProxy_SamlPrincipal) WithConditions(conditions *map[string]interface{}) PrincipalBase {
if err := s.validateWithConditionsParameters(conditions); err != nil {
panic(err)
}
var returns PrincipalBase
_jsii_.Invoke(
s,
"withConditions",
[]interface{}{conditions},
&returns,
)
return returns
}
func (s *jsiiProxy_SamlPrincipal) WithSessionTags() PrincipalBase {
var returns PrincipalBase
_jsii_.Invoke(
s,
"withSessionTags",
nil, // no parameters
&returns,
)
return returns
}