Class NotificationRule


  • public class NotificationRule
    extends com.pulumi.resources.CustomResource
    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.sns.TopicArgs;
     import com.pulumi.aws.iam.IamFunctions;
     import com.pulumi.aws.iam.inputs.GetPolicyDocumentArgs;
     import com.pulumi.aws.iam.inputs.GetPolicyDocumentStatementArgs;
     import com.pulumi.aws.iam.inputs.GetPolicyDocumentStatementPrincipalArgs;
     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.ArrayList;
     import java.util.Arrays;
     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", TopicArgs.builder()
                 .name("notification")
                 .build());
     
             final var notifAccess = IamFunctions.getPolicyDocument(GetPolicyDocumentArgs.builder()
                 .statements(GetPolicyDocumentStatementArgs.builder()
                     .principals(GetPolicyDocumentStatementPrincipalArgs.builder()
                         .type("Service")
                         .identifiers("codestar-notifications.amazonaws.com")
                         .build())
                     .actions("sns:Publish")
                     .resources(notif.arn())
                     .build())
                 .build());
     
             var default_ = new TopicPolicy("default", TopicPolicyArgs.builder()
                 .arn(notif.arn())
                 .policy(notifAccess.applyValue(_notifAccess -> _notifAccess.json()))
                 .build());
     
             var commits = new NotificationRule("commits", NotificationRuleArgs.builder()
                 .targets(NotificationRuleTargetArgs.builder()
                     .address(notif.arn())
                     .build())
                 .detailType("BASIC")
                 .eventTypeIds("codecommit-repository-comments-on-commits")
                 .name("example-code-repo-commits")
                 .resource(code.arn())
                 .build());
     
         }
     }
     
     
    ## Import ### Identity Schema #### Required - `arn` (String) ARN of the CodeStar notification rule. Using `pulumi import`, import CodeStar notification rule using the ARN. For example: ```sh $ pulumi import aws:codestarnotifications/notificationRule:NotificationRule foo arn:aws:codestar-notifications:us-west-1:0123456789:notificationrule/2cdc68a3-8f7c-4893-b6a5-45b362bd4f2b ```
    • Nested Class Summary

      • Nested classes/interfaces inherited from class com.pulumi.resources.CustomResource

        com.pulumi.resources.CustomResource.CustomResourceInternal
      • Nested classes/interfaces inherited from class com.pulumi.resources.Resource

        com.pulumi.resources.Resource.LazyField<T extends java.lang.Object>, com.pulumi.resources.Resource.LazyFields, com.pulumi.resources.Resource.ResourceInternal
    • Field Summary

      • Fields inherited from class com.pulumi.resources.Resource

        childResources, remote
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      com.pulumi.core.Output<java.lang.String> arn()  
      com.pulumi.core.Output<java.lang.String> detailType()  
      com.pulumi.core.Output<java.util.List<java.lang.String>> eventTypeIds()  
      static NotificationRule get​(java.lang.String name, com.pulumi.core.Output<java.lang.String> id, NotificationRuleState state, com.pulumi.resources.CustomResourceOptions options)
      Get an existing Host resource's state with the given name, ID, and optional extra properties used to qualify the lookup.
      com.pulumi.core.Output<java.lang.String> name()  
      com.pulumi.core.Output<java.lang.String> region()  
      com.pulumi.core.Output<java.lang.String> resource()  
      com.pulumi.core.Output<java.util.Optional<java.lang.String>> status()  
      com.pulumi.core.Output<java.util.Optional<java.util.Map<java.lang.String,​java.lang.String>>> tags()  
      com.pulumi.core.Output<java.util.Map<java.lang.String,​java.lang.String>> tagsAll()  
      com.pulumi.core.Output<java.util.Optional<java.util.List<NotificationRuleTarget>>> targets()  
      • Methods inherited from class com.pulumi.resources.CustomResource

        getId, id, idFuture
      • Methods inherited from class com.pulumi.resources.Resource

        getChildResources, getResourceName, getResourceType, getUrn, pulumiChildResources, pulumiResourceName, pulumiResourceType, urn
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • NotificationRule

        public NotificationRule​(java.lang.String name)
        Parameters:
        name - The _unique_ name of the resulting resource.
      • NotificationRule

        public NotificationRule​(java.lang.String name,
                                NotificationRuleArgs args)
        Parameters:
        name - The _unique_ name of the resulting resource.
        args - The arguments to use to populate this resource's properties.
      • NotificationRule

        public NotificationRule​(java.lang.String name,
                                NotificationRuleArgs args,
                                @Nullable
                                com.pulumi.resources.CustomResourceOptions options)
        Parameters:
        name - The _unique_ name of the resulting resource.
        args - The arguments to use to populate this resource's properties.
        options - A bag of options that control this resource's behavior.
    • Method Detail

      • arn

        public com.pulumi.core.Output<java.lang.String> arn()
        Returns:
        The codestar notification rule ARN.
      • detailType

        public com.pulumi.core.Output<java.lang.String> detailType()
        Returns:
        The level of detail to include in the notifications for this resource. Possible values are `BASIC` and `FULL`.
      • eventTypeIds

        public com.pulumi.core.Output<java.util.List<java.lang.String>> eventTypeIds()
        Returns:
        A list of event types associated with this notification rule. For list of allowed events see [here](https://docs.aws.amazon.com/codestar-notifications/latest/userguide/concepts.html#concepts-api).
      • name

        public com.pulumi.core.Output<java.lang.String> name()
        Returns:
        The name of notification rule.
      • region

        public com.pulumi.core.Output<java.lang.String> region()
        Returns:
        Region where this resource will be [managed](https://docs.aws.amazon.com/general/latest/gr/rande.html#regional-endpoints). Defaults to the Region set in the provider configuration.
      • resource

        public com.pulumi.core.Output<java.lang.String> resource()
        Returns:
        The ARN of the resource to associate with the notification rule.
      • status

        public com.pulumi.core.Output<java.util.Optional<java.lang.String>> status()
        Returns:
        The status of the notification rule. Possible values are `ENABLED` and `DISABLED`, default is `ENABLED`.
      • tags

        public com.pulumi.core.Output<java.util.Optional<java.util.Map<java.lang.String,​java.lang.String>>> tags()
        Returns:
        A map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
      • tagsAll

        public com.pulumi.core.Output<java.util.Map<java.lang.String,​java.lang.String>> tagsAll()
        Returns:
        A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
      • targets

        public com.pulumi.core.Output<java.util.Optional<java.util.List<NotificationRuleTarget>>> targets()
        Returns:
        Configuration blocks containing notification target information. Can be specified multiple times. At least one target must be specified on creation.
      • get

        public static NotificationRule get​(java.lang.String name,
                                           com.pulumi.core.Output<java.lang.String> id,
                                           @Nullable
                                           NotificationRuleState state,
                                           @Nullable
                                           com.pulumi.resources.CustomResourceOptions options)
        Get an existing Host resource's state with the given name, ID, and optional extra properties used to qualify the lookup.
        Parameters:
        name - The _unique_ name of the resulting resource.
        id - The _unique_ provider ID of the resource to lookup.
        state -
        options - Optional settings to control the behavior of the CustomResource.