Class Grant
- All Implemented Interfaces:
software.amazon.jsii.JsiiSerializable
,software.constructs.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));
-
Nested Class Summary
Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationMode
Nested classes/interfaces inherited from interface software.constructs.IDependable
software.constructs.IDependable.Jsii$Default, software.constructs.IDependable.Jsii$Proxy
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Grant
addToPrincipal
(GrantOnPrincipalOptions options) Try to grant the given permissions to the given principal.static Grant
Add a grant both on the principal and on the resource.static Grant
Grant the given permissions to the principal.void
applyBefore
(@NotNull software.constructs.IConstruct... constructs) Make sure this grant is applied before the given constructs are deployed.void
Throw an error if this grant wasn't successful.Combine two grants into a new one.static Grant
drop
(IGrantable grantee, String _intent) Returns a "no-op"Grant
object which represents a "dropped grant".Deprecated.The statements that were added to the principal's policy.Deprecated.UseresourceStatements
insteadThe statements that were added to the principal's policy.Whether the grant operation was successful.Methods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSet
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Constructor Details
-
Grant
protected Grant(software.amazon.jsii.JsiiObjectRef objRef) -
Grant
protected Grant(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
-
-
Method Details
-
addToPrincipal
@Stability(Stable) @NotNull public static Grant addToPrincipal(@NotNull GrantOnPrincipalOptions options) Try to grant the given permissions to the given principal.Absence of a principal leads to a warning, but failing to add the permissions to a present principal is not an error.
- Parameters:
options
- This parameter is required.
-
addToPrincipalAndResource
@Stability(Stable) @NotNull public static Grant addToPrincipalAndResource(@NotNull GrantOnPrincipalAndResourceOptions options) Add a grant both on the principal and on the resource.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.
- Parameters:
options
- This parameter is required.
-
addToPrincipalOrResource
@Stability(Stable) @NotNull public static Grant addToPrincipalOrResource(@NotNull GrantWithResourceOptions options) Grant the given permissions to the principal.The permissions will be added to the principal policy primarily, falling back to the resource policy if necessary. The permissions must be granted somewhere.
- Trying to grant permissions to a principal that does not admit adding to the principal policy while not providing a resource with a resource policy is an error.
- Trying to grant permissions to an absent principal (possible in the case of imported resources) leads to a warning being added to the resource construct.
- Parameters:
options
- This parameter is required.
-
drop
@Stability(Stable) @NotNull public static Grant drop(@NotNull IGrantable grantee, @NotNull String _intent) Returns a "no-op"Grant
object which represents a "dropped grant".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.
- Parameters:
grantee
- The intended grantee. This parameter is required._intent
- The user's intent (will be ignored at the moment). This parameter is required.
-
applyBefore
@Stability(Stable) public void applyBefore(@NotNull @NotNull software.constructs.IConstruct... constructs) Make sure this grant is applied before the given constructs are deployed.The same as construct.node.addDependency(grant), but slightly nicer to read.
- Parameters:
constructs
- This parameter is required.
-
assertSuccess
@Stability(Stable) public void assertSuccess()Throw an error if this grant wasn't successful. -
combine
Combine two grants into a new one.- Parameters:
rhs
- This parameter is required.
-
getPrincipalStatements
The statements that were added to the principal's policy. -
getResourceStatements
The statements that were added to the principal's policy. -
getSuccess
Whether the grant operation was successful. -
getPrincipalStatement
Deprecated.UseprincipalStatements
instead(deprecated) The statement that was added to the principal's policy. -
getResourceStatement
Deprecated.UseresourceStatements
instead(deprecated) The statement that was added to the resource policy.
-
principalStatements
instead