Class: AWSCDK::IAM::PolicyStatementProps

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

Overview

Interface for creating a policy statement.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(actions: nil, conditions: nil, effect: nil, not_actions: nil, not_principals: nil, not_resources: nil, principals: nil, resources: nil, sid: nil) ⇒ PolicyStatementProps

Returns a new instance of PolicyStatementProps.

Parameters:

  • actions (Array<String>, nil) (defaults to: nil)

    List of actions to add to the statement.

  • conditions (Hash{String => Object}, nil) (defaults to: nil)

    Conditions to add to the statement.

  • effect (AWSCDK::IAM::Effect, nil) (defaults to: nil)

    Whether to allow or deny the actions in this statement.

  • not_actions (Array<String>, nil) (defaults to: nil)

    List of not actions to add to the statement.

  • not_principals (Array<AWSCDK::IAM::IPrincipal>, nil) (defaults to: nil)

    List of not principals to add to the statement.

  • not_resources (Array<String>, nil) (defaults to: nil)

    NotResource ARNs to add to the statement.

  • principals (Array<AWSCDK::IAM::IPrincipal>, nil) (defaults to: nil)

    List of principals to add to the statement.

  • resources (Array<String>, nil) (defaults to: nil)

    Resource ARNs to add to the statement.

  • sid (String, nil) (defaults to: nil)

    The Sid (statement ID) is an optional identifier that you provide for the policy statement.



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'iam/policy_statement_props.rb', line 16

def initialize(actions: nil, conditions: nil, effect: nil, not_actions: nil, not_principals: nil, not_resources: nil, principals: nil, resources: nil, sid: nil)
  @actions = actions
  Jsii::Type.check_type(@actions, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "actions") unless @actions.nil?
  @conditions = conditions
  Jsii::Type.check_type(@conditions, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6ImFueSJ9LCJraW5kIjoibWFwIn19")), "conditions") unless @conditions.nil?
  @effect = effect
  Jsii::Type.check_type(@effect, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLkVmZmVjdCJ9")), "effect") unless @effect.nil?
  @not_actions = not_actions
  Jsii::Type.check_type(@not_actions, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "notActions") unless @not_actions.nil?
  @not_principals = not_principals
  Jsii::Type.check_type(@not_principals, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19pYW0uSVByaW5jaXBhbCJ9LCJraW5kIjoiYXJyYXkifX0=")), "notPrincipals") unless @not_principals.nil?
  @not_resources = not_resources
  Jsii::Type.check_type(@not_resources, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "notResources") unless @not_resources.nil?
  @principals = principals
  Jsii::Type.check_type(@principals, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19pYW0uSVByaW5jaXBhbCJ9LCJraW5kIjoiYXJyYXkifX0=")), "principals") unless @principals.nil?
  @resources = resources
  Jsii::Type.check_type(@resources, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "resources") unless @resources.nil?
  @sid = sid
  Jsii::Type.check_type(@sid, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "sid") unless @sid.nil?
end

Instance Attribute Details

#actionsArray<String>? (readonly)

Note:

Default: - no actions

List of actions to add to the statement.

Returns:

  • (Array<String>, nil)


41
42
43
# File 'iam/policy_statement_props.rb', line 41

def actions
  @actions
end

#conditionsHash{String => Object}? (readonly)

Note:

Default: - no condition

Conditions to add to the statement.

Returns:

  • (Hash{String => Object}, nil)


46
47
48
# File 'iam/policy_statement_props.rb', line 46

def conditions
  @conditions
end

#effectAWSCDK::IAM::Effect? (readonly)

Note:

Default: Effect.ALLOW

Whether to allow or deny the actions in this statement.

Returns:



51
52
53
# File 'iam/policy_statement_props.rb', line 51

def effect
  @effect
end

#not_actionsArray<String>? (readonly)

Note:

Default: - no not-actions

List of not actions to add to the statement.

Returns:

  • (Array<String>, nil)


56
57
58
# File 'iam/policy_statement_props.rb', line 56

def not_actions
  @not_actions
end

#not_principalsArray<AWSCDK::IAM::IPrincipal>? (readonly)

Note:

Default: - no not principals

List of not principals to add to the statement.

Returns:



61
62
63
# File 'iam/policy_statement_props.rb', line 61

def not_principals
  @not_principals
end

#not_resourcesArray<String>? (readonly)

Note:

Default: - no not-resources

NotResource ARNs to add to the statement.

Returns:

  • (Array<String>, nil)


66
67
68
# File 'iam/policy_statement_props.rb', line 66

def not_resources
  @not_resources
end

#principalsArray<AWSCDK::IAM::IPrincipal>? (readonly)

Note:

Default: - no principals

List of principals to add to the statement.

Returns:



71
72
73
# File 'iam/policy_statement_props.rb', line 71

def principals
  @principals
end

#resourcesArray<String>? (readonly)

Note:

Default: - no resources

Resource ARNs to add to the statement.

Returns:

  • (Array<String>, nil)


76
77
78
# File 'iam/policy_statement_props.rb', line 76

def resources
  @resources
end

#sidString? (readonly)

Note:

Default: - no sid

The Sid (statement ID) is an optional identifier that you provide for the policy statement.

You can assign a Sid value to each statement in a statement array. In services that let you specify an ID element, such as SQS and SNS, the Sid value is just a sub-ID of the policy document's ID. In IAM, the Sid value must be unique within a JSON policy. In IAM identity policies, the Sid value must contain only alphanumeric characters.

Returns:

  • (String, nil)


87
88
89
# File 'iam/policy_statement_props.rb', line 87

def sid
  @sid
end

Class Method Details

.jsii_propertiesObject



89
90
91
92
93
94
95
96
97
98
99
100
101
# File 'iam/policy_statement_props.rb', line 89

def self.jsii_properties
  {
    :actions => "actions",
    :conditions => "conditions",
    :effect => "effect",
    :not_actions => "notActions",
    :not_principals => "notPrincipals",
    :not_resources => "notResources",
    :principals => "principals",
    :resources => "resources",
    :sid => "sid",
  }
end

Instance Method Details

#to_jsiiObject



103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
# File 'iam/policy_statement_props.rb', line 103

def to_jsii
  result = {}
  result.merge!({
    "actions" => @actions,
    "conditions" => @conditions,
    "effect" => @effect,
    "notActions" => @not_actions,
    "notPrincipals" => @not_principals,
    "notResources" => @not_resources,
    "principals" => @principals,
    "resources" => @resources,
    "sid" => @sid,
  })
  result.compact
end