@Generated(value="jsii-pacmak/1.67.0 (build 2c027f5)", date="2022-09-19T20:26:39.779Z") @Stability(value=Stable) public class Policy extends Resource implements IPolicy
For more information about IAM policies, see Overview of IAM Policies in the IAM User Guide guide.
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());
| Modifier and Type | Class and Description |
|---|---|
static class |
Policy.Builder
A fluent builder for
Policy. |
software.amazon.jsii.JsiiObject.InitializationModeIPolicy.Jsii$Default, IPolicy.Jsii$Proxy| Modifier | Constructor and Description |
|---|---|
|
Policy(software.constructs.Construct scope,
String id) |
|
Policy(software.constructs.Construct scope,
String id,
PolicyProps props) |
protected |
Policy(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) |
protected |
Policy(software.amazon.jsii.JsiiObjectRef objRef) |
| Modifier and Type | Method and Description |
|---|---|
void |
addStatements(PolicyStatement... statement)
Adds a statement to the policy document.
|
void |
attachToGroup(IGroup group)
Attaches this policy to a group.
|
void |
attachToRole(IRole role)
Attaches this policy to a role.
|
void |
attachToUser(IUser user)
Attaches this policy to a user.
|
static IPolicy |
fromPolicyName(software.constructs.Construct scope,
String id,
String policyName)
Import a policy in this app based on its name.
|
PolicyDocument |
getDocument()
The policy document.
|
String |
getPolicyName()
The name of this policy.
|
applyRemovalPolicy, generatePhysicalName, getEnv, getPhysicalName, getResourceArnAttribute, getResourceNameAttribute, getStack, isOwnedResource, isResourcejsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitapplyRemovalPolicy, getEnv, getStackprotected Policy(software.amazon.jsii.JsiiObjectRef objRef)
protected Policy(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
@Stability(value=Stable)
public Policy(@NotNull
software.constructs.Construct scope,
@NotNull
String id,
@Nullable
PolicyProps props)
scope - This parameter is required.id - This parameter is required.props - @Stability(value=Stable)
public Policy(@NotNull
software.constructs.Construct scope,
@NotNull
String id)
scope - This parameter is required.id - This parameter is required.@Stability(value=Stable) @NotNull public static IPolicy fromPolicyName(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull String policyName)
scope - This parameter is required.id - This parameter is required.policyName - This parameter is required.@Stability(value=Stable)
public void addStatements(@NotNull
PolicyStatement... statement)
statement - This parameter is required.@Stability(value=Stable)
public void attachToGroup(@NotNull
IGroup group)
group - This parameter is required.@Stability(value=Stable)
public void attachToRole(@NotNull
IRole role)
role - This parameter is required.@Stability(value=Stable)
public void attachToUser(@NotNull
IUser user)
user - This parameter is required.@Stability(value=Stable) @NotNull public PolicyDocument getDocument()
@Stability(value=Stable) @NotNull public String getPolicyName()
getPolicyName in interface IPolicyCopyright © 2022. All rights reserved.