@Generated(value="jsii-pacmak/1.73.0 (build 6faeda3)", date="2023-01-31T18:36:46.855Z") public class Grant extends software.amazon.jsii.JsiiObject implements IDependable
This class is not instantiable by consumers on purpose, so that they will be required to call the Grant factory functions.
Example:
Instance instance; Volume volume; Grant attachGrant = volume.grantAttachVolumeByResourceTag(instance.getGrantPrincipal(), List.of(instance)); Grant detachGrant = volume.grantDetachVolumeByResourceTag(instance.getGrantPrincipal(), List.of(instance));
IDependable.Jsii$Default, IDependable.Jsii$Proxy
Modifier | Constructor and Description |
---|---|
protected |
Grant(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) |
protected |
Grant(software.amazon.jsii.JsiiObjectRef objRef) |
Modifier and Type | Method and Description |
---|---|
static Grant |
addToPrincipal(GrantOnPrincipalOptions options)
Try to grant the given permissions to the given principal.
|
static Grant |
addToPrincipalAndResource(GrantOnPrincipalAndResourceOptions options)
Add a grant both on the principal and on the resource.
|
static Grant |
addToPrincipalOrResource(GrantWithResourceOptions options)
Grant the given permissions to the principal.
|
void |
applyBefore(IConstruct... constructs)
Make sure this grant is applied before the given constructs are deployed.
|
void |
assertSuccess()
Throw an error if this grant wasn't successful.
|
static Grant |
drop(IGrantable grantee,
java.lang.String _intent)
Returns a "no-op" `Grant` object which represents a "dropped grant".
|
PolicyStatement |
getPrincipalStatement()
The statement that was added to the principal's policy.
|
PolicyStatement |
getResourceStatement()
The statement that was added to the resource policy.
|
java.lang.Boolean |
getSuccess()
Whether the grant operation was successful.
|
protected Grant(software.amazon.jsii.JsiiObjectRef objRef)
protected Grant(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
public static Grant addToPrincipal(GrantOnPrincipalOptions options)
Absence of a principal leads to a warning, but failing to add the permissions to a present principal is not an error.
options
- This parameter is required.public static Grant addToPrincipalAndResource(GrantOnPrincipalAndResourceOptions options)
As long as any principal is given, granting on the principal may fail (in case of a non-identity principal), but granting on the resource will never fail.
Statement will be the resource statement.
options
- This parameter is required.public static Grant addToPrincipalOrResource(GrantWithResourceOptions options)
The permissions will be added to the principal policy primarily, falling back to the resource policy if necessary. The permissions must be granted somewhere.
options
- This parameter is required.public static Grant drop(IGrantable grantee, java.lang.String _intent)
This can be used for e.g. imported resources where you may not be able to modify the resource's policy or some underlying policy which you don't know about.
grantee
- The intended grantee. This parameter is required._intent
- The user's intent (will be ignored at the moment). This parameter is required.public void applyBefore(IConstruct... constructs)
The same as construct.node.addDependency(grant), but slightly nicer to read.
constructs
- This parameter is required.public void assertSuccess()
public java.lang.Boolean getSuccess()
public PolicyStatement getPrincipalStatement()
Can be accessed to (e.g.) add additional conditions to the statement.
public PolicyStatement getResourceStatement()
Can be accessed to (e.g.) add additional conditions to the statement.