public static final class PolicyProps.Builder
extends java.lang.Object
PolicyProps
Constructor and Description |
---|
Builder() |
Modifier and Type | Method and Description |
---|---|
PolicyProps |
build()
Builds the configured instance.
|
PolicyProps.Builder |
document(PolicyDocument document)
Sets the value of
PolicyProps.getDocument() |
PolicyProps.Builder |
force(java.lang.Boolean force)
Sets the value of
PolicyProps.getForce() |
PolicyProps.Builder |
groups(java.util.List<? extends IGroup> groups)
Sets the value of
PolicyProps.getGroups() |
PolicyProps.Builder |
policyName(java.lang.String policyName)
Sets the value of
PolicyProps.getPolicyName() |
PolicyProps.Builder |
roles(java.util.List<? extends IRole> roles)
Sets the value of
PolicyProps.getRoles() |
PolicyProps.Builder |
statements(java.util.List<? extends PolicyStatement> statements)
Sets the value of
PolicyProps.getStatements() |
PolicyProps.Builder |
users(java.util.List<? extends IUser> users)
Sets the value of
PolicyProps.getUsers() |
public PolicyProps.Builder document(PolicyDocument document)
PolicyProps.getDocument()
document
- Initial PolicyDocument to use for this Policy.
If omited, any
PolicyStatement
provided in the statements
property will be applied
against the empty default PolicyDocument
.this
public PolicyProps.Builder force(java.lang.Boolean force)
PolicyProps.getForce()
force
- Force creation of an `AWS::IAM::Policy`.
Unless set to true
, this Policy
construct will not materialize to an
AWS::IAM::Policy
CloudFormation resource in case it would have no effect
(for example, if it remains unattached to an IAM identity or if it has no
statements). This is generally desired behavior, since it prevents
creating invalid--and hence undeployable--CloudFormation templates.
In cases where you know the policy must be created and it is actually
an error if no statements have been added to it, you can set this to true
.
this
public PolicyProps.Builder groups(java.util.List<? extends IGroup> groups)
PolicyProps.getGroups()
groups
- Groups to attach this policy to.
You can also use attachToGroup(group)
to attach this policy to a group.this
public PolicyProps.Builder policyName(java.lang.String policyName)
PolicyProps.getPolicyName()
policyName
- The name of the policy.
If you specify multiple policies for an entity,
specify unique names. For example, if you specify a list of policies for
an IAM role, each policy must have a unique name.this
public PolicyProps.Builder roles(java.util.List<? extends IRole> roles)
PolicyProps.getRoles()
roles
- Roles to attach this policy to.
You can also use attachToRole(role)
to attach this policy to a role.this
public PolicyProps.Builder statements(java.util.List<? extends PolicyStatement> statements)
PolicyProps.getStatements()
statements
- Initial set of permissions to add to this policy document.
You can also use addStatements(...statement)
to add permissions later.this
public PolicyProps.Builder users(java.util.List<? extends IUser> users)
PolicyProps.getUsers()
users
- Users to attach this policy to.
You can also use attachToUser(user)
to attach this policy to a user.this
public PolicyProps build()
PolicyProps
java.lang.NullPointerException
- if any required attribute was not provided