com.pulumi.awsnative.autoscaling.kotlin.WarmPool.kt Maven / Gradle / Ivy
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.awsnative.autoscaling.kotlin
import com.pulumi.awsnative.autoscaling.kotlin.outputs.WarmPoolInstanceReusePolicy
import com.pulumi.awsnative.autoscaling.kotlin.outputs.WarmPoolInstanceReusePolicy.Companion.toKotlin
import com.pulumi.core.Output
import com.pulumi.kotlin.KotlinCustomResource
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.ResourceMapper
import com.pulumi.kotlin.options.CustomResourceOptions
import com.pulumi.kotlin.options.CustomResourceOptionsBuilder
import com.pulumi.resources.Resource
import kotlin.Boolean
import kotlin.Int
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
/**
* Builder for [WarmPool].
*/
@PulumiTagMarker
public class WarmPoolResourceBuilder internal constructor() {
public var name: String? = null
public var args: WarmPoolArgs = WarmPoolArgs()
public var opts: CustomResourceOptions = CustomResourceOptions()
/**
* @param name The _unique_ name of the resulting resource.
*/
public fun name(`value`: String) {
this.name = value
}
/**
* @param block The arguments to use to populate this resource's properties.
*/
public suspend fun args(block: suspend WarmPoolArgsBuilder.() -> Unit) {
val builder = WarmPoolArgsBuilder()
block(builder)
this.args = builder.build()
}
/**
* @param block A bag of options that control this resource's behavior.
*/
public suspend fun opts(block: suspend CustomResourceOptionsBuilder.() -> Unit) {
this.opts = com.pulumi.kotlin.options.CustomResourceOptions.opts(block)
}
internal fun build(): WarmPool {
val builtJavaResource = com.pulumi.awsnative.autoscaling.WarmPool(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return WarmPool(builtJavaResource)
}
}
/**
* Resource schema for AWS::AutoScaling::WarmPool.
*/
public class WarmPool internal constructor(
override val javaResource: com.pulumi.awsnative.autoscaling.WarmPool,
) : KotlinCustomResource(javaResource, WarmPoolMapper) {
/**
* The name of the Auto Scaling group.
*/
public val autoScalingGroupName: Output
get() = javaResource.autoScalingGroupName().applyValue({ args0 -> args0 })
/**
* Indicates whether instances in the Auto Scaling group can be returned to the warm pool on scale in. The default is to terminate instances in the Auto Scaling group when the group scales in.
*/
public val instanceReusePolicy: Output?
get() = javaResource.instanceReusePolicy().applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 -> toKotlin(args0) })
}).orElse(null)
})
/**
* Specifies the maximum number of instances that are allowed to be in the warm pool or in any state except `Terminated` for the Auto Scaling group. This is an optional property. Specify it only if you do not want the warm pool size to be determined by the difference between the group's maximum capacity and its desired capacity.
* > If a value for `MaxGroupPreparedCapacity` is not specified, Amazon EC2 Auto Scaling launches and maintains the difference between the group's maximum capacity and its desired capacity. If you specify a value for `MaxGroupPreparedCapacity` , Amazon EC2 Auto Scaling uses the difference between the `MaxGroupPreparedCapacity` and the desired capacity instead.
* >
* > The size of the warm pool is dynamic. Only when `MaxGroupPreparedCapacity` and `MinSize` are set to the same value does the warm pool have an absolute size.
* If the desired capacity of the Auto Scaling group is higher than the `MaxGroupPreparedCapacity` , the capacity of the warm pool is 0, unless you specify a value for `MinSize` . To remove a value that you previously set, include the property but specify -1 for the value.
*/
public val maxGroupPreparedCapacity: Output?
get() = javaResource.maxGroupPreparedCapacity().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* Specifies the minimum number of instances to maintain in the warm pool. This helps you to ensure that there is always a certain number of warmed instances available to handle traffic spikes. Defaults to 0 if not specified.
*/
public val minSize: Output?
get() = javaResource.minSize().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })
/**
* Sets the instance state to transition to after the lifecycle actions are complete. Default is `Stopped` .
*/
public val poolState: Output?
get() = javaResource.poolState().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })
}
public object WarmPoolMapper : ResourceMapper {
override fun supportsMappingOfType(javaResource: Resource): Boolean =
com.pulumi.awsnative.autoscaling.WarmPool::class == javaResource::class
override fun map(javaResource: Resource): WarmPool = WarmPool(
javaResource as
com.pulumi.awsnative.autoscaling.WarmPool,
)
}
/**
* @see [WarmPool].
* @param name The _unique_ name of the resulting resource.
* @param block Builder for [WarmPool].
*/
public suspend fun warmPool(name: String, block: suspend WarmPoolResourceBuilder.() -> Unit): WarmPool {
val builder = WarmPoolResourceBuilder()
builder.name(name)
block(builder)
return builder.build()
}
/**
* @see [WarmPool].
* @param name The _unique_ name of the resulting resource.
*/
public fun warmPool(name: String): WarmPool {
val builder = WarmPoolResourceBuilder()
builder.name(name)
return builder.build()
}