@Generated(value="jsii-pacmak/1.29.0 (build 41df200)", date="2021-06-02T09:55:48.018Z") @Stability(value=Experimental) public class Secret extends Resource implements ISecret
| Modifier and Type | Class and Description |
|---|---|
static class |
Secret.Builder
(experimental) A fluent builder for
Secret. |
software.amazon.jsii.JsiiObject.InitializationModeISecret.Jsii$Default, ISecret.Jsii$Proxy| Modifier | Constructor and Description |
|---|---|
|
Secret(software.constructs.Construct scope,
String id) |
|
Secret(software.constructs.Construct scope,
String id,
SecretProps props) |
protected |
Secret(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) |
protected |
Secret(software.amazon.jsii.JsiiObjectRef objRef) |
| Modifier and Type | Method and Description |
|---|---|
void |
addReplicaRegion(String region)
(experimental) Adds a replica region for the secret.
|
void |
addReplicaRegion(String region,
IKey encryptionKey)
(experimental) Adds a replica region for the secret.
|
RotationSchedule |
addRotationSchedule(String id,
RotationScheduleOptions options)
(experimental) Adds a rotation schedule to the secret.
|
AddToResourcePolicyResult |
addToResourcePolicy(PolicyStatement statement)
(experimental) Adds a statement to the IAM resource policy associated with this secret.
|
ISecret |
attach(ISecretAttachmentTarget target)
(experimental) Attach a target to this secret.
|
void |
denyAccountRootDelete()
(experimental) Denies the `DeleteSecret` action to all principals within the current account.
|
static ISecret |
fromSecretAttributes(software.constructs.Construct scope,
String id,
SecretAttributes attrs)
(experimental) Import an existing secret into the Stack.
|
static ISecret |
fromSecretCompleteArn(software.constructs.Construct scope,
String id,
String secretCompleteArn)
(experimental) Imports a secret by complete ARN.
|
static ISecret |
fromSecretNameV2(software.constructs.Construct scope,
String id,
String secretName)
(experimental) Imports a secret by secret name.
|
static ISecret |
fromSecretPartialArn(software.constructs.Construct scope,
String id,
String secretPartialArn)
(experimental) Imports a secret by partial ARN.
|
protected String |
getArnForPolicies()
(experimental) Provides an identifier for this secret for use in IAM policies.
|
protected Boolean |
getAutoCreatePolicy() |
IKey |
getEncryptionKey()
(experimental) The customer-managed encryption key that is used to encrypt this secret, if any.
|
String |
getSecretArn()
(experimental) The ARN of the secret in AWS Secrets Manager.
|
String |
getSecretFullArn()
(experimental) The full ARN of the secret in AWS Secrets Manager, which is the ARN including the Secrets Manager-supplied 6-character suffix.
|
String |
getSecretName()
(experimental) The name of the secret.
|
SecretValue |
getSecretValue()
(experimental) Retrieve the value of the stored secret as a `SecretValue`.
|
Grant |
grantRead(IGrantable grantee)
(experimental) Grants reading the secret value to some role.
|
Grant |
grantRead(IGrantable grantee,
List<String> versionStages)
(experimental) Grants reading the secret value to some role.
|
Grant |
grantWrite(IGrantable grantee)
(experimental) Grants writing and updating the secret value to some role.
|
SecretValue |
secretValueFromJson(String jsonField)
(experimental) Interpret the secret as a JSON object and return a field's value from it as a `SecretValue`.
|
applyRemovalPolicy, generatePhysicalName, getEnv, getPhysicalName, getResourceArnAttribute, getResourceNameAttribute, getStack, isResourcejsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetprotected Secret(software.amazon.jsii.JsiiObjectRef objRef)
protected Secret(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
@Stability(value=Experimental)
public Secret(@NotNull
software.constructs.Construct scope,
@NotNull
String id,
@Nullable
SecretProps props)
scope - This parameter is required.id - This parameter is required.props - @Stability(value=Experimental)
public Secret(@NotNull
software.constructs.Construct scope,
@NotNull
String id)
scope - This parameter is required.id - This parameter is required.@Stability(value=Experimental) @NotNull public static ISecret fromSecretAttributes(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull SecretAttributes attrs)
scope - the scope of the import. This parameter is required.id - the ID of the imported Secret in the construct tree. This parameter is required.attrs - the attributes of the imported secret. This parameter is required.@Stability(value=Experimental) @NotNull public static ISecret fromSecretCompleteArn(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull String secretCompleteArn)
The complete ARN is the ARN with the Secrets Manager-supplied suffix.
scope - This parameter is required.id - This parameter is required.secretCompleteArn - This parameter is required.@Stability(value=Experimental) @NotNull public static ISecret fromSecretNameV2(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull String secretName)
A secret with this name must exist in the same account & region.
Replaces the deprecated fromSecretName.
scope - This parameter is required.id - This parameter is required.secretName - This parameter is required.@Stability(value=Experimental) @NotNull public static ISecret fromSecretPartialArn(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull String secretPartialArn)
The partial ARN is the ARN without the Secrets Manager-supplied suffix.
scope - This parameter is required.id - This parameter is required.secretPartialArn - This parameter is required.@Stability(value=Experimental)
public void addReplicaRegion(@NotNull
String region,
@Nullable
IKey encryptionKey)
region - The name of the region. This parameter is required.encryptionKey - The customer-managed encryption key to use for encrypting the secret value.@Stability(value=Experimental)
public void addReplicaRegion(@NotNull
String region)
region - The name of the region. This parameter is required.@Stability(value=Experimental) @NotNull public RotationSchedule addRotationSchedule(@NotNull String id, @NotNull RotationScheduleOptions options)
addRotationSchedule in interface ISecretid - This parameter is required.options - This parameter is required.@Stability(value=Experimental) @NotNull public AddToResourcePolicyResult addToResourcePolicy(@NotNull PolicyStatement statement)
If this secret was created in this stack, a resource policy will be
automatically created upon the first call to addToResourcePolicy. If
the secret is imported, then this is a no-op.
addToResourcePolicy in interface ISecretstatement - This parameter is required.@Stability(value=Experimental) @NotNull public ISecret attach(@NotNull ISecretAttachmentTarget target)
@Stability(value=Experimental) public void denyAccountRootDelete()
denyAccountRootDelete in interface ISecret@Stability(value=Experimental) @NotNull public Grant grantRead(@NotNull IGrantable grantee, @Nullable List<String> versionStages)
@Stability(value=Experimental) @NotNull public Grant grantRead(@NotNull IGrantable grantee)
@Stability(value=Experimental) @NotNull public Grant grantWrite(@NotNull IGrantable grantee)
grantWrite in interface ISecretgrantee - This parameter is required.@Stability(value=Experimental) @NotNull public SecretValue secretValueFromJson(@NotNull String jsonField)
secretValueFromJson in interface ISecretjsonField - This parameter is required.@Stability(value=Experimental) @NotNull protected String getArnForPolicies()
If there is a full ARN, this is just the ARN; if we have a partial ARN -- due to either importing by secret name or partial ARN -- then we need to add a suffix to capture the full ARN's format.
@Stability(value=Experimental) @NotNull protected Boolean getAutoCreatePolicy()
@Stability(value=Experimental) @NotNull public String getSecretArn()
Will return the full ARN if available, otherwise a partial arn.
For secrets imported by the deprecated fromSecretName, it will return the secretName.
getSecretArn in interface ISecret@Stability(value=Experimental) @NotNull public String getSecretName()
For "owned" secrets, this will be the full resource name (secret name + suffix), unless the '@aws-cdk/aws-secretsmanager:parseOwnedSecretName' feature flag is set.
getSecretName in interface ISecret@Stability(value=Experimental) @NotNull public SecretValue getSecretValue()
getSecretValue in interface ISecret@Stability(value=Experimental) @Nullable public IKey getEncryptionKey()
When not specified, the default KMS key for the account and region is being used.
getEncryptionKey in interface ISecret@Stability(value=Experimental) @Nullable public String getSecretFullArn()
This is equal to secretArn in most cases, but is undefined when a full ARN is not available (e.g., secrets imported by name).
getSecretFullArn in interface ISecretCopyright © 2021. All rights reserved.