EventSubscription class
Provides a DocumentDB event subscription resource.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const example = new aws.docdb.Cluster("example", {
clusterIdentifier: "example",
availabilityZones: [
available.names[0],
available.names[1],
available.names[2],
],
masterUsername: "foo",
masterPassword: "mustbeeightcharaters",
skipFinalSnapshot: true,
});
const exampleTopic = new aws.sns.Topic("example", {name: "example-events"});
const exampleEventSubscription = new aws.docdb.EventSubscription("example", {
name: "example",
enabled: true,
eventCategories: [
"creation",
"failure",
],
sourceType: "db-cluster",
sourceIds: [example.id],
snsTopicArn: exampleTopic.arn,
});
import pulumi
import pulumi_aws as aws
example = aws.docdb.Cluster("example",
cluster_identifier="example",
availability_zones=[
available["names"][0],
available["names"][1],
available["names"][2],
],
master_username="foo",
master_password="mustbeeightcharaters",
skip_final_snapshot=True)
example_topic = aws.sns.Topic("example", name="example-events")
example_event_subscription = aws.docdb.EventSubscription("example",
name="example",
enabled=True,
event_categories=[
"creation",
"failure",
],
source_type="db-cluster",
source_ids=[example.id],
sns_topic_arn=example_topic.arn)
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var example = new Aws.DocDB.Cluster("example", new()
{
ClusterIdentifier = "example",
AvailabilityZones = new[]
{
available.Names[0],
available.Names[1],
available.Names[2],
},
MasterUsername = "foo",
MasterPassword = "mustbeeightcharaters",
SkipFinalSnapshot = true,
});
var exampleTopic = new Aws.Sns.Topic("example", new()
{
Name = "example-events",
});
var exampleEventSubscription = new Aws.DocDB.EventSubscription("example", new()
{
Name = "example",
Enabled = true,
EventCategories = new[]
{
"creation",
"failure",
},
SourceType = "db-cluster",
SourceIds = new[]
{
example.Id,
},
SnsTopicArn = exampleTopic.Arn,
});
});
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/docdb"
"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/sns"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
example, err := docdb.NewCluster(ctx, "example", &docdb.ClusterArgs{
ClusterIdentifier: pulumi.String("example"),
AvailabilityZones: pulumi.StringArray{
available.Names[0],
available.Names[1],
available.Names[2],
},
MasterUsername: pulumi.String("foo"),
MasterPassword: pulumi.String("mustbeeightcharaters"),
SkipFinalSnapshot: pulumi.Bool(true),
})
if err != nil {
return err
}
exampleTopic, err := sns.NewTopic(ctx, "example", &sns.TopicArgs{
Name: pulumi.String("example-events"),
})
if err != nil {
return err
}
_, err = docdb.NewEventSubscription(ctx, "example", &docdb.EventSubscriptionArgs{
Name: pulumi.String("example"),
Enabled: pulumi.Bool(true),
EventCategories: pulumi.StringArray{
pulumi.String("creation"),
pulumi.String("failure"),
},
SourceType: pulumi.String("db-cluster"),
SourceIds: pulumi.StringArray{
example.ID().ToIDOutput().ToStringOutput(),
},
SnsTopicArn: exampleTopic.Arn,
})
if err != nil {
return err
}
return nil
})
}
pulumi {
required_providers {
aws = {
source = "pulumi/aws"
}
}
}
resource "aws_docdb_cluster" "example" {
cluster_identifier = "example"
availability_zones = [available.names[0], available.names[1], available.names[2]]
master_username = "foo"
master_password = "mustbeeightcharaters"
skip_final_snapshot = true
}
resource "aws_sns_topic" "example" {
name = "example-events"
}
resource "aws_docdb_eventsubscription" "example" {
name = "example"
enabled = true
event_categories = ["creation", "failure"]
source_type = "db-cluster"
source_ids = [aws_docdb_cluster.example.id]
sns_topic_arn = aws_sns_topic.example.arn
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.docdb.Cluster;
import com.pulumi.aws.docdb.ClusterArgs;
import com.pulumi.aws.sns.Topic;
import com.pulumi.aws.sns.TopicArgs;
import com.pulumi.aws.docdb.EventSubscription;
import com.pulumi.aws.docdb.EventSubscriptionArgs;
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 example = new Cluster("example", ClusterArgs.builder()
.clusterIdentifier("example")
.availabilityZones(
available.names()[0],
available.names()[1],
available.names()[2])
.masterUsername("foo")
.masterPassword("mustbeeightcharaters")
.skipFinalSnapshot(true)
.build());
var exampleTopic = new Topic("exampleTopic", TopicArgs.builder()
.name("example-events")
.build());
var exampleEventSubscription = new EventSubscription("exampleEventSubscription", EventSubscriptionArgs.builder()
.name("example")
.enabled(true)
.eventCategories(
"creation",
"failure")
.sourceType("db-cluster")
.sourceIds(example.id())
.snsTopicArn(exampleTopic.arn())
.build());
}
}
resources:
example:
type: aws:docdb:Cluster
properties:
clusterIdentifier: example
availabilityZones:
- ${available.names[0]}
- ${available.names[1]}
- ${available.names[2]}
masterUsername: foo
masterPassword: mustbeeightcharaters
skipFinalSnapshot: true
exampleTopic:
type: aws:sns:Topic
name: example
properties:
name: example-events
exampleEventSubscription:
type: aws:docdb:EventSubscription
name: example
properties:
name: example
enabled: true
eventCategories:
- creation
- failure
sourceType: db-cluster
sourceIds:
- ${example.id}
snsTopicArn: ${exampleTopic.arn}
Import
Using pulumi import, import DocumentDB Event Subscriptions using the name. For example:
$ pulumi import aws:docdb/eventSubscription:EventSubscription example event-sub
Constructors
- EventSubscription(String name, {EventSubscriptionArgs? args, CustomResourceOptions? options})
-
Creates a new EventSubscription.
nameThe Pulumi resource name.argsArguments used to configure this EventSubscription. The set of arguments for EventSubscription.optionsResource options controlling this resource's behavior. - EventSubscription.reference(String urn)
- Creates a typed reference to an existing EventSubscription resource.
Properties
-
arn
↔ Output<
String> -
ARN of the DocumentDB event notification subscription
latefinal
-
childResources
→ Set<
Resource> -
finalinherited
-
completionSources
↔ Map<
String, IOutputCompletionSource> -
latefinalinherited
-
customerAwsId
↔ Output<
String> -
The AWS customer account associated with the DocumentDB event notification subscription
latefinal
-
enabled
↔ Output<
bool?> -
A boolean flag to enable/disable the subscription. Defaults to true.
latefinal
-
eventCategories
↔ Output<
List< String> ?> -
A list of event categories for a SourceType that you want to subscribe to. See https://docs.aws.amazon.com/documentdb/latest/developerguide/API_Event.html or run
aws docdb describe-event-categories.latefinal - hashCode → int
-
The hash code for this object.
no setterinherited
-
id
↔ Output<
String> -
getter/setter pairinherited
- isCustom → bool
-
Returns whether this resource is provider-managed.
no setterinherited
- isProtected → bool
-
Returns whether this resource is protected from deletion.
no setterinherited
- isRemote → bool
-
Whether this resource is registered as remote.
no setterinherited
- isResourceReference → bool
-
Whether this instance represents a resource value returned over RPC.
finalinherited
-
name
↔ Output<
String> -
The name of the DocumentDB event subscription. By default generated by this provider.
latefinal
-
namePrefix
↔ Output<
String> -
The name of the DocumentDB event subscription. Conflicts with
name.latefinal -
region
↔ Output<
String> -
Region where this resource will be managed. Defaults to the Region set in the provider configuration.
latefinal
-
resourceTransforms
→ List<
ResourceTransform> -
Inherited/explicit async transforms.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
snsTopicArn
↔ Output<
String> -
latefinal
-
sourceIds
↔ Output<
List< String> ?> -
A list of identifiers of the event sources for which events will be returned. If not specified, then all sources are included in the response. If specified, a sourceType must also be specified.
latefinal
-
sourceType
↔ Output<
String?> -
The type of source that will be generating the events. Valid options are
db-instance,db-cluster,db-parameter-group,db-security-group,db-cluster-snapshot. If not set, all sources will be subscribed to.latefinal -
A map of tags to assign to the resource. If configured with a provider
defaultTagsconfiguration block present, tags with matching keys will overwrite those defined at the provider-level.latefinal -
A map of tags assigned to the resource, including those inherited from the provider
defaultTagsconfiguration block.latefinal -
transformations
→ List<
ResourceTransformation> -
Inherited/explicit legacy transformations.
no setterinherited
-
urn
↔ Output<
String> -
latefinalinherited
Methods
-
failId(
Object error) → void -
Completes this resource ID with an error when registration fails.
inherited
-
failOutputs(
Object error) → void -
Completes all output properties with
error.inherited -
failUrn(
Object error) → void -
Completes this resource URN with an error when registration fails.
inherited
-
getProvider(
String moduleMember) → ProviderResource? -
Returns provider for
moduleMember's package, if configured.inherited -
getResourceName(
) → String -
Returns this resource's logical name.
inherited
-
getResourceType(
) → String -
Returns this resource's Pulumi type token.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
registerOutput<
T> (String propertyName, {Object? decoder(Object?)?, bool isSecret = false}) → Output< T> -
Registers a dynamic output property for this resource.
inherited
-
resolveId(
String? value, {required bool isKnown}) → void -
Resolves the provider-assigned ID for this resource.
inherited
-
resolveOutputs(
Struct outputs) → void -
Resolves all output properties from a monitor response payload.
inherited
-
resolveUrn(
String value) → void -
Resolves this resource's URN once assigned by the engine.
inherited
-
serializeProperties(
Map< String, dynamic> properties) → Future<Struct> -
Serializes resource properties for RPC transmission.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
get(
String name, Input< String> id, {EventSubscriptionState? state, CustomResourceOptions? options}) → EventSubscription -
Gets an existing EventSubscription resource's state with the given
nameandid.