com.pulumi.awsnative.evidently.kotlin.Experiment.kt Maven / Gradle / Ivy
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.awsnative.evidently.kotlin
import com.pulumi.awsnative.evidently.kotlin.outputs.ExperimentMetricGoalObject
import com.pulumi.awsnative.evidently.kotlin.outputs.ExperimentOnlineAbConfigObject
import com.pulumi.awsnative.evidently.kotlin.outputs.ExperimentRunningStatusObject
import com.pulumi.awsnative.evidently.kotlin.outputs.ExperimentTreatmentObject
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.Int
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import com.pulumi.awsnative.evidently.kotlin.outputs.ExperimentMetricGoalObject.Companion.toKotlin as experimentMetricGoalObjectToKotlin
import com.pulumi.awsnative.evidently.kotlin.outputs.ExperimentOnlineAbConfigObject.Companion.toKotlin as experimentOnlineAbConfigObjectToKotlin
import com.pulumi.awsnative.evidently.kotlin.outputs.ExperimentRunningStatusObject.Companion.toKotlin as experimentRunningStatusObjectToKotlin
import com.pulumi.awsnative.evidently.kotlin.outputs.ExperimentTreatmentObject.Companion.toKotlin as experimentTreatmentObjectToKotlin
import com.pulumi.awsnative.kotlin.outputs.Tag.Companion.toKotlin as tagToKotlin
/**
* Builder for [Experiment].
*/
@PulumiTagMarker
public class ExperimentResourceBuilder internal constructor() {
public var name: String? = null
public var args: ExperimentArgs = ExperimentArgs()
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 ExperimentArgsBuilder.() -> Unit) {
val builder = ExperimentArgsBuilder()
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(): Experiment {
val builtJavaResource = com.pulumi.awsnative.evidently.Experiment(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return Experiment(builtJavaResource)
}
}
/**
* Resource Type definition for AWS::Evidently::Experiment.
*/
public class Experiment internal constructor(
override val javaResource: com.pulumi.awsnative.evidently.Experiment,
) : KotlinCustomResource(javaResource, ExperimentMapper) {
/**
* The ARN of the experiment. For example, `arn:aws:evidently:us-west-2:0123455678912:project/myProject/experiment/myExperiment`
*/
public val arn: Output
get() = javaResource.arn().applyValue({ args0 -> args0 })
/**
* An optional description of the experiment.
*/
public val description: Output?
get() = javaResource.description().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* An array of structures that defines the metrics used for the experiment, and whether a higher or lower value for each metric is the goal. You can use up to three metrics in an experiment.
*/
public val metricGoals: Output>
get() = javaResource.metricGoals().applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 ->
experimentMetricGoalObjectToKotlin(args0)
})
})
})
/**
* A name for the new experiment.
*/
public val name: Output
get() = javaResource.name().applyValue({ args0 -> args0 })
/**
* A structure that contains the configuration of which variation to use as the "control" version. The "control" version is used for comparison with other variations. This structure also specifies how much experiment traffic is allocated to each variation.
*/
public val onlineAbConfig: Output
get() = javaResource.onlineAbConfig().applyValue({ args0 ->
args0.let({ args0 ->
experimentOnlineAbConfigObjectToKotlin(args0)
})
})
/**
* The name or the ARN of the project where this experiment is to be created.
*/
public val project: Output
get() = javaResource.project().applyValue({ args0 -> args0 })
/**
* When Evidently assigns a particular user session to an experiment, it must use a randomization ID to determine which variation the user session is served. This randomization ID is a combination of the entity ID and `randomizationSalt` . If you omit `randomizationSalt` , Evidently uses the experiment name as the `randomizationSalt` .
*/
public val randomizationSalt: Output?
get() = javaResource.randomizationSalt().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* Set this to `true` to remove the segment that is associated with this experiment. You can't use this parameter if the experiment is currently running.
*/
public val removeSegment: Output?
get() = javaResource.removeSegment().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* Start Experiment. Default is False
*/
public val runningStatus: Output?
get() = javaResource.runningStatus().applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 -> experimentRunningStatusObjectToKotlin(args0) })
}).orElse(null)
})
/**
* The portion of the available audience that you want to allocate to this experiment, in thousandths of a percent. The available audience is the total audience minus the audience that you have allocated to overrides or current launches of this feature.
* This is represented in thousandths of a percent. For example, specify 10,000 to allocate 10% of the available audience.
*/
public val samplingRate: Output?
get() = javaResource.samplingRate().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* Specifies an audience *segment* to use in the experiment. When a segment is used in an experiment, only user sessions that match the segment pattern are used in the experiment.
* For more information, see [Segment rule pattern syntax](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-Evidently-segments.html#CloudWatch-Evidently-segments-syntax) .
*/
public val segment: Output?
get() = javaResource.segment().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })
/**
* 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)
})
/**
* An array of structures that describe the configuration of each feature variation used in the experiment.
*/
public val treatments: Output>
get() = javaResource.treatments().applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 ->
experimentTreatmentObjectToKotlin(args0)
})
})
})
}
public object ExperimentMapper : ResourceMapper {
override fun supportsMappingOfType(javaResource: Resource): Boolean =
com.pulumi.awsnative.evidently.Experiment::class == javaResource::class
override fun map(javaResource: Resource): Experiment = Experiment(
javaResource as
com.pulumi.awsnative.evidently.Experiment,
)
}
/**
* @see [Experiment].
* @param name The _unique_ name of the resulting resource.
* @param block Builder for [Experiment].
*/
public suspend fun experiment(name: String, block: suspend ExperimentResourceBuilder.() -> Unit): Experiment {
val builder = ExperimentResourceBuilder()
builder.name(name)
block(builder)
return builder.build()
}
/**
* @see [Experiment].
* @param name The _unique_ name of the resulting resource.
*/
public fun experiment(name: String): Experiment {
val builder = ExperimentResourceBuilder()
builder.name(name)
return builder.build()
}