Module: AWSCDK::IAM::IIdentity
- Includes:
- IPrincipal, AWSCDK::IResource
- Defined in:
- iam/i_identity.rb
Overview
A construct that represents an IAM principal, such as a user, group or role.
[awslint:interface-extends-ref]
Class Method Summary collapse
Instance Method Summary collapse
-
#add_managed_policy(policy) ⇒ void
Attaches a managed policy to this principal.
-
#add_to_principal_policy(statement) ⇒ AWSCDK::IAM::AddToPrincipalPolicyResult
Add to the policy of this principal.
-
#apply_removal_policy(policy) ⇒ void
Apply the given removal policy to this resource.
-
#assume_role_action ⇒ String
When this Principal is used in an AssumeRole policy, the action to use.
-
#attach_inline_policy(policy) ⇒ void
Attaches an inline policy to this principal.
-
#env ⇒ AWSCDK::Interfaces::ResourceEnvironment
The environment this resource belongs to.
-
#grant_principal ⇒ AWSCDK::IAM::IPrincipal
The principal to grant permissions to.
-
#node ⇒ Constructs::Node
The tree node.
-
#policy_fragment ⇒ AWSCDK::IAM::PrincipalPolicyFragment
Return the policy fragment that identifies this principal in a Policy.
-
#principal_account ⇒ String?
The AWS account ID of this principal.
-
#stack ⇒ AWSCDK::Stack
The stack in which this resource is defined.
-
#with(*mixins) ⇒ Constructs::IConstruct
Applies one or more mixins to this construct.
Class Method Details
.jsii_overridable_methods ⇒ Object
133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 |
# File 'iam/i_identity.rb', line 133 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 }, :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 }, } end |
Instance Method Details
#add_managed_policy(policy) ⇒ void
This method returns an undefined value.
Attaches a managed policy to this principal.
117 118 119 120 |
# File 'iam/i_identity.rb', line 117 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_principal_policy(statement) ⇒ AWSCDK::IAM::AddToPrincipalPolicyResult
Add to the policy of this principal.
77 78 79 80 |
# File 'iam/i_identity.rb', line 77 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).
108 109 110 111 |
# File 'iam/i_identity.rb', line 108 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_action ⇒ String
When this Principal is used in an AssumeRole policy, the action to use.
21 22 23 |
# File 'iam/i_identity.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).
128 129 130 131 |
# File 'iam/i_identity.rb', line 128 def attach_inline_policy(policy) Jsii::Type.check_type(policy, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLlBvbGljeSJ9")), "policy") jsii_call_method("attachInlinePolicy", [policy]) end |
#env ⇒ AWSCDK::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_identity.rb', line 62 def env() jsii_get_property("env") end |
#grant_principal ⇒ AWSCDK::IAM::IPrincipal
The principal to grant permissions to.
14 15 16 |
# File 'iam/i_identity.rb', line 14 def grant_principal() jsii_get_property("grantPrincipal") end |
#node ⇒ Constructs::Node
The tree node.
47 48 49 |
# File 'iam/i_identity.rb', line 47 def node() jsii_get_property("node") end |
#policy_fragment ⇒ AWSCDK::IAM::PrincipalPolicyFragment
Return the policy fragment that identifies this principal in a Policy.
28 29 30 |
# File 'iam/i_identity.rb', line 28 def policy_fragment() jsii_get_property("policyFragment") end |
#principal_account ⇒ String?
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.
40 41 42 |
# File 'iam/i_identity.rb', line 40 def principal_account() jsii_get_property("principalAccount") end |
#stack ⇒ AWSCDK::Stack
The stack in which this resource is defined.
69 70 71 |
# File 'iam/i_identity.rb', line 69 def stack() jsii_get_property("stack") 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.
89 90 91 92 93 94 |
# File 'iam/i_identity.rb', line 89 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 |