Class StringParameter

java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
software.amazon.awscdk.Resource
software.amazon.awscdk.services.ssm.StringParameter
All Implemented Interfaces:
IResource, IParameter, IStringParameter, software.amazon.jsii.JsiiSerializable, software.constructs.IConstruct, software.constructs.IDependable

@Generated(value="jsii-pacmak/1.104.0 (build e79254c)", date="2024-12-17T21:37:39.786Z") @Stability(Stable) public class StringParameter extends Resource implements IStringParameter, IParameter
Creates a new String SSM Parameter.

Example:

 StringParameter ssmParameter = StringParameter.Builder.create(this, "mySsmParameter")
         .parameterName("mySsmParameter")
         .stringValue("mySsmParameterValue")
         .build();
 
  • Constructor Details

    • StringParameter

      protected StringParameter(software.amazon.jsii.JsiiObjectRef objRef)
    • StringParameter

      protected StringParameter(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
    • StringParameter

      @Stability(Stable) public StringParameter(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull StringParameterProps props)
      Parameters:
      scope - This parameter is required.
      id - This parameter is required.
      props - This parameter is required.
  • Method Details

    • fromSecureStringParameterAttributes

      @Stability(Stable) @NotNull public static IStringParameter fromSecureStringParameterAttributes(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull SecureStringParameterAttributes attrs)
      Imports a secure string parameter from the SSM parameter store.

      Parameters:
      scope - This parameter is required.
      id - This parameter is required.
      attrs - This parameter is required.
    • fromStringParameterArn

      @Stability(Stable) @NotNull public static IStringParameter fromStringParameterArn(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull String stringParameterArn)
      Imports an external string parameter by ARN.

      Parameters:
      scope - This parameter is required.
      id - This parameter is required.
      stringParameterArn - This parameter is required.
    • fromStringParameterAttributes

      @Stability(Stable) @NotNull public static IStringParameter fromStringParameterAttributes(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull StringParameterAttributes attrs)
      Imports an external string parameter with name and optional version.

      Parameters:
      scope - This parameter is required.
      id - This parameter is required.
      attrs - This parameter is required.
    • fromStringParameterName

      @Stability(Stable) @NotNull public static IStringParameter fromStringParameterName(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull String stringParameterName)
      Imports an external string parameter by name.

      Parameters:
      scope - This parameter is required.
      id - This parameter is required.
      stringParameterName - This parameter is required.
    • valueForSecureStringParameter

      @Stability(Deprecated) @Deprecated @NotNull public static String valueForSecureStringParameter(@NotNull software.constructs.Construct scope, @NotNull String parameterName, @NotNull Number version)
      Deprecated.
      Use SecretValue.ssmSecure() instead, it will correctly type the imported value as a SecretValue and allow importing without version. SecretValue lives in the core aws-cdk-lib module.
      (deprecated) Returns a token that will resolve (during deployment).

      Parameters:
      scope - Some scope within a stack. This parameter is required.
      parameterName - The name of the SSM parameter. This parameter is required.
      version - The parameter version (required for secure strings). This parameter is required.
    • valueForStringParameter

      @Stability(Stable) @NotNull public static String valueForStringParameter(@NotNull software.constructs.Construct scope, @NotNull String parameterName, @Nullable Number version)
      Returns a token that will resolve (during deployment) to the string value of an SSM string parameter.

      Parameters:
      scope - Some scope within a stack. This parameter is required.
      parameterName - The name of the SSM parameter. This parameter is required.
      version - The parameter version (recommended in order to ensure that the value won't change during deployment).
    • valueForStringParameter

      @Stability(Stable) @NotNull public static String valueForStringParameter(@NotNull software.constructs.Construct scope, @NotNull String parameterName)
      Returns a token that will resolve (during deployment) to the string value of an SSM string parameter.

      Parameters:
      scope - Some scope within a stack. This parameter is required.
      parameterName - The name of the SSM parameter. This parameter is required.
    • valueForTypedStringParameter

      @Stability(Deprecated) @Deprecated @NotNull public static String valueForTypedStringParameter(@NotNull software.constructs.Construct scope, @NotNull String parameterName, @Nullable ParameterType type, @Nullable Number version)
      Deprecated.
      • use valueForTypedStringParameterV2 instead
      (deprecated) Returns a token that will resolve (during deployment) to the string value of an SSM string parameter.

      Parameters:
      scope - Some scope within a stack. This parameter is required.
      parameterName - The name of the SSM parameter. This parameter is required.
      type - The type of the SSM parameter.
      version - The parameter version (recommended in order to ensure that the value won't change during deployment).
    • valueForTypedStringParameter

      @Stability(Deprecated) @Deprecated @NotNull public static String valueForTypedStringParameter(@NotNull software.constructs.Construct scope, @NotNull String parameterName, @Nullable ParameterType type)
      Deprecated.
      • use valueForTypedStringParameterV2 instead
      (deprecated) Returns a token that will resolve (during deployment) to the string value of an SSM string parameter.

      Parameters:
      scope - Some scope within a stack. This parameter is required.
      parameterName - The name of the SSM parameter. This parameter is required.
      type - The type of the SSM parameter.
    • valueForTypedStringParameter

      @Stability(Deprecated) @Deprecated @NotNull public static String valueForTypedStringParameter(@NotNull software.constructs.Construct scope, @NotNull String parameterName)
      Deprecated.
      • use valueForTypedStringParameterV2 instead
      (deprecated) Returns a token that will resolve (during deployment) to the string value of an SSM string parameter.

      Parameters:
      scope - Some scope within a stack. This parameter is required.
      parameterName - The name of the SSM parameter. This parameter is required.
    • valueForTypedStringParameterV2

      @Stability(Stable) @NotNull public static String valueForTypedStringParameterV2(@NotNull software.constructs.Construct scope, @NotNull String parameterName, @Nullable ParameterValueType type, @Nullable Number version)
      Returns a token that will resolve (during deployment) to the string value of an SSM string parameter.

      Parameters:
      scope - Some scope within a stack. This parameter is required.
      parameterName - The name of the SSM parameter. This parameter is required.
      type - The type of the SSM parameter.
      version - The parameter version (recommended in order to ensure that the value won't change during deployment).
    • valueForTypedStringParameterV2

      @Stability(Stable) @NotNull public static String valueForTypedStringParameterV2(@NotNull software.constructs.Construct scope, @NotNull String parameterName, @Nullable ParameterValueType type)
      Returns a token that will resolve (during deployment) to the string value of an SSM string parameter.

      Parameters:
      scope - Some scope within a stack. This parameter is required.
      parameterName - The name of the SSM parameter. This parameter is required.
      type - The type of the SSM parameter.
    • valueForTypedStringParameterV2

      @Stability(Stable) @NotNull public static String valueForTypedStringParameterV2(@NotNull software.constructs.Construct scope, @NotNull String parameterName)
      Returns a token that will resolve (during deployment) to the string value of an SSM string parameter.

      Parameters:
      scope - Some scope within a stack. This parameter is required.
      parameterName - The name of the SSM parameter. This parameter is required.
    • valueFromLookup

      @Stability(Stable) @NotNull public static String valueFromLookup(@NotNull software.constructs.Construct scope, @NotNull String parameterName, @Nullable String defaultValue)
      Reads the value of an SSM parameter during synthesis through an environmental context provider.

      Requires that the stack this scope is defined in will have explicit account/region information. Otherwise, it will fail during synthesis.

      If defaultValue is provided, it will be used as the dummyValue and the ContextProvider will be told NOT to raise an error on synthesis if the SSM Parameter is not found in the account at synth time.

      Parameters:
      scope - This parameter is required.
      parameterName - This parameter is required.
      defaultValue -
    • valueFromLookup

      @Stability(Stable) @NotNull public static String valueFromLookup(@NotNull software.constructs.Construct scope, @NotNull String parameterName)
      Reads the value of an SSM parameter during synthesis through an environmental context provider.

      Requires that the stack this scope is defined in will have explicit account/region information. Otherwise, it will fail during synthesis.

      If defaultValue is provided, it will be used as the dummyValue and the ContextProvider will be told NOT to raise an error on synthesis if the SSM Parameter is not found in the account at synth time.

      Parameters:
      scope - This parameter is required.
      parameterName - This parameter is required.
    • grantRead

      @Stability(Stable) @NotNull public Grant grantRead(@NotNull IGrantable grantee)
      Grants read (DescribeParameter, GetParameters, GetParameter, GetParameterHistory) permissions on the SSM Parameter.

      Specified by:
      grantRead in interface IParameter
      Parameters:
      grantee - This parameter is required.
    • grantWrite

      @Stability(Stable) @NotNull public Grant grantWrite(@NotNull IGrantable grantee)
      Grants write (PutParameter) permissions on the SSM Parameter.

      Specified by:
      grantWrite in interface IParameter
      Parameters:
      grantee - This parameter is required.
    • getParameterArn

      @Stability(Stable) @NotNull public String getParameterArn()
      The ARN of the SSM Parameter resource.
      Specified by:
      getParameterArn in interface IParameter
    • getParameterName

      @Stability(Stable) @NotNull public String getParameterName()
      The name of the SSM Parameter resource.
      Specified by:
      getParameterName in interface IParameter
    • getParameterType

      @Stability(Stable) @NotNull public String getParameterType()
      The type of the SSM Parameter resource.
      Specified by:
      getParameterType in interface IParameter
    • getStringValue

      @Stability(Stable) @NotNull public String getStringValue()
      The parameter value.

      Value must not nest another parameter. Do not use {{}} in the value.

      Specified by:
      getStringValue in interface IStringParameter
    • getEncryptionKey

      @Stability(Stable) @Nullable public IKey getEncryptionKey()
      The encryption key that is used to encrypt this parameter.

      Default: - default master key