Class: AWSCDK::IAM::PrincipalWithConditions
- Inherits:
-
PrincipalBase
- Object
- PrincipalBase
- AWSCDK::IAM::PrincipalWithConditions
- Defined in:
- iam/principal_with_conditions.rb
Overview
An IAM principal with additional conditions specifying when the policy is in effect.
For more information about conditions, see: https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_condition.html
Class Method Summary collapse
Instance Method Summary collapse
-
#add_condition(key, value) ⇒ void
Add a condition to the principal.
-
#add_conditions(conditions) ⇒ void
Adds multiple conditions to the principal.
-
#add_to_assume_role_policy(doc) ⇒ 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.
-
#append_dedupe(append) ⇒ String?
Append the given string to the wrapped principal's dedupe string (if available).
-
#assume_role_action ⇒ String
When this Principal is used in an AssumeRole policy, the action to use.
-
#conditions ⇒ Hash{String => Object}
The conditions under which the policy is in effect.
-
#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.
-
#initialize(principal, conditions) ⇒ PrincipalWithConditions
constructor
A new instance of PrincipalWithConditions.
-
#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(principal, conditions) ⇒ PrincipalWithConditions
Returns a new instance of PrincipalWithConditions.
13 14 15 16 17 |
# File 'iam/principal_with_conditions.rb', line 13 def initialize(principal, conditions) Jsii::Type.check_type(principal, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLklQcmluY2lwYWwifQ==")), "principal") Jsii::Type.check_type(conditions, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6ImFueSJ9LCJraW5kIjoibWFwIn19")), "conditions") Jsii::Object.instance_method(:initialize).bind(self).call(principal, conditions) end |
Class Method Details
.jsii_overridable_methods ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'iam/principal_with_conditions.rb', line 19 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 }, :conditions => { kind: :property, name: "conditions", 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 }, :add_condition => { kind: :method, name: "addCondition", is_optional: false }, :add_conditions => { kind: :method, name: "addConditions", is_optional: false }, :append_dedupe => { kind: :method, name: "appendDedupe", is_optional: false }, } end |
Instance Method Details
#add_condition(key, value) ⇒ void
This method returns an undefined value.
Add a condition to the principal.
159 160 161 162 163 |
# File 'iam/principal_with_conditions.rb', line 159 def add_condition(key, value) Jsii::Type.check_type(key, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "key") Jsii::Type.check_type(value, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJhbnkifQ==")), "value") jsii_call_method("addCondition", [key, value]) end |
#add_conditions(conditions) ⇒ void
This method returns an undefined value.
Adds multiple conditions to the principal.
Values from the conditions parameter will overwrite existing values with the same operator and key.
172 173 174 175 |
# File 'iam/principal_with_conditions.rb', line 172 def add_conditions(conditions) Jsii::Type.check_type(conditions, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6ImFueSJ9LCJraW5kIjoibWFwIn19")), "conditions") jsii_call_method("addConditions", [conditions]) end |
#add_to_assume_role_policy(doc) ⇒ 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.
89 90 91 92 |
# File 'iam/principal_with_conditions.rb', line 89 def add_to_assume_role_policy(doc) Jsii::Type.check_type(doc, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLlBvbGljeURvY3VtZW50In0=")), "doc") jsii_call_method("addToAssumeRolePolicy", [doc]) end |
#add_to_policy(statement) ⇒ Boolean
Add to the policy of this principal.
98 99 100 101 |
# File 'iam/principal_with_conditions.rb', line 98 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.
107 108 109 110 |
# File 'iam/principal_with_conditions.rb', line 107 def add_to_principal_policy(statement) Jsii::Type.check_type(statement, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLlBvbGljeVN0YXRlbWVudCJ9")), "statement") jsii_call_method("addToPrincipalPolicy", [statement]) end |
#append_dedupe(append) ⇒ String?
Append the given string to the wrapped principal's dedupe string (if available).
181 182 183 184 |
# File 'iam/principal_with_conditions.rb', line 181 def append_dedupe(append) Jsii::Type.check_type(append, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "append") jsii_call_method("appendDedupe", [append]) end |
#assume_role_action ⇒ String
When this Principal is used in an AssumeRole policy, the action to use.
43 44 45 |
# File 'iam/principal_with_conditions.rb', line 43 def assume_role_action() jsii_get_property("assumeRoleAction") end |
#conditions ⇒ Hash{String => Object}
The conditions under which the policy is in effect.
78 79 80 |
# File 'iam/principal_with_conditions.rb', line 78 def conditions() jsii_get_property("conditions") end |
#dedupe_string ⇒ String?
Return whether or not this principal is equal to the given principal.
115 116 117 |
# File 'iam/principal_with_conditions.rb', line 115 def dedupe_string() jsii_call_method("dedupeString", []) end |
#grant_principal ⇒ AWSCDK::IAM::IPrincipal
The principal to grant permissions to.
50 51 52 |
# File 'iam/principal_with_conditions.rb', line 50 def grant_principal() jsii_get_property("grantPrincipal") end |
#policy_fragment ⇒ AWSCDK::IAM::PrincipalPolicyFragment
Return the policy fragment that identifies this principal in a Policy.
57 58 59 |
# File 'iam/principal_with_conditions.rb', line 57 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.
69 70 71 |
# File 'iam/principal_with_conditions.rb', line 69 def principal_account() jsii_get_property("principalAccount") end |
#to_json ⇒ Hash{String => Array<String>}
JSON-ify the principal.
Used when JSON.stringify() is called
124 125 126 |
# File 'iam/principal_with_conditions.rb', line 124 def to_json() jsii_call_method("toJSON", []) end |
#to_string ⇒ String
Returns a string representation of an object.
131 132 133 |
# File 'iam/principal_with_conditions.rb', line 131 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.
142 143 144 145 |
# File 'iam/principal_with_conditions.rb', line 142 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.
150 151 152 |
# File 'iam/principal_with_conditions.rb', line 150 def () jsii_call_method("withSessionTags", []) end |