Interface PolicyProps
- All Superinterfaces:
software.amazon.jsii.JsiiSerializable
- All Known Implementing Classes:
PolicyProps.Jsii$Proxy
Example:
Function postAuthFn;
UserPool userpool = UserPool.Builder.create(this, "myuserpool")
.lambdaTriggers(UserPoolTriggers.builder()
.postAuthentication(postAuthFn)
.build())
.build();
// provide permissions to describe the user pool scoped to the ARN the user pool
postAuthFn.role.attachInlinePolicy(Policy.Builder.create(this, "userpool-policy")
.statements(List.of(PolicyStatement.Builder.create()
.actions(List.of("cognito-idp:DescribeUserPool"))
.resources(List.of(userpool.getUserPoolArn()))
.build()))
.build());
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final classA builder forPolicyPropsstatic final classAn implementation forPolicyProps -
Method Summary
Modifier and TypeMethodDescriptionstatic PolicyProps.Builderbuilder()default PolicyDocumentInitial PolicyDocument to use for this Policy.default BooleangetForce()Force creation of anAWS::IAM::Policy.Groups to attach this policy to.default StringThe name of the policy.getRoles()Roles to attach this policy to.default List<PolicyStatement>Initial set of permissions to add to this policy document.getUsers()Users to attach this policy to.Methods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Method Details
-
getDocument
Initial PolicyDocument to use for this Policy.If omited, any
PolicyStatementprovided in thestatementsproperty will be applied against the empty defaultPolicyDocument.Default: - An empty policy.
-
getForce
Force creation of anAWS::IAM::Policy.Unless set to
true, thisPolicyconstruct will not materialize to anAWS::IAM::PolicyCloudFormation 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.Default: false
-
getGroups
Groups to attach this policy to.You can also use
attachToGroup(group)to attach this policy to a group.Default: - No groups.
-
getPolicyName
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.
Default: - Uses the logical ID of the policy resource, which is ensured to be unique within the stack.
-
getRoles
Roles to attach this policy to.You can also use
attachToRole(role)to attach this policy to a role.Default: - No roles.
-
getStatements
Initial set of permissions to add to this policy document.You can also use
addStatements(...statement)to add permissions later.Default: - No statements.
-
getUsers
Users to attach this policy to.You can also use
attachToUser(user)to attach this policy to a user.Default: - No users.
-
builder
- Returns:
- a
PolicyProps.BuilderofPolicyProps
-