com.pulumi.awsnative.cloudfront.kotlin.CachePolicy.kt Maven / Gradle / Ivy
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.awsnative.cloudfront.kotlin
import com.pulumi.awsnative.cloudfront.kotlin.outputs.CachePolicyConfig
import com.pulumi.awsnative.cloudfront.kotlin.outputs.CachePolicyConfig.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.String
import kotlin.Suppress
import kotlin.Unit
/**
* Builder for [CachePolicy].
*/
@PulumiTagMarker
public class CachePolicyResourceBuilder internal constructor() {
public var name: String? = null
public var args: CachePolicyArgs = CachePolicyArgs()
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 CachePolicyArgsBuilder.() -> Unit) {
val builder = CachePolicyArgsBuilder()
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(): CachePolicy {
val builtJavaResource = com.pulumi.awsnative.cloudfront.CachePolicy(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return CachePolicy(builtJavaResource)
}
}
/**
* Resource Type definition for AWS::CloudFront::CachePolicy
*/
public class CachePolicy internal constructor(
override val javaResource: com.pulumi.awsnative.cloudfront.CachePolicy,
) : KotlinCustomResource(javaResource, CachePolicyMapper) {
/**
* The unique identifier for the cache policy. For example: `2766f7b2-75c5-41c6-8f06-bf4303a2f2f5` .
*/
public val awsId: Output
get() = javaResource.awsId().applyValue({ args0 -> args0 })
/**
* The cache policy configuration.
*/
public val cachePolicyConfig: Output
get() = javaResource.cachePolicyConfig().applyValue({ args0 ->
args0.let({ args0 ->
toKotlin(args0)
})
})
/**
* The date and time when the cache policy was last modified.
*/
public val lastModifiedTime: Output
get() = javaResource.lastModifiedTime().applyValue({ args0 -> args0 })
}
public object CachePolicyMapper : ResourceMapper {
override fun supportsMappingOfType(javaResource: Resource): Boolean =
com.pulumi.awsnative.cloudfront.CachePolicy::class == javaResource::class
override fun map(javaResource: Resource): CachePolicy = CachePolicy(
javaResource as
com.pulumi.awsnative.cloudfront.CachePolicy,
)
}
/**
* @see [CachePolicy].
* @param name The _unique_ name of the resulting resource.
* @param block Builder for [CachePolicy].
*/
public suspend fun cachePolicy(name: String, block: suspend CachePolicyResourceBuilder.() -> Unit): CachePolicy {
val builder = CachePolicyResourceBuilder()
builder.name(name)
block(builder)
return builder.build()
}
/**
* @see [CachePolicy].
* @param name The _unique_ name of the resulting resource.
*/
public fun cachePolicy(name: String): CachePolicy {
val builder = CachePolicyResourceBuilder()
builder.name(name)
return builder.build()
}