Class PolicyDocument.Builder
java.lang.Object
software.amazon.awscdk.services.iam.PolicyDocument.Builder
- All Implemented Interfaces:
software.amazon.jsii.Builder<PolicyDocument>
- Enclosing class:
- PolicyDocument
@Stability(Stable)
public static final class PolicyDocument.Builder
extends Object
implements software.amazon.jsii.Builder<PolicyDocument>
A fluent builder for
PolicyDocument
.-
Method Summary
Modifier and TypeMethodDescriptionassignSids
(Boolean assignSids) Automatically assign Statement Ids to all statements.build()
static PolicyDocument.Builder
create()
Try to minimize the policy by merging statements.statements
(List<? extends PolicyStatement> statements) Initial statements to add to the policy document.
-
Method Details
-
create
- Returns:
- a new instance of
PolicyDocument.Builder
.
-
assignSids
Automatically assign Statement Ids to all statements.Default: false
- Parameters:
assignSids
- Automatically assign Statement Ids to all statements. This parameter is required.- Returns:
this
-
minimize
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.
Default: - false, unless the feature flag `@aws-cdk/aws-iam:minimizePolicies` is set
- Parameters:
minimize
- Try to minimize the policy by merging statements. This parameter is required.- Returns:
this
-
statements
@Stability(Stable) public PolicyDocument.Builder statements(List<? extends PolicyStatement> statements) Initial statements to add to the policy document.Default: - No statements
- Parameters:
statements
- Initial statements to add to the policy document. This parameter is required.- Returns:
this
-
build
- Specified by:
build
in interfacesoftware.amazon.jsii.Builder<PolicyDocument>
- Returns:
- a newly built instance of
PolicyDocument
.
-