Class: AWSCDK::IAM::AccountPrincipal
- Inherits:
-
ARNPrincipal
- Object
- ARNPrincipal
- AWSCDK::IAM::AccountPrincipal
- Defined in:
- iam/account_principal.rb
Overview
Specify AWS account ID as the principal entity in a policy to delegate authority to the account.
Direct Known Subclasses
Class Method Summary collapse
Instance Method Summary collapse
-
#account_id ⇒ Object
AWS account ID (i.e. '123456789012').
-
#add_to_assume_role_policy(document) ⇒ void
Add the principal to the AssumeRolePolicyDocument.
-
#add_to_policy(statement) ⇒ Boolean
Add to the policy of this principal.
-
#add_to_principal_policy(_statement) ⇒ AWSCDK::IAM::AddToPrincipalPolicyResult
Add to the policy of this principal.
-
#arn ⇒ String
Amazon Resource Name (ARN) of the principal entity (i.e. arn:aws:iam::123456789012:user/user-name).
-
#assume_role_action ⇒ String
When this Principal is used in an AssumeRole policy, the action to use.
-
#dedupe_string ⇒ String?
Return whether or not this principal is equal to the given principal.
-
#grant_principal ⇒ AWSCDK::IAM::IPrincipal
The principal to grant permissions to.
-
#in_organization(organization_id) ⇒ AWSCDK::IAM::PrincipalBase
A convenience method for adding a condition that the principal is part of the specified AWS Organization.
-
#initialize(account_id) ⇒ AccountPrincipal
constructor
A new instance of AccountPrincipal.
-
#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.
-
#to_json ⇒ Hash{String => Array<String>}
JSON-ify the principal.
-
#to_string ⇒ String
Returns a string representation of an object.
-
#with_conditions(conditions) ⇒ AWSCDK::IAM::PrincipalBase
Returns a new PrincipalWithConditions using this principal as the base, with the passed conditions added.
-
#with_session_tags ⇒ AWSCDK::IAM::PrincipalBase
Returns a new principal using this principal as the base, with session tags enabled.
Constructor Details
#initialize(account_id) ⇒ AccountPrincipal
Returns a new instance of AccountPrincipal.
9 10 11 12 |
# File 'iam/account_principal.rb', line 9 def initialize(account_id) Jsii::Type.check_type(account_id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJhbnkifQ==")), "accountId") Jsii::Object.instance_method(:initialize).bind(self).call(account_id) end |
Class Method Details
.jsii_overridable_methods ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'iam/account_principal.rb', line 14 def self.jsii_overridable_methods { :assume_role_action => { kind: :property, name: "assumeRoleAction", is_optional: false }, :grant_principal => { kind: :property, name: "grantPrincipal", is_optional: false }, :policy_fragment => { kind: :property, name: "policyFragment", is_optional: false }, :principal_account => { kind: :property, name: "principalAccount", is_optional: true }, :arn => { kind: :property, name: "arn", is_optional: false }, :account_id => { kind: :property, name: "accountId", is_optional: false }, :add_to_assume_role_policy => { kind: :method, name: "addToAssumeRolePolicy", is_optional: false }, :add_to_policy => { kind: :method, name: "addToPolicy", is_optional: false }, :add_to_principal_policy => { kind: :method, name: "addToPrincipalPolicy", is_optional: false }, :dedupe_string => { kind: :method, name: "dedupeString", is_optional: false }, :to_json => { kind: :method, name: "toJSON", is_optional: false }, :to_string => { kind: :method, name: "toString", is_optional: false }, :with_conditions => { kind: :method, name: "withConditions", is_optional: false }, :with_session_tags => { kind: :method, name: "withSessionTags", is_optional: false }, :in_organization => { kind: :method, name: "inOrganization", is_optional: false }, } end |
Instance Method Details
#account_id ⇒ Object
AWS account ID (i.e. '123456789012').
77 78 79 |
# File 'iam/account_principal.rb', line 77 def account_id() jsii_get_property("accountId") end |
#add_to_assume_role_policy(document) ⇒ void
This method returns an undefined value.
Add the principal to the AssumeRolePolicyDocument.
Add the statements to the AssumeRolePolicyDocument necessary to give this principal permissions to assume the given role.
88 89 90 91 |
# File 'iam/account_principal.rb', line 88 def add_to_assume_role_policy(document) Jsii::Type.check_type(document, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLlBvbGljeURvY3VtZW50In0=")), "document") jsii_call_method("addToAssumeRolePolicy", [document]) end |
#add_to_policy(statement) ⇒ Boolean
Add to the policy of this principal.
97 98 99 100 |
# File 'iam/account_principal.rb', line 97 def add_to_policy(statement) Jsii::Type.check_type(statement, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLlBvbGljeVN0YXRlbWVudCJ9")), "statement") jsii_call_method("addToPolicy", [statement]) end |
#add_to_principal_policy(_statement) ⇒ AWSCDK::IAM::AddToPrincipalPolicyResult
Add to the policy of this principal.
106 107 108 109 |
# File 'iam/account_principal.rb', line 106 def add_to_principal_policy(_statement) Jsii::Type.check_type(_statement, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLlBvbGljeVN0YXRlbWVudCJ9")), "_statement") jsii_call_method("addToPrincipalPolicy", [_statement]) end |
#arn ⇒ String
Amazon Resource Name (ARN) of the principal entity (i.e. arn:aws:iam::123456789012:user/user-name).
70 71 72 |
# File 'iam/account_principal.rb', line 70 def arn() jsii_get_property("arn") end |
#assume_role_action ⇒ String
When this Principal is used in an AssumeRole policy, the action to use.
37 38 39 |
# File 'iam/account_principal.rb', line 37 def assume_role_action() jsii_get_property("assumeRoleAction") end |
#dedupe_string ⇒ String?
Return whether or not this principal is equal to the given principal.
114 115 116 |
# File 'iam/account_principal.rb', line 114 def dedupe_string() jsii_call_method("dedupeString", []) end |
#grant_principal ⇒ AWSCDK::IAM::IPrincipal
The principal to grant permissions to.
44 45 46 |
# File 'iam/account_principal.rb', line 44 def grant_principal() jsii_get_property("grantPrincipal") end |
#in_organization(organization_id) ⇒ AWSCDK::IAM::PrincipalBase
A convenience method for adding a condition that the principal is part of the specified AWS Organization.
157 158 159 160 |
# File 'iam/account_principal.rb', line 157 def in_organization(organization_id) Jsii::Type.check_type(organization_id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "organizationId") jsii_call_method("inOrganization", [organization_id]) end |
#policy_fragment ⇒ AWSCDK::IAM::PrincipalPolicyFragment
Return the policy fragment that identifies this principal in a Policy.
51 52 53 |
# File 'iam/account_principal.rb', line 51 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.
63 64 65 |
# File 'iam/account_principal.rb', line 63 def principal_account() jsii_get_property("principalAccount") end |
#to_json ⇒ Hash{String => Array<String>}
JSON-ify the principal.
Used when JSON.stringify() is called
123 124 125 |
# File 'iam/account_principal.rb', line 123 def to_json() jsii_call_method("toJSON", []) end |
#to_string ⇒ String
Returns a string representation of an object.
130 131 132 |
# File 'iam/account_principal.rb', line 130 def to_string() jsii_call_method("toString", []) end |
#with_conditions(conditions) ⇒ AWSCDK::IAM::PrincipalBase
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.
141 142 143 144 |
# File 'iam/account_principal.rb', line 141 def with_conditions(conditions) Jsii::Type.check_type(conditions, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6ImFueSJ9LCJraW5kIjoibWFwIn19")), "conditions") jsii_call_method("withConditions", [conditions]) end |
#with_session_tags ⇒ AWSCDK::IAM::PrincipalBase
Returns a new principal using this principal as the base, with session tags enabled.
149 150 151 |
# File 'iam/account_principal.rb', line 149 def () jsii_call_method("withSessionTags", []) end |