Class: AWSCDK::IAM::PrincipalPolicyFragment
- Inherits:
-
Jsii::Object
- Object
- Jsii::Object
- AWSCDK::IAM::PrincipalPolicyFragment
- Defined in:
- iam/principal_policy_fragment.rb
Overview
A collection of the fields in a PolicyStatement that can be used to identify a principal.
This consists of the JSON used in the "Principal" field, and optionally a set of "Condition"s that need to be applied to the policy.
Generally, a principal looks like:
{ '<TYPE>': ['ID', 'ID', ...] }
And this is also the type of the field principal_json. However, there is a
special type of principal that is just the string '', which is treated
differently by some services. To represent that principal, principal_json
should contain `{ 'LiteralString': [''] }`.
Class Method Summary collapse
Instance Method Summary collapse
-
#conditions ⇒ Hash{String => Object}
The conditions under which the policy is in effect.
-
#initialize(principal_json, conditions = nil) ⇒ PrincipalPolicyFragment
constructor
A new instance of PrincipalPolicyFragment.
-
#principal_json ⇒ Hash{String => Array<String>}
JSON of the "Principal" section in a policy statement.
Constructor Details
#initialize(principal_json, conditions = nil) ⇒ PrincipalPolicyFragment
Returns a new instance of PrincipalPolicyFragment.
24 25 26 27 28 |
# File 'iam/principal_policy_fragment.rb', line 24 def initialize(principal_json, conditions = nil) Jsii::Type.check_type(principal_json, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImNvbGxlY3Rpb24iOnsiZWxlbWVudHR5cGUiOnsicHJpbWl0aXZlIjoic3RyaW5nIn0sImtpbmQiOiJhcnJheSJ9fSwia2luZCI6Im1hcCJ9fQ==")), "principalJson") Jsii::Type.check_type(conditions, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6ImFueSJ9LCJraW5kIjoibWFwIn19")), "conditions") unless conditions.nil? Jsii::Object.instance_method(:initialize).bind(self).call(principal_json, conditions) end |
Class Method Details
.jsii_overridable_methods ⇒ Object
30 31 32 33 34 35 |
# File 'iam/principal_policy_fragment.rb', line 30 def self.jsii_overridable_methods { :conditions => { kind: :property, name: "conditions", is_optional: false }, :principal_json => { kind: :property, name: "principalJson", is_optional: false }, } end |
Instance Method Details
#conditions ⇒ Hash{String => Object}
The conditions under which the policy is in effect.
See the IAM documentation. conditions that need to be applied to this policy
43 44 45 |
# File 'iam/principal_policy_fragment.rb', line 43 def conditions() jsii_get_property("conditions") end |
#principal_json ⇒ Hash{String => Array<String>}
JSON of the "Principal" section in a policy statement.
50 51 52 |
# File 'iam/principal_policy_fragment.rb', line 50 def principal_json() jsii_get_property("principalJson") end |