Class: AWSCDK::IAM::PolicyDocumentProps

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
iam/policy_document_props.rb

Overview

Properties for a new PolicyDocument.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(assign_sids: nil, minimize: nil, statements: nil) ⇒ PolicyDocumentProps

Returns a new instance of PolicyDocumentProps.

Parameters:

  • assign_sids (Boolean, nil) (defaults to: nil)

    Automatically assign Statement Ids to all statements.

  • minimize (Boolean, nil) (defaults to: nil)

    Try to minimize the policy by merging statements.

  • statements (Array<AWSCDK::IAM::PolicyStatement>, nil) (defaults to: nil)

    Initial statements to add to the policy document.



10
11
12
13
14
15
16
17
# File 'iam/policy_document_props.rb', line 10

def initialize(assign_sids: nil, minimize: nil, statements: nil)
  @assign_sids = assign_sids
  Jsii::Type.check_type(@assign_sids, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "assignSids") unless @assign_sids.nil?
  @minimize = minimize
  Jsii::Type.check_type(@minimize, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "minimize") unless @minimize.nil?
  @statements = statements
  Jsii::Type.check_type(@statements, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19pYW0uUG9saWN5U3RhdGVtZW50In0sImtpbmQiOiJhcnJheSJ9fQ==")), "statements") unless @statements.nil?
end

Instance Attribute Details

#assign_sidsBoolean? (readonly)

Note:

Default: false

Automatically assign Statement Ids to all statements.

Returns:

  • (Boolean, nil)


23
24
25
# File 'iam/policy_document_props.rb', line 23

def assign_sids
  @assign_sids
end

#minimizeBoolean? (readonly)

Note:

Default: - false, unless the feature flag @aws-cdk/aws-iam:minimizePolicies is set

Try to minimize the policy by merging statements.

To avoid overrunning the maximum policy size, combine statements if they produce the same result. Merging happens according to the following rules:

  • The Effect of both statements is the same
  • Neither of the statements have a 'Sid'
  • Combine Principals if the rest of the statement is exactly the same.
  • Combine Resources if the rest of the statement is exactly the same.
  • Combine Actions if the rest of the statement is exactly the same.
  • We will never combine NotPrincipals, NotResources or NotActions, because doing so would change the meaning of the policy document.

Returns:

  • (Boolean, nil)


39
40
41
# File 'iam/policy_document_props.rb', line 39

def minimize
  @minimize
end

#statementsArray<AWSCDK::IAM::PolicyStatement>? (readonly)

Note:

Default: - No statements

Initial statements to add to the policy document.

Returns:



44
45
46
# File 'iam/policy_document_props.rb', line 44

def statements
  @statements
end

Class Method Details

.jsii_propertiesObject



46
47
48
49
50
51
52
# File 'iam/policy_document_props.rb', line 46

def self.jsii_properties
  {
    :assign_sids => "assignSids",
    :minimize => "minimize",
    :statements => "statements",
  }
end

Instance Method Details

#to_jsiiObject



54
55
56
57
58
59
60
61
62
# File 'iam/policy_document_props.rb', line 54

def to_jsii
  result = {}
  result.merge!({
    "assignSids" => @assign_sids,
    "minimize" => @minimize,
    "statements" => @statements,
  })
  result.compact
end