Class PolicyStatement.Builder

java.lang.Object
software.amazon.awscdk.services.iam.PolicyStatement.Builder
All Implemented Interfaces:
software.amazon.jsii.Builder<PolicyStatement>
Enclosing class:
PolicyStatement

@Stability(Stable) public static final class PolicyStatement.Builder extends Object implements software.amazon.jsii.Builder<PolicyStatement>
A fluent builder for PolicyStatement.
  • Method Details

    • create

      @Stability(Stable) public static PolicyStatement.Builder create()
      Returns:
      a new instance of PolicyStatement.Builder.
    • actions

      @Stability(Stable) public PolicyStatement.Builder actions(List<String> actions)
      List of actions to add to the statement.

      Default: - no actions

      Parameters:
      actions - List of actions to add to the statement. This parameter is required.
      Returns:
      this
    • conditions

      @Stability(Stable) public PolicyStatement.Builder conditions(Map<String,? extends Object> conditions)
      Conditions to add to the statement.

      Default: - no condition

      Parameters:
      conditions - Conditions to add to the statement. This parameter is required.
      Returns:
      this
    • effect

      @Stability(Stable) public PolicyStatement.Builder effect(Effect effect)
      Whether to allow or deny the actions in this statement.

      Default: Effect.ALLOW

      Parameters:
      effect - Whether to allow or deny the actions in this statement. This parameter is required.
      Returns:
      this
    • notActions

      @Stability(Stable) public PolicyStatement.Builder notActions(List<String> notActions)
      List of not actions to add to the statement.

      Default: - no not-actions

      Parameters:
      notActions - List of not actions to add to the statement. This parameter is required.
      Returns:
      this
    • notPrincipals

      @Stability(Stable) public PolicyStatement.Builder notPrincipals(List<? extends IPrincipal> notPrincipals)
      List of not principals to add to the statement.

      Default: - no not principals

      Parameters:
      notPrincipals - List of not principals to add to the statement. This parameter is required.
      Returns:
      this
    • notResources

      @Stability(Stable) public PolicyStatement.Builder notResources(List<String> notResources)
      NotResource ARNs to add to the statement.

      Default: - no not-resources

      Parameters:
      notResources - NotResource ARNs to add to the statement. This parameter is required.
      Returns:
      this
    • principals

      @Stability(Stable) public PolicyStatement.Builder principals(List<? extends IPrincipal> principals)
      List of principals to add to the statement.

      Default: - no principals

      Parameters:
      principals - List of principals to add to the statement. This parameter is required.
      Returns:
      this
    • resources

      @Stability(Stable) public PolicyStatement.Builder resources(List<String> resources)
      Resource ARNs to add to the statement.

      Default: - no resources

      Parameters:
      resources - Resource ARNs to add to the statement. This parameter is required.
      Returns:
      this
    • sid

      @Stability(Stable) public PolicyStatement.Builder sid(String 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.

      Default: - no sid

      Parameters:
      sid - The Sid (statement ID) is an optional identifier that you provide for the policy statement. This parameter is required.
      Returns:
      this
    • build

      @Stability(Stable) public PolicyStatement build()
      Specified by:
      build in interface software.amazon.jsii.Builder<PolicyStatement>
      Returns:
      a newly built instance of PolicyStatement.