com.pulumi.aws.autoscaling.kotlin.Notification.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pulumi-aws-kotlin Show documentation
Show all versions of pulumi-aws-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.aws.autoscaling.kotlin
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
/**
* Builder for [Notification].
*/
@PulumiTagMarker
public class NotificationResourceBuilder internal constructor() {
public var name: String? = null
public var args: NotificationArgs = NotificationArgs()
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 NotificationArgsBuilder.() -> Unit) {
val builder = NotificationArgsBuilder()
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(): Notification {
val builtJavaResource = com.pulumi.aws.autoscaling.Notification(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return Notification(builtJavaResource)
}
}
/**
* Provides an AutoScaling Group with Notification support, via SNS Topics. Each of
* the `notifications` map to a [Notification Configuration](https://docs.aws.amazon.com/AutoScaling/latest/APIReference/API_DescribeNotificationConfigurations.html) inside Amazon Web
* Services, and are applied to each AutoScaling Group you supply.
* ## Example Usage
* Basic usage:
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
* const example = new aws.sns.Topic("example", {name: "example-topic"});
* const bar = new aws.autoscaling.Group("bar", {name: "foobar1-test"});
* const foo = new aws.autoscaling.Group("foo", {name: "barfoo-test"});
* const exampleNotifications = new aws.autoscaling.Notification("example_notifications", {
* groupNames: [
* bar.name,
* foo.name,
* ],
* notifications: [
* "autoscaling:EC2_INSTANCE_LAUNCH",
* "autoscaling:EC2_INSTANCE_TERMINATE",
* "autoscaling:EC2_INSTANCE_LAUNCH_ERROR",
* "autoscaling:EC2_INSTANCE_TERMINATE_ERROR",
* ],
* topicArn: example.arn,
* });
* ```
* ```python
* import pulumi
* import pulumi_aws as aws
* example = aws.sns.Topic("example", name="example-topic")
* bar = aws.autoscaling.Group("bar", name="foobar1-test")
* foo = aws.autoscaling.Group("foo", name="barfoo-test")
* example_notifications = aws.autoscaling.Notification("example_notifications",
* group_names=[
* bar.name,
* foo.name,
* ],
* notifications=[
* "autoscaling:EC2_INSTANCE_LAUNCH",
* "autoscaling:EC2_INSTANCE_TERMINATE",
* "autoscaling:EC2_INSTANCE_LAUNCH_ERROR",
* "autoscaling:EC2_INSTANCE_TERMINATE_ERROR",
* ],
* topic_arn=example.arn)
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Aws = Pulumi.Aws;
* return await Deployment.RunAsync(() =>
* {
* var example = new Aws.Sns.Topic("example", new()
* {
* Name = "example-topic",
* });
* var bar = new Aws.AutoScaling.Group("bar", new()
* {
* Name = "foobar1-test",
* });
* var foo = new Aws.AutoScaling.Group("foo", new()
* {
* Name = "barfoo-test",
* });
* var exampleNotifications = new Aws.AutoScaling.Notification("example_notifications", new()
* {
* GroupNames = new[]
* {
* bar.Name,
* foo.Name,
* },
* Notifications = new[]
* {
* "autoscaling:EC2_INSTANCE_LAUNCH",
* "autoscaling:EC2_INSTANCE_TERMINATE",
* "autoscaling:EC2_INSTANCE_LAUNCH_ERROR",
* "autoscaling:EC2_INSTANCE_TERMINATE_ERROR",
* },
* TopicArn = example.Arn,
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/autoscaling"
* "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/sns"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* example, err := sns.NewTopic(ctx, "example", &sns.TopicArgs{
* Name: pulumi.String("example-topic"),
* })
* if err != nil {
* return err
* }
* bar, err := autoscaling.NewGroup(ctx, "bar", &autoscaling.GroupArgs{
* Name: pulumi.String("foobar1-test"),
* })
* if err != nil {
* return err
* }
* foo, err := autoscaling.NewGroup(ctx, "foo", &autoscaling.GroupArgs{
* Name: pulumi.String("barfoo-test"),
* })
* if err != nil {
* return err
* }
* _, err = autoscaling.NewNotification(ctx, "example_notifications", &autoscaling.NotificationArgs{
* GroupNames: pulumi.StringArray{
* bar.Name,
* foo.Name,
* },
* Notifications: pulumi.StringArray{
* pulumi.String("autoscaling:EC2_INSTANCE_LAUNCH"),
* pulumi.String("autoscaling:EC2_INSTANCE_TERMINATE"),
* pulumi.String("autoscaling:EC2_INSTANCE_LAUNCH_ERROR"),
* pulumi.String("autoscaling:EC2_INSTANCE_TERMINATE_ERROR"),
* },
* TopicArn: example.Arn,
* })
* if err != nil {
* return err
* }
* return nil
* })
* }
* ```
* ```java
* package generated_program;
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.aws.sns.Topic;
* import com.pulumi.aws.sns.TopicArgs;
* import com.pulumi.aws.autoscaling.Group;
* import com.pulumi.aws.autoscaling.GroupArgs;
* import com.pulumi.aws.autoscaling.Notification;
* import com.pulumi.aws.autoscaling.NotificationArgs;
* import java.util.List;
* import java.util.ArrayList;
* import java.util.Map;
* import java.io.File;
* import java.nio.file.Files;
* import java.nio.file.Paths;
* public class App {
* public static void main(String[] args) {
* Pulumi.run(App::stack);
* }
* public static void stack(Context ctx) {
* var example = new Topic("example", TopicArgs.builder()
* .name("example-topic")
* .build());
* var bar = new Group("bar", GroupArgs.builder()
* .name("foobar1-test")
* .build());
* var foo = new Group("foo", GroupArgs.builder()
* .name("barfoo-test")
* .build());
* var exampleNotifications = new Notification("exampleNotifications", NotificationArgs.builder()
* .groupNames(
* bar.name(),
* foo.name())
* .notifications(
* "autoscaling:EC2_INSTANCE_LAUNCH",
* "autoscaling:EC2_INSTANCE_TERMINATE",
* "autoscaling:EC2_INSTANCE_LAUNCH_ERROR",
* "autoscaling:EC2_INSTANCE_TERMINATE_ERROR")
* .topicArn(example.arn())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* exampleNotifications:
* type: aws:autoscaling:Notification
* name: example_notifications
* properties:
* groupNames:
* - ${bar.name}
* - ${foo.name}
* notifications:
* - autoscaling:EC2_INSTANCE_LAUNCH
* - autoscaling:EC2_INSTANCE_TERMINATE
* - autoscaling:EC2_INSTANCE_LAUNCH_ERROR
* - autoscaling:EC2_INSTANCE_TERMINATE_ERROR
* topicArn: ${example.arn}
* example:
* type: aws:sns:Topic
* properties:
* name: example-topic
* bar:
* type: aws:autoscaling:Group
* properties:
* name: foobar1-test
* foo:
* type: aws:autoscaling:Group
* properties:
* name: barfoo-test
* ```
*
*/
public class Notification internal constructor(
override val javaResource: com.pulumi.aws.autoscaling.Notification,
) : KotlinCustomResource(javaResource, NotificationMapper) {
/**
* List of AutoScaling Group Names
*/
public val groupNames: Output>
get() = javaResource.groupNames().applyValue({ args0 -> args0.map({ args0 -> args0 }) })
/**
* List of Notification Types that trigger
* notifications. Acceptable values are documented [in the AWS documentation here](https://docs.aws.amazon.com/AutoScaling/latest/APIReference/API_NotificationConfiguration.html)
*/
public val notifications: Output>
get() = javaResource.notifications().applyValue({ args0 -> args0.map({ args0 -> args0 }) })
/**
* Topic ARN for notifications to be sent through
*/
public val topicArn: Output
get() = javaResource.topicArn().applyValue({ args0 -> args0 })
}
public object NotificationMapper : ResourceMapper {
override fun supportsMappingOfType(javaResource: Resource): Boolean =
com.pulumi.aws.autoscaling.Notification::class == javaResource::class
override fun map(javaResource: Resource): Notification = Notification(
javaResource as
com.pulumi.aws.autoscaling.Notification,
)
}
/**
* @see [Notification].
* @param name The _unique_ name of the resulting resource.
* @param block Builder for [Notification].
*/
public suspend fun notification(
name: String,
block: suspend NotificationResourceBuilder.() -> Unit,
): Notification {
val builder = NotificationResourceBuilder()
builder.name(name)
block(builder)
return builder.build()
}
/**
* @see [Notification].
* @param name The _unique_ name of the resulting resource.
*/
public fun notification(name: String): Notification {
val builder = NotificationResourceBuilder()
builder.name(name)
return builder.build()
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy