Module: AWSCDK::IAM::IUser

Includes:
IIdentity, AWSCDK::Interfaces::AWSIAM::IUserRef
Included in:
User
Defined in:
iam/i_user.rb

Overview

Represents an IAM user.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.jsii_overridable_methodsObject



163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
# File 'iam/i_user.rb', line 163

def self.jsii_overridable_methods
  {
    :grant_principal => { kind: :property, name: "grantPrincipal", is_optional: false },
    :assume_role_action => { kind: :property, name: "assumeRoleAction", is_optional: false },
    :policy_fragment => { kind: :property, name: "policyFragment", is_optional: false },
    :principal_account => { kind: :property, name: "principalAccount", is_optional: true },
    :node => { kind: :property, name: "node", is_optional: false },
    :env => { kind: :property, name: "env", is_optional: false },
    :stack => { kind: :property, name: "stack", is_optional: false },
    :user_ref => { kind: :property, name: "userRef", is_optional: false },
    :user_arn => { kind: :property, name: "userArn", is_optional: false },
    :user_name => { kind: :property, name: "userName", is_optional: false },
    :add_to_principal_policy => { kind: :method, name: "addToPrincipalPolicy", is_optional: false },
    :with => { kind: :method, name: "with", is_optional: false },
    :apply_removal_policy => { kind: :method, name: "applyRemovalPolicy", is_optional: false },
    :add_managed_policy => { kind: :method, name: "addManagedPolicy", is_optional: false },
    :attach_inline_policy => { kind: :method, name: "attachInlinePolicy", is_optional: false },
    :add_to_group => { kind: :method, name: "addToGroup", is_optional: false },
  }
end

Instance Method Details

#add_managed_policy(policy) ⇒ void

This method returns an undefined value.

Attaches a managed policy to this principal.

Parameters:



138
139
140
141
# File 'iam/i_user.rb', line 138

def add_managed_policy(policy)
  Jsii::Type.check_type(policy, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLklNYW5hZ2VkUG9saWN5In0=")), "policy")
  jsii_call_method("addManagedPolicy", [policy])
end

#add_to_group(group) ⇒ void

This method returns an undefined value.

Adds this user to a group.

Parameters:



158
159
160
161
# File 'iam/i_user.rb', line 158

def add_to_group(group)
  Jsii::Type.check_type(group, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLklHcm91cCJ9")), "group")
  jsii_call_method("addToGroup", [group])
end

#add_to_principal_policy(statement) ⇒ AWSCDK::IAM::AddToPrincipalPolicyResult

Add to the policy of this principal.



98
99
100
101
# File 'iam/i_user.rb', line 98

def add_to_principal_policy(statement)
  Jsii::Type.check_type(statement, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLlBvbGljeVN0YXRlbWVudCJ9")), "statement")
  jsii_call_method("addToPrincipalPolicy", [statement])
end

#apply_removal_policy(policy) ⇒ void

This method returns an undefined value.

Apply the given removal policy to this resource.

The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you've removed it from the CDK application or because you've made a change that requires the resource to be replaced.

The resource can be deleted (RemovalPolicy.DESTROY), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN).

Parameters:



129
130
131
132
# File 'iam/i_user.rb', line 129

def apply_removal_policy(policy)
  Jsii::Type.check_type(policy, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5SZW1vdmFsUG9saWN5In0=")), "policy")
  jsii_call_method("applyRemovalPolicy", [policy])
end

#assume_role_actionString

When this Principal is used in an AssumeRole policy, the action to use.

Returns:

  • (String)


21
22
23
# File 'iam/i_user.rb', line 21

def assume_role_action()
  jsii_get_property("assumeRoleAction")
end

#attach_inline_policy(policy) ⇒ void

This method returns an undefined value.

Attaches an inline policy to this principal.

This is the same as calling policy.addToXxx(principal).

Parameters:

  • policy (AWSCDK::IAM::Policy)

    The policy resource to attach to this principal [disable-awslint:ref-via-interface].



149
150
151
152
# File 'iam/i_user.rb', line 149

def attach_inline_policy(policy)
  Jsii::Type.check_type(policy, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLlBvbGljeSJ9")), "policy")
  jsii_call_method("attachInlinePolicy", [policy])
end

#envAWSCDK::Interfaces::ResourceEnvironment

The environment this resource belongs to.

For resources that are created and managed in a Stack (those created by creating new class instances like new Role(), new Bucket(), etc.), this is always the same as the environment of the stack they belong to.

For referenced resources (those obtained from referencing methods like Role.fromRoleArn(), Bucket.fromBucketName(), etc.), they might be different than the stack they were imported into.



62
63
64
# File 'iam/i_user.rb', line 62

def env()
  jsii_get_property("env")
end

#grant_principalAWSCDK::IAM::IPrincipal

The principal to grant permissions to.



14
15
16
# File 'iam/i_user.rb', line 14

def grant_principal()
  jsii_get_property("grantPrincipal")
end

#nodeConstructs::Node

The tree node.

Returns:

  • (Constructs::Node)


47
48
49
# File 'iam/i_user.rb', line 47

def node()
  jsii_get_property("node")
end

#policy_fragmentAWSCDK::IAM::PrincipalPolicyFragment

Return the policy fragment that identifies this principal in a Policy.



28
29
30
# File 'iam/i_user.rb', line 28

def policy_fragment()
  jsii_get_property("policyFragment")
end

#principal_accountString?

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.

Returns:

  • (String, nil)


40
41
42
# File 'iam/i_user.rb', line 40

def ()
  jsii_get_property("principalAccount")
end

#stackAWSCDK::Stack

The stack in which this resource is defined.

Returns:



69
70
71
# File 'iam/i_user.rb', line 69

def stack()
  jsii_get_property("stack")
end

#user_arnString

The user's ARN.

Returns:

  • (String)


83
84
85
# File 'iam/i_user.rb', line 83

def user_arn()
  jsii_get_property("userArn")
end

#user_nameString

The user's name.

Returns:

  • (String)


90
91
92
# File 'iam/i_user.rb', line 90

def user_name()
  jsii_get_property("userName")
end

#user_refAWSCDK::Interfaces::AWSIAM::UserReference

A reference to a User resource.



76
77
78
# File 'iam/i_user.rb', line 76

def user_ref()
  jsii_get_property("userRef")
end

#with(*mixins) ⇒ Constructs::IConstruct

Applies one or more mixins to this construct.

Mixins are applied in order. The list of constructs is captured at the start of the call, so constructs added by a mixin will not be visited.

Parameters:

  • mixins (Array<Constructs::IMixin>)

    The mixins to apply.

Returns:

  • (Constructs::IConstruct)

    This construct for chaining



110
111
112
113
114
115
# File 'iam/i_user.rb', line 110

def with(*mixins)
  mixins.each_with_index do |item, index|
    Jsii::Type.check_type(item, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJjb25zdHJ1Y3RzLklNaXhpbiJ9")), "mixins[#{index}]")
  end
  jsii_call_method("with", [*mixins])
end