com.pulumi.awsnative.iot.kotlin.CustomMetric.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pulumi-aws-native-kotlin Show documentation
Show all versions of pulumi-aws-native-kotlin Show documentation
Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.awsnative.iot.kotlin
import com.pulumi.awsnative.iot.kotlin.enums.CustomMetricMetricType
import com.pulumi.awsnative.kotlin.outputs.Tag
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
import kotlin.collections.List
import com.pulumi.awsnative.iot.kotlin.enums.CustomMetricMetricType.Companion.toKotlin as customMetricMetricTypeToKotlin
import com.pulumi.awsnative.kotlin.outputs.Tag.Companion.toKotlin as tagToKotlin
/**
* Builder for [CustomMetric].
*/
@PulumiTagMarker
public class CustomMetricResourceBuilder internal constructor() {
public var name: String? = null
public var args: CustomMetricArgs = CustomMetricArgs()
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 CustomMetricArgsBuilder.() -> Unit) {
val builder = CustomMetricArgsBuilder()
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(): CustomMetric {
val builtJavaResource = com.pulumi.awsnative.iot.CustomMetric(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return CustomMetric(builtJavaResource)
}
}
/**
* A custom metric published by your devices to Device Defender.
* ## Example Usage
* ### Example
* No Java example available.
*/
public class CustomMetric internal constructor(
override val javaResource: com.pulumi.awsnative.iot.CustomMetric,
) : KotlinCustomResource(javaResource, CustomMetricMapper) {
/**
* Field represents a friendly name in the console for the custom metric; it doesn't have to be unique. Don't use this name as the metric identifier in the device metric report. Can be updated once defined.
*/
public val displayName: Output?
get() = javaResource.displayName().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* The Amazon Resource Number (ARN) of the custom metric.
*/
public val metricArn: Output
get() = javaResource.metricArn().applyValue({ args0 -> args0 })
/**
* The name of the custom metric. This will be used in the metric report submitted from the device/thing. Shouldn't begin with aws: . Cannot be updated once defined.
*/
public val metricName: Output?
get() = javaResource.metricName().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* The type of the custom metric. Types include string-list, ip-address-list, number-list, and number.
*/
public val metricType: Output
get() = javaResource.metricType().applyValue({ args0 ->
args0.let({ args0 ->
customMetricMetricTypeToKotlin(args0)
})
})
/**
* An array of key-value pairs to apply to this resource.
*/
public val tags: Output>?
get() = javaResource.tags().applyValue({ args0 ->
args0.map({ args0 ->
args0.map({ args0 ->
args0.let({ args0 -> tagToKotlin(args0) })
})
}).orElse(null)
})
}
public object CustomMetricMapper : ResourceMapper {
override fun supportsMappingOfType(javaResource: Resource): Boolean =
com.pulumi.awsnative.iot.CustomMetric::class == javaResource::class
override fun map(javaResource: Resource): CustomMetric = CustomMetric(
javaResource as
com.pulumi.awsnative.iot.CustomMetric,
)
}
/**
* @see [CustomMetric].
* @param name The _unique_ name of the resulting resource.
* @param block Builder for [CustomMetric].
*/
public suspend fun customMetric(
name: String,
block: suspend CustomMetricResourceBuilder.() -> Unit,
): CustomMetric {
val builder = CustomMetricResourceBuilder()
builder.name(name)
block(builder)
return builder.build()
}
/**
* @see [CustomMetric].
* @param name The _unique_ name of the resulting resource.
*/
public fun customMetric(name: String): CustomMetric {
val builder = CustomMetricResourceBuilder()
builder.name(name)
return builder.build()
}