io.cloudshiftdev.awscdk.services.ssm.StringParameterProps.kt Maven / Gradle / Ivy
The newest version!
@file:Suppress("RedundantVisibilityModifier","RedundantUnitReturnType","RemoveRedundantQualifierName","unused","UnusedImport","ClassName","REDUNDANT_PROJECTION","DEPRECATION")
package io.cloudshiftdev.awscdk.services.ssm
import io.cloudshiftdev.awscdk.common.CdkDslMarker
import io.cloudshiftdev.awscdk.common.CdkObject
import io.cloudshiftdev.awscdk.common.CdkObjectWrappers
import kotlin.Boolean
import kotlin.Deprecated
import kotlin.String
import kotlin.Unit
/**
* Properties needed to create a String SSM parameter.
*
* Example:
*
* ```
* import io.cloudshiftdev.awscdk.services.lambda.*;
* IFunction func;
* StringParameter simpleParameter = StringParameter.Builder.create(this, "StringParameter")
* // the parameter name doesn't contain any '/'
* .parameterName("parameter")
* .stringValue("SOME_VALUE")
* .simpleName(true)
* .build();
* StringParameter nonSimpleParameter = StringParameter.Builder.create(this, "StringParameter")
* // the parameter name contains '/'
* .parameterName(String.format("/%s/my/app/param", func.getFunctionName()))
* .stringValue("SOME_VALUE")
* .simpleName(false)
* .build();
* ```
*/
public interface StringParameterProps : ParameterOptions {
/**
* The data type of the parameter, such as `text` or `aws:ec2:image`.
*
* Default: ParameterDataType.TEXT
*/
public fun dataType(): ParameterDataType? =
unwrap(this).getDataType()?.let(ParameterDataType::wrap)
/**
* The value of the parameter.
*
* It may not reference another parameter and `{{}}` cannot be used in the value.
*/
public fun stringValue(): String
/**
* (deprecated) The type of the string parameter.
*
* Default: ParameterType.STRING
*
* * type will always be 'String'
*/
@Deprecated(message = "deprecated in CDK")
public fun type(): ParameterType? = unwrap(this).getType()?.let(ParameterType::wrap)
/**
* A builder for [StringParameterProps]
*/
@CdkDslMarker
public interface Builder {
/**
* @param allowedPattern A regular expression used to validate the parameter value.
* For example, for String types with values restricted to
* numbers, you can specify the following: `^\d+$`
*/
public fun allowedPattern(allowedPattern: String)
/**
* @param dataType The data type of the parameter, such as `text` or `aws:ec2:image`.
*/
public fun dataType(dataType: ParameterDataType)
/**
* @param description Information about the parameter that you want to add to the system.
*/
public fun description(description: String)
/**
* @param parameterName The name of the parameter.
*/
public fun parameterName(parameterName: String)
/**
* @param simpleName Indicates whether the parameter name is a simple name.
* A parameter name
* without any "/" is considered a simple name. If the parameter name includes
* "/", setting simpleName to true might cause unintended issues such
* as duplicate "/" in the resulting ARN.
*
* This is required only if `parameterName` is a token, which means we
* are unable to detect if the name is simple or "path-like" for the purpose
* of rendering SSM parameter ARNs.
*
* If `parameterName` is not specified, `simpleName` must be `true` (or
* undefined) since the name generated by AWS CloudFormation is always a
* simple name.
*/
public fun simpleName(simpleName: Boolean)
/**
* @param stringValue The value of the parameter.
* It may not reference another parameter and `{{}}` cannot be used in the value.
*/
public fun stringValue(stringValue: String)
/**
* @param tier The tier of the string parameter.
*/
public fun tier(tier: ParameterTier)
/**
* @param type The type of the string parameter.
* @deprecated - type will always be 'String'
*/
@Deprecated(message = "deprecated in CDK")
public fun type(type: ParameterType)
}
private class BuilderImpl : Builder {
private val cdkBuilder: software.amazon.awscdk.services.ssm.StringParameterProps.Builder =
software.amazon.awscdk.services.ssm.StringParameterProps.builder()
/**
* @param allowedPattern A regular expression used to validate the parameter value.
* For example, for String types with values restricted to
* numbers, you can specify the following: `^\d+$`
*/
override fun allowedPattern(allowedPattern: String) {
cdkBuilder.allowedPattern(allowedPattern)
}
/**
* @param dataType The data type of the parameter, such as `text` or `aws:ec2:image`.
*/
override fun dataType(dataType: ParameterDataType) {
cdkBuilder.dataType(dataType.let(ParameterDataType.Companion::unwrap))
}
/**
* @param description Information about the parameter that you want to add to the system.
*/
override fun description(description: String) {
cdkBuilder.description(description)
}
/**
* @param parameterName The name of the parameter.
*/
override fun parameterName(parameterName: String) {
cdkBuilder.parameterName(parameterName)
}
/**
* @param simpleName Indicates whether the parameter name is a simple name.
* A parameter name
* without any "/" is considered a simple name. If the parameter name includes
* "/", setting simpleName to true might cause unintended issues such
* as duplicate "/" in the resulting ARN.
*
* This is required only if `parameterName` is a token, which means we
* are unable to detect if the name is simple or "path-like" for the purpose
* of rendering SSM parameter ARNs.
*
* If `parameterName` is not specified, `simpleName` must be `true` (or
* undefined) since the name generated by AWS CloudFormation is always a
* simple name.
*/
override fun simpleName(simpleName: Boolean) {
cdkBuilder.simpleName(simpleName)
}
/**
* @param stringValue The value of the parameter.
* It may not reference another parameter and `{{}}` cannot be used in the value.
*/
override fun stringValue(stringValue: String) {
cdkBuilder.stringValue(stringValue)
}
/**
* @param tier The tier of the string parameter.
*/
override fun tier(tier: ParameterTier) {
cdkBuilder.tier(tier.let(ParameterTier.Companion::unwrap))
}
/**
* @param type The type of the string parameter.
* @deprecated - type will always be 'String'
*/
@Deprecated(message = "deprecated in CDK")
override fun type(type: ParameterType) {
cdkBuilder.type(type.let(ParameterType.Companion::unwrap))
}
public fun build(): software.amazon.awscdk.services.ssm.StringParameterProps =
cdkBuilder.build()
}
private class Wrapper(
cdkObject: software.amazon.awscdk.services.ssm.StringParameterProps,
) : CdkObject(cdkObject),
StringParameterProps {
/**
* A regular expression used to validate the parameter value.
*
* For example, for String types with values restricted to
* numbers, you can specify the following: `^\d+$`
*
* Default: no validation is performed
*/
override fun allowedPattern(): String? = unwrap(this).getAllowedPattern()
/**
* The data type of the parameter, such as `text` or `aws:ec2:image`.
*
* Default: ParameterDataType.TEXT
*/
override fun dataType(): ParameterDataType? =
unwrap(this).getDataType()?.let(ParameterDataType::wrap)
/**
* Information about the parameter that you want to add to the system.
*
* Default: none
*/
override fun description(): String? = unwrap(this).getDescription()
/**
* The name of the parameter.
*
* Default: - a name will be generated by CloudFormation
*/
override fun parameterName(): String? = unwrap(this).getParameterName()
/**
* Indicates whether the parameter name is a simple name.
*
* A parameter name
* without any "/" is considered a simple name. If the parameter name includes
* "/", setting simpleName to true might cause unintended issues such
* as duplicate "/" in the resulting ARN.
*
* This is required only if `parameterName` is a token, which means we
* are unable to detect if the name is simple or "path-like" for the purpose
* of rendering SSM parameter ARNs.
*
* If `parameterName` is not specified, `simpleName` must be `true` (or
* undefined) since the name generated by AWS CloudFormation is always a
* simple name.
*
* Default: - auto-detect based on `parameterName`
*/
override fun simpleName(): Boolean? = unwrap(this).getSimpleName()
/**
* The value of the parameter.
*
* It may not reference another parameter and `{{}}` cannot be used in the value.
*/
override fun stringValue(): String = unwrap(this).getStringValue()
/**
* The tier of the string parameter.
*
* Default: - undefined
*/
override fun tier(): ParameterTier? = unwrap(this).getTier()?.let(ParameterTier::wrap)
/**
* (deprecated) The type of the string parameter.
*
* Default: ParameterType.STRING
*
* * type will always be 'String'
*/
@Deprecated(message = "deprecated in CDK")
override fun type(): ParameterType? = unwrap(this).getType()?.let(ParameterType::wrap)
}
public companion object {
public operator fun invoke(block: Builder.() -> Unit = {}): StringParameterProps {
val builderImpl = BuilderImpl()
return Wrapper(builderImpl.apply(block).build())
}
internal fun wrap(cdkObject: software.amazon.awscdk.services.ssm.StringParameterProps):
StringParameterProps = CdkObjectWrappers.wrap(cdkObject) as? StringParameterProps ?:
Wrapper(cdkObject)
internal fun unwrap(wrapped: StringParameterProps):
software.amazon.awscdk.services.ssm.StringParameterProps = (wrapped as CdkObject).cdkObject
as software.amazon.awscdk.services.ssm.StringParameterProps
}
}