Class Secret
(experimental) A secret environment variable.
Inheritance
Namespace: Amazon.CDK.AWS.AppRunner.Alpha
Assembly: Amazon.CDK.AWS.AppRunner.Alpha.dll
Syntax (csharp)
public abstract class Secret : DeputyBase
Syntax (vb)
Public MustInherit Class Secret
Inherits DeputyBase
Remarks
Stability: Experimental
ExampleMetadata: infused
Examples
using Amazon.CDK.AWS.SecretsManager;
using Amazon.CDK.AWS.SSM;
Stack stack;
var secret = new Secret(stack, "Secret");
var parameter = StringParameter.FromSecureStringParameterAttributes(stack, "Parameter", new SecureStringParameterAttributes {
ParameterName = "/name",
Version = 1
});
var service = new Service(stack, "Service", new ServiceProps {
Source = Source.FromEcrPublic(new EcrPublicProps {
ImageConfiguration = new ImageConfiguration {
Port = 8000,
EnvironmentSecrets = new Dictionary<string, Secret> {
{ "SECRET", Secret.FromSecretsManager(secret) },
{ "PARAMETER", Secret.FromSsmParameter(parameter) },
{ "SECRET_ID", Secret.FromSecretsManagerVersion(secret, new SecretVersionInfo { VersionId = "version-id" }) },
{ "SECRET_STAGE", Secret.FromSecretsManagerVersion(secret, new SecretVersionInfo { VersionStage = "version-stage" }) }
}
},
ImageIdentifier = "public.ecr.aws/aws-containers/hello-app-runner:latest"
})
});
service.AddSecret("LATER_SECRET", Secret.FromSecretsManager(secret, "field"));
Synopsis
Constructors
Secret() | |
Secret(ByRefValue) | Used by jsii to construct an instance of this class from a Javascript-owned object reference |
Secret(DeputyBase.DeputyProps) | Used by jsii to construct an instance of this class from DeputyProps |
Properties
Arn | (experimental) The ARN of the secret. |
HasField | (experimental) Whether this secret uses a specific JSON field. |
Methods
FromSecretsManager(ISecret, String) | (experimental) Creates a environment variable value from a secret stored in AWS Secrets Manager. |
FromSecretsManagerVersion(ISecret, ISecretVersionInfo, String) | (experimental) Creates a environment variable value from a secret stored in AWS Secrets Manager. |
FromSsmParameter(IParameter) | (experimental) Creates an environment variable value from a parameter stored in AWS Systems Manager Parameter Store. |
GrantRead(IGrantable) | (experimental) Grants reading the secret to a principal. |
Constructors
Secret()
protected Secret()
Remarks
Stability: Experimental
Secret(ByRefValue)
Used by jsii to construct an instance of this class from a Javascript-owned object reference
protected Secret(ByRefValue reference)
Parameters
- reference Amazon.JSII.Runtime.Deputy.ByRefValue
The Javascript-owned object reference
Secret(DeputyBase.DeputyProps)
Used by jsii to construct an instance of this class from DeputyProps
protected Secret(DeputyBase.DeputyProps props)
Parameters
- props Amazon.JSII.Runtime.Deputy.DeputyBase.DeputyProps
The deputy props
Properties
Arn
(experimental) The ARN of the secret.
public abstract string Arn { get; }
Property Value
System.String
Remarks
Stability: Experimental
HasField
(experimental) Whether this secret uses a specific JSON field.
public abstract Nullable<bool> HasField { get; }
Property Value
System.Nullable<System.Boolean>
Remarks
Stability: Experimental
Methods
FromSecretsManager(ISecret, String)
(experimental) Creates a environment variable value from a secret stored in AWS Secrets Manager.
public static Secret FromSecretsManager(ISecret secret, string field = null)
Parameters
- secret ISecret
the secret stored in AWS Secrets Manager.
- field System.String
the name of the field with the value that you want to set as the environment variable value.
Returns
Remarks
Stability: Experimental
FromSecretsManagerVersion(ISecret, ISecretVersionInfo, String)
(experimental) Creates a environment variable value from a secret stored in AWS Secrets Manager.
public static Secret FromSecretsManagerVersion(ISecret secret, ISecretVersionInfo versionInfo, string field = null)
Parameters
- secret ISecret
the secret stored in AWS Secrets Manager.
- versionInfo ISecretVersionInfo
the version information to reference the secret.
- field System.String
the name of the field with the value that you want to set as the environment variable value.
Returns
Remarks
Stability: Experimental
FromSsmParameter(IParameter)
(experimental) Creates an environment variable value from a parameter stored in AWS Systems Manager Parameter Store.
public static Secret FromSsmParameter(IParameter parameter)
Parameters
- parameter IParameter
Returns
Remarks
Stability: Experimental
GrantRead(IGrantable)
(experimental) Grants reading the secret to a principal.
public abstract Grant GrantRead(IGrantable grantee)
Parameters
- grantee IGrantable
Returns
Remarks
Stability: Experimental