com.pulumi.awsnative.events.kotlin.Rule.kt Maven / Gradle / Ivy
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.awsnative.events.kotlin
import com.pulumi.awsnative.events.kotlin.enums.RuleState
import com.pulumi.awsnative.events.kotlin.outputs.RuleTarget
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.Any
import kotlin.Boolean
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import com.pulumi.awsnative.events.kotlin.enums.RuleState.Companion.toKotlin as ruleStateToKotlin
import com.pulumi.awsnative.events.kotlin.outputs.RuleTarget.Companion.toKotlin as ruleTargetToKotlin
/**
* Builder for [Rule].
*/
@PulumiTagMarker
public class RuleResourceBuilder internal constructor() {
public var name: String? = null
public var args: RuleArgs = RuleArgs()
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 RuleArgsBuilder.() -> Unit) {
val builder = RuleArgsBuilder()
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(): Rule {
val builtJavaResource = com.pulumi.awsnative.events.Rule(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return Rule(builtJavaResource)
}
}
/**
* Resource Type definition for AWS::Events::Rule
* ## Example Usage
* ### Example
* No Java example available.
*/
public class Rule internal constructor(
override val javaResource: com.pulumi.awsnative.events.Rule,
) : KotlinCustomResource(javaResource, RuleMapper) {
/**
* The ARN of the rule, such as arn:aws:events:us-east-2:123456789012:rule/example.
*/
public val arn: Output
get() = javaResource.arn().applyValue({ args0 -> args0 })
/**
* The description of the rule.
*/
public val description: Output?
get() = javaResource.description().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* The name or ARN of the event bus associated with the rule. If you omit this, the default event bus is used.
*/
public val eventBusName: Output?
get() = javaResource.eventBusName().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* The event pattern of the rule. For more information, see Events and Event Patterns in the Amazon EventBridge User Guide.
* Search the [CloudFormation User Guide](https://docs.aws.amazon.com/cloudformation/) for `AWS::Events::Rule` for more information about the expected schema for this property.
*/
public val eventPattern: Output?
get() = javaResource.eventPattern().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* The name of the rule.
*/
public val name: Output?
get() = javaResource.name().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })
/**
* The Amazon Resource Name (ARN) of the role that is used for target invocation.
*/
public val roleArn: Output?
get() = javaResource.roleArn().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })
/**
* The scheduling expression. For example, "cron(0 20 * * ? *)", "rate(5 minutes)". For more information, see Creating an Amazon EventBridge rule that runs on a schedule.
*/
public val scheduleExpression: Output?
get() = javaResource.scheduleExpression().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* The state of the rule.
*/
public val state: Output?
get() = javaResource.state().applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 ->
ruleStateToKotlin(args0)
})
}).orElse(null)
})
/**
* Adds the specified targets to the specified rule, or updates the targets if they are already associated with the rule.
* Targets are the resources that are invoked when a rule is triggered.
*/
public val targets: Output>?
get() = javaResource.targets().applyValue({ args0 ->
args0.map({ args0 ->
args0.map({ args0 ->
args0.let({ args0 -> ruleTargetToKotlin(args0) })
})
}).orElse(null)
})
}
public object RuleMapper : ResourceMapper {
override fun supportsMappingOfType(javaResource: Resource): Boolean =
com.pulumi.awsnative.events.Rule::class == javaResource::class
override fun map(javaResource: Resource): Rule = Rule(
javaResource as
com.pulumi.awsnative.events.Rule,
)
}
/**
* @see [Rule].
* @param name The _unique_ name of the resulting resource.
* @param block Builder for [Rule].
*/
public suspend fun rule(name: String, block: suspend RuleResourceBuilder.() -> Unit): Rule {
val builder = RuleResourceBuilder()
builder.name(name)
block(builder)
return builder.build()
}
/**
* @see [Rule].
* @param name The _unique_ name of the resulting resource.
*/
public fun rule(name: String): Rule {
val builder = RuleResourceBuilder()
builder.name(name)
return builder.build()
}