NotificationRuleArgs

data class NotificationRuleArgs(val detailType: Output<String>? = null, val eventTypeIds: Output<List<String>>? = null, val name: Output<String>? = null, val resource: Output<String>? = null, val status: Output<String>? = null, val tags: Output<Map<String, String>>? = null, val targets: Output<List<NotificationRuleTargetArgs>>? = null) : ConvertibleToJava<NotificationRuleArgs>

Provides a CodeStar Notifications Rule.

Example Usage

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.codecommit.Repository;
import com.pulumi.aws.codecommit.RepositoryArgs;
import com.pulumi.aws.sns.Topic;
import com.pulumi.aws.iam.IamFunctions;
import com.pulumi.aws.iam.inputs.GetPolicyDocumentArgs;
import com.pulumi.aws.sns.TopicPolicy;
import com.pulumi.aws.sns.TopicPolicyArgs;
import com.pulumi.aws.codestarnotifications.NotificationRule;
import com.pulumi.aws.codestarnotifications.NotificationRuleArgs;
import com.pulumi.aws.codestarnotifications.inputs.NotificationRuleTargetArgs;
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 code = new Repository("code", RepositoryArgs.builder()
.repositoryName("example-code-repo")
.build());
var notif = new Topic("notif");
final var notifAccess = IamFunctions.getPolicyDocument(GetPolicyDocumentArgs.builder()
.statements(GetPolicyDocumentStatementArgs.builder()
.actions("sns:Publish")
.principals(GetPolicyDocumentStatementPrincipalArgs.builder()
.type("Service")
.identifiers("codestar-notifications.amazonaws.com")
.build())
.resources(notif.arn())
.build())
.build());
var default_ = new TopicPolicy("default", TopicPolicyArgs.builder()
.arn(notif.arn())
.policy(notifAccess.applyValue(getPolicyDocumentResult -> getPolicyDocumentResult).applyValue(notifAccess -> notifAccess.applyValue(getPolicyDocumentResult -> getPolicyDocumentResult.json())))
.build());
var commits = new NotificationRule("commits", NotificationRuleArgs.builder()
.detailType("BASIC")
.eventTypeIds("codecommit-repository-comments-on-commits")
.resource(code.arn())
.targets(NotificationRuleTargetArgs.builder()
.address(notif.arn())
.build())
.build());
}
}

Import

CodeStar notification rule can be imported using the ARN, e.g.,

$ pulumi import aws:codestarnotifications/notificationRule:NotificationRule foo arn:aws:codestar-notifications:us-west-1:0123456789:notificationrule/2cdc68a3-8f7c-4893-b6a5-45b362bd4f2b

Constructors

Link copied to clipboard
constructor(detailType: Output<String>? = null, eventTypeIds: Output<List<String>>? = null, name: Output<String>? = null, resource: Output<String>? = null, status: Output<String>? = null, tags: Output<Map<String, String>>? = null, targets: Output<List<NotificationRuleTargetArgs>>? = null)

Properties

Link copied to clipboard
val detailType: Output<String>? = null

The level of detail to include in the notifications for this resource. Possible values are BASIC and FULL.

Link copied to clipboard
val eventTypeIds: Output<List<String>>? = null

A list of event types associated with this notification rule. For list of allowed events see here.

Link copied to clipboard
val name: Output<String>? = null

The name of notification rule.

Link copied to clipboard
val resource: Output<String>? = null

The ARN of the resource to associate with the notification rule.

Link copied to clipboard
val status: Output<String>? = null

The status of the notification rule. Possible values are ENABLED and DISABLED, default is ENABLED.

Link copied to clipboard
val tags: Output<Map<String, String>>? = null

A map of tags to assign to the resource. .If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

Link copied to clipboard

Configuration blocks containing notification target information. Can be specified multiple times. At least one target must be specified on creation.

Functions

Link copied to clipboard
open override fun toJava(): NotificationRuleArgs