@Generated(value="jsii-pacmak/1.67.0 (build 2c027f5)", date="2022-09-19T20:26:39.780Z") @Stability(value=Stable) public class PolicyDocument extends software.amazon.jsii.JsiiObject implements IResolvable
Example:
IRole myTrustedAdminRole = Role.fromRoleArn(this, "TrustedRole", "arn:aws:iam:....");
// Creates a limited admin policy and assigns to the account root.
PolicyDocument myCustomPolicy = PolicyDocument.Builder.create()
.statements(List.of(PolicyStatement.Builder.create()
.actions(List.of("kms:Create*", "kms:Describe*", "kms:Enable*", "kms:List*", "kms:Put*"))
.principals(List.of(new AccountRootPrincipal()))
.resources(List.of("*"))
.build()))
.build();
Key key = Key.Builder.create(this, "MyKey")
.policy(myCustomPolicy)
.build();
| Modifier and Type | Class and Description |
|---|---|
static class |
PolicyDocument.Builder
A fluent builder for
PolicyDocument. |
software.amazon.jsii.JsiiObject.InitializationModeIResolvable.Jsii$Default, IResolvable.Jsii$Proxy| Modifier | Constructor and Description |
|---|---|
|
PolicyDocument() |
protected |
PolicyDocument(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) |
protected |
PolicyDocument(software.amazon.jsii.JsiiObjectRef objRef) |
|
PolicyDocument(PolicyDocumentProps props) |
| Modifier and Type | Method and Description |
|---|---|
void |
addStatements(PolicyStatement... statement)
Adds a statement to the policy document.
|
static PolicyDocument |
fromJson(Object obj)
Creates a new PolicyDocument based on the object provided.
|
List<String> |
getCreationStack()
The creation stack of this resolvable which will be appended to errors thrown during resolution.
|
Boolean |
getIsEmpty()
Whether the policy document contains any statements.
|
Number |
getStatementCount()
The number of statements already added to this policy.
|
Object |
resolve(IResolveContext context)
Produce the Token's value at resolution time.
|
Object |
toJSON()
JSON-ify the document.
|
String |
toString()
Encode the policy document as a string.
|
List<String> |
validateForAnyPolicy()
Validate that all policy statements in the policy document satisfies the requirements for any policy.
|
List<String> |
validateForIdentityPolicy()
Validate that all policy statements in the policy document satisfies the requirements for an identity-based policy.
|
List<String> |
validateForResourcePolicy()
Validate that all policy statements in the policy document satisfies the requirements for a resource-based policy.
|
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetprotected PolicyDocument(software.amazon.jsii.JsiiObjectRef objRef)
protected PolicyDocument(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
@Stability(value=Stable)
public PolicyDocument(@Nullable
PolicyDocumentProps props)
props - @Stability(value=Stable) public PolicyDocument()
@Stability(value=Stable) @NotNull public static PolicyDocument fromJson(@NotNull Object obj)
This will accept an object created from the .toJSON() call
obj - the PolicyDocument in object form. This parameter is required.@Stability(value=Stable)
public void addStatements(@NotNull
PolicyStatement... statement)
statement - the statement to add. This parameter is required.@Stability(value=Stable) @NotNull public Object resolve(@NotNull IResolveContext context)
resolve in interface IResolvablecontext - This parameter is required.@Stability(value=Stable) @NotNull public Object toJSON()
Used when JSON.stringify() is called
@Stability(value=Stable) @NotNull public String toString()
toString in interface IResolvabletoString in class Object@Stability(value=Stable) @NotNull public List<String> validateForAnyPolicy()
@Stability(value=Stable) @NotNull public List<String> validateForIdentityPolicy()
@Stability(value=Stable) @NotNull public List<String> validateForResourcePolicy()
@Stability(value=Stable) @NotNull public List<String> getCreationStack()
This may return an array with a single informational element indicating how to get this property populated, if it was skipped for performance reasons.
getCreationStack in interface IResolvable@Stability(value=Stable) @NotNull public Boolean getIsEmpty()
@Stability(value=Stable) @NotNull public Number getStatementCount()
Can be used, for example, to generate unique "sid"s within the policy.
Copyright © 2022. All rights reserved.