@Generated(value="jsii-pacmak/1.70.0 (build 03c2f6f)", date="2022-11-01T13:16:50.132Z") @Stability(value=Experimental) 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
(experimental) 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)
(experimental) Adds a statement to the policy document.
|
void |
attachToGroup(IGroup group)
(experimental) Attaches this policy to a group.
|
void |
attachToRole(IRole role)
(experimental) Attaches this policy to a role.
|
void |
attachToUser(IUser user)
(experimental) Attaches this policy to a user.
|
static IPolicy |
fromPolicyName(software.constructs.Construct scope,
String id,
String policyName)
(experimental) Import a policy in this app based on its name.
|
PolicyDocument |
getDocument()
(experimental) The policy document.
|
String |
getPolicyName()
(experimental) The name of this policy.
|
protected List<String> |
validate()
(experimental) Validate the current construct.
|
applyRemovalPolicy, generatePhysicalName, getEnv, getPhysicalName, getResourceArnAttribute, getResourceNameAttribute, getStack, isResourcegetNode, isConstruct, onPrepare, onSynthesize, onValidate, prepare, synthesizejsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitapplyRemovalPolicy, getEnv, getStackgetNodeprotected Policy(software.amazon.jsii.JsiiObjectRef objRef)
protected Policy(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
@Stability(value=Experimental)
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=Experimental)
public Policy(@NotNull
software.constructs.Construct scope,
@NotNull
String id)
scope - This parameter is required.id - This parameter is required.@Stability(value=Experimental) @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=Experimental)
public void addStatements(@NotNull
PolicyStatement... statement)
statement - This parameter is required.@Stability(value=Experimental)
public void attachToGroup(@NotNull
IGroup group)
group - This parameter is required.@Stability(value=Experimental)
public void attachToRole(@NotNull
IRole role)
role - This parameter is required.@Stability(value=Experimental)
public void attachToUser(@NotNull
IUser user)
user - This parameter is required.@Stability(value=Experimental) @NotNull protected List<String> validate()
This method can be implemented by derived constructs in order to perform validation logic. It is called on all constructs before synthesis.
@Stability(value=Experimental) @NotNull public PolicyDocument getDocument()
@Stability(value=Experimental) @NotNull public String getPolicyName()
getPolicyName in interface IPolicyCopyright © 2022. All rights reserved.