io.cloudshiftdev.awscdk.services.ec2.AmazonLinuxImageSsmParameterBaseOptions.kt Maven / Gradle / Ivy
The newest version!
@file:Suppress("RedundantVisibilityModifier","RedundantUnitReturnType","RemoveRedundantQualifierName","unused","UnusedImport","ClassName","REDUNDANT_PROJECTION","DEPRECATION")
package io.cloudshiftdev.awscdk.services.ec2
import io.cloudshiftdev.awscdk.common.CdkDslMarker
import io.cloudshiftdev.awscdk.common.CdkObject
import io.cloudshiftdev.awscdk.common.CdkObjectWrappers
import kotlin.Boolean
import kotlin.Unit
/**
* Base options for amazon linux ssm parameters.
*
* Example:
*
* ```
* // The code below shows an example of how to instantiate this type.
* // The values are placeholders you should change.
* import io.cloudshiftdev.awscdk.services.ec2.*;
* UserData userData;
* AmazonLinuxImageSsmParameterBaseOptions amazonLinuxImageSsmParameterBaseOptions =
* AmazonLinuxImageSsmParameterBaseOptions.builder()
* .cachedInContext(false)
* .userData(userData)
* .build();
* ```
*/
public interface AmazonLinuxImageSsmParameterBaseOptions {
/**
* Whether the AMI ID is cached to be stable between deployments.
*
* By default, the newest image is used on each deployment. This will cause
* instances to be replaced whenever a new version is released, and may cause
* downtime if there aren't enough running instances in the AutoScalingGroup
* to reschedule the tasks on.
*
* If set to true, the AMI ID will be cached in `cdk.context.json` and the
* same value will be used on future runs. Your instances will not be replaced
* but your AMI version will grow old over time. To refresh the AMI lookup,
* you will have to evict the value from the cache using the `cdk context`
* command. See https://docs.aws.amazon.com/cdk/latest/guide/context.html for
* more information.
*
* Can not be set to `true` in environment-agnostic stacks.
*
* Default: false
*/
public fun cachedInContext(): Boolean? = unwrap(this).getCachedInContext()
/**
* Initial user data.
*
* Default: - Empty UserData for Linux machines
*/
public fun userData(): UserData? = unwrap(this).getUserData()?.let(UserData::wrap)
/**
* A builder for [AmazonLinuxImageSsmParameterBaseOptions]
*/
@CdkDslMarker
public interface Builder {
/**
* @param cachedInContext Whether the AMI ID is cached to be stable between deployments.
* By default, the newest image is used on each deployment. This will cause
* instances to be replaced whenever a new version is released, and may cause
* downtime if there aren't enough running instances in the AutoScalingGroup
* to reschedule the tasks on.
*
* If set to true, the AMI ID will be cached in `cdk.context.json` and the
* same value will be used on future runs. Your instances will not be replaced
* but your AMI version will grow old over time. To refresh the AMI lookup,
* you will have to evict the value from the cache using the `cdk context`
* command. See https://docs.aws.amazon.com/cdk/latest/guide/context.html for
* more information.
*
* Can not be set to `true` in environment-agnostic stacks.
*/
public fun cachedInContext(cachedInContext: Boolean)
/**
* @param userData Initial user data.
*/
public fun userData(userData: UserData)
}
private class BuilderImpl : Builder {
private val cdkBuilder:
software.amazon.awscdk.services.ec2.AmazonLinuxImageSsmParameterBaseOptions.Builder =
software.amazon.awscdk.services.ec2.AmazonLinuxImageSsmParameterBaseOptions.builder()
/**
* @param cachedInContext Whether the AMI ID is cached to be stable between deployments.
* By default, the newest image is used on each deployment. This will cause
* instances to be replaced whenever a new version is released, and may cause
* downtime if there aren't enough running instances in the AutoScalingGroup
* to reschedule the tasks on.
*
* If set to true, the AMI ID will be cached in `cdk.context.json` and the
* same value will be used on future runs. Your instances will not be replaced
* but your AMI version will grow old over time. To refresh the AMI lookup,
* you will have to evict the value from the cache using the `cdk context`
* command. See https://docs.aws.amazon.com/cdk/latest/guide/context.html for
* more information.
*
* Can not be set to `true` in environment-agnostic stacks.
*/
override fun cachedInContext(cachedInContext: Boolean) {
cdkBuilder.cachedInContext(cachedInContext)
}
/**
* @param userData Initial user data.
*/
override fun userData(userData: UserData) {
cdkBuilder.userData(userData.let(UserData.Companion::unwrap))
}
public fun build(): software.amazon.awscdk.services.ec2.AmazonLinuxImageSsmParameterBaseOptions
= cdkBuilder.build()
}
private class Wrapper(
cdkObject: software.amazon.awscdk.services.ec2.AmazonLinuxImageSsmParameterBaseOptions,
) : CdkObject(cdkObject),
AmazonLinuxImageSsmParameterBaseOptions {
/**
* Whether the AMI ID is cached to be stable between deployments.
*
* By default, the newest image is used on each deployment. This will cause
* instances to be replaced whenever a new version is released, and may cause
* downtime if there aren't enough running instances in the AutoScalingGroup
* to reschedule the tasks on.
*
* If set to true, the AMI ID will be cached in `cdk.context.json` and the
* same value will be used on future runs. Your instances will not be replaced
* but your AMI version will grow old over time. To refresh the AMI lookup,
* you will have to evict the value from the cache using the `cdk context`
* command. See https://docs.aws.amazon.com/cdk/latest/guide/context.html for
* more information.
*
* Can not be set to `true` in environment-agnostic stacks.
*
* Default: false
*/
override fun cachedInContext(): Boolean? = unwrap(this).getCachedInContext()
/**
* Initial user data.
*
* Default: - Empty UserData for Linux machines
*/
override fun userData(): UserData? = unwrap(this).getUserData()?.let(UserData::wrap)
}
public companion object {
public operator fun invoke(block: Builder.() -> Unit = {}):
AmazonLinuxImageSsmParameterBaseOptions {
val builderImpl = BuilderImpl()
return Wrapper(builderImpl.apply(block).build())
}
internal
fun wrap(cdkObject: software.amazon.awscdk.services.ec2.AmazonLinuxImageSsmParameterBaseOptions):
AmazonLinuxImageSsmParameterBaseOptions = CdkObjectWrappers.wrap(cdkObject) as?
AmazonLinuxImageSsmParameterBaseOptions ?: Wrapper(cdkObject)
internal fun unwrap(wrapped: AmazonLinuxImageSsmParameterBaseOptions):
software.amazon.awscdk.services.ec2.AmazonLinuxImageSsmParameterBaseOptions = (wrapped as
CdkObject).cdkObject as
software.amazon.awscdk.services.ec2.AmazonLinuxImageSsmParameterBaseOptions
}
}