github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/rds/clusterActivityStream.go (about)

     1  // Code generated by the Pulumi Terraform Bridge (tfgen) Tool DO NOT EDIT.
     2  // *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
     3  
     4  package rds
     5  
     6  import (
     7  	"context"
     8  	"reflect"
     9  
    10  	"errors"
    11  	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/internal"
    12  	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    13  )
    14  
    15  // Manages RDS Aurora Cluster Database Activity Streams.
    16  //
    17  // Database Activity Streams have some limits and requirements, refer to the [Monitoring Amazon Aurora using Database Activity Streams](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/DBActivityStreams.html) documentation for detailed limitations and requirements.
    18  //
    19  // > **Note:** This resource always calls the RDS [`StartActivityStream`][2] API with the `ApplyImmediately` parameter set to `true`. This is because the provider needs the activity stream to be started in order for it to get the associated attributes.
    20  //
    21  // > **Note:** This resource depends on having at least one `rds.ClusterInstance` created. To avoid race conditions when all resources are being created together, add an explicit resource reference using the resource `dependsOn` meta-argument.
    22  //
    23  // > **Note:** This resource is available in all regions except the following: `cn-north-1`, `cn-northwest-1`, `us-gov-east-1`, `us-gov-west-1`
    24  //
    25  // ## Example Usage
    26  //
    27  // <!--Start PulumiCodeChooser -->
    28  // ```go
    29  // package main
    30  //
    31  // import (
    32  //
    33  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/kms"
    34  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/rds"
    35  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    36  //
    37  // )
    38  //
    39  //	func main() {
    40  //		pulumi.Run(func(ctx *pulumi.Context) error {
    41  //			_, err := rds.NewCluster(ctx, "default", &rds.ClusterArgs{
    42  //				ClusterIdentifier: pulumi.String("aurora-cluster-demo"),
    43  //				AvailabilityZones: pulumi.StringArray{
    44  //					pulumi.String("us-west-2a"),
    45  //					pulumi.String("us-west-2b"),
    46  //					pulumi.String("us-west-2c"),
    47  //				},
    48  //				DatabaseName:   pulumi.String("mydb"),
    49  //				MasterUsername: pulumi.String("foo"),
    50  //				MasterPassword: pulumi.String("mustbeeightcharaters"),
    51  //				Engine:         pulumi.String(rds.EngineTypeAuroraPostgresql),
    52  //				EngineVersion:  pulumi.String("13.4"),
    53  //			})
    54  //			if err != nil {
    55  //				return err
    56  //			}
    57  //			defaultClusterInstance, err := rds.NewClusterInstance(ctx, "default", &rds.ClusterInstanceArgs{
    58  //				Identifier:        pulumi.String("aurora-instance-demo"),
    59  //				ClusterIdentifier: _default.ClusterIdentifier,
    60  //				Engine:            _default.Engine,
    61  //				InstanceClass:     pulumi.String(rds.InstanceType_R6G_Large),
    62  //			})
    63  //			if err != nil {
    64  //				return err
    65  //			}
    66  //			defaultKey, err := kms.NewKey(ctx, "default", &kms.KeyArgs{
    67  //				Description: pulumi.String("AWS KMS Key to encrypt Database Activity Stream"),
    68  //			})
    69  //			if err != nil {
    70  //				return err
    71  //			}
    72  //			_, err = rds.NewClusterActivityStream(ctx, "default", &rds.ClusterActivityStreamArgs{
    73  //				ResourceArn: _default.Arn,
    74  //				Mode:        pulumi.String("async"),
    75  //				KmsKeyId:    defaultKey.KeyId,
    76  //			}, pulumi.DependsOn([]pulumi.Resource{
    77  //				defaultClusterInstance,
    78  //			}))
    79  //			if err != nil {
    80  //				return err
    81  //			}
    82  //			return nil
    83  //		})
    84  //	}
    85  //
    86  // ```
    87  // <!--End PulumiCodeChooser -->
    88  //
    89  // ## Import
    90  //
    91  // Using `pulumi import`, import RDS Aurora Cluster Database Activity Streams using the `resource_arn`. For example:
    92  //
    93  // ```sh
    94  // $ pulumi import aws:rds/clusterActivityStream:ClusterActivityStream default arn:aws:rds:us-west-2:123456789012:cluster:aurora-cluster-demo
    95  // ```
    96  type ClusterActivityStream struct {
    97  	pulumi.CustomResourceState
    98  
    99  	// Specifies whether the database activity stream includes engine-native audit fields. This option only applies to an Oracle DB instance. By default, no engine-native audit fields are included. Defaults `false`.
   100  	EngineNativeAuditFieldsIncluded pulumi.BoolPtrOutput `pulumi:"engineNativeAuditFieldsIncluded"`
   101  	// The name of the Amazon Kinesis data stream to be used for the database activity stream.
   102  	KinesisStreamName pulumi.StringOutput `pulumi:"kinesisStreamName"`
   103  	// The AWS KMS key identifier for encrypting messages in the database activity stream. The AWS KMS key identifier is the key ARN, key ID, alias ARN, or alias name for the KMS key.
   104  	KmsKeyId pulumi.StringOutput `pulumi:"kmsKeyId"`
   105  	// Specifies the mode of the database activity stream. Database events such as a change or access generate an activity stream event. The database session can handle these events either synchronously or asynchronously. One of: `sync`, `async`.
   106  	Mode pulumi.StringOutput `pulumi:"mode"`
   107  	// The Amazon Resource Name (ARN) of the DB cluster.
   108  	ResourceArn pulumi.StringOutput `pulumi:"resourceArn"`
   109  }
   110  
   111  // NewClusterActivityStream registers a new resource with the given unique name, arguments, and options.
   112  func NewClusterActivityStream(ctx *pulumi.Context,
   113  	name string, args *ClusterActivityStreamArgs, opts ...pulumi.ResourceOption) (*ClusterActivityStream, error) {
   114  	if args == nil {
   115  		return nil, errors.New("missing one or more required arguments")
   116  	}
   117  
   118  	if args.KmsKeyId == nil {
   119  		return nil, errors.New("invalid value for required argument 'KmsKeyId'")
   120  	}
   121  	if args.Mode == nil {
   122  		return nil, errors.New("invalid value for required argument 'Mode'")
   123  	}
   124  	if args.ResourceArn == nil {
   125  		return nil, errors.New("invalid value for required argument 'ResourceArn'")
   126  	}
   127  	opts = internal.PkgResourceDefaultOpts(opts)
   128  	var resource ClusterActivityStream
   129  	err := ctx.RegisterResource("aws:rds/clusterActivityStream:ClusterActivityStream", name, args, &resource, opts...)
   130  	if err != nil {
   131  		return nil, err
   132  	}
   133  	return &resource, nil
   134  }
   135  
   136  // GetClusterActivityStream gets an existing ClusterActivityStream resource's state with the given name, ID, and optional
   137  // state properties that are used to uniquely qualify the lookup (nil if not required).
   138  func GetClusterActivityStream(ctx *pulumi.Context,
   139  	name string, id pulumi.IDInput, state *ClusterActivityStreamState, opts ...pulumi.ResourceOption) (*ClusterActivityStream, error) {
   140  	var resource ClusterActivityStream
   141  	err := ctx.ReadResource("aws:rds/clusterActivityStream:ClusterActivityStream", name, id, state, &resource, opts...)
   142  	if err != nil {
   143  		return nil, err
   144  	}
   145  	return &resource, nil
   146  }
   147  
   148  // Input properties used for looking up and filtering ClusterActivityStream resources.
   149  type clusterActivityStreamState struct {
   150  	// Specifies whether the database activity stream includes engine-native audit fields. This option only applies to an Oracle DB instance. By default, no engine-native audit fields are included. Defaults `false`.
   151  	EngineNativeAuditFieldsIncluded *bool `pulumi:"engineNativeAuditFieldsIncluded"`
   152  	// The name of the Amazon Kinesis data stream to be used for the database activity stream.
   153  	KinesisStreamName *string `pulumi:"kinesisStreamName"`
   154  	// The AWS KMS key identifier for encrypting messages in the database activity stream. The AWS KMS key identifier is the key ARN, key ID, alias ARN, or alias name for the KMS key.
   155  	KmsKeyId *string `pulumi:"kmsKeyId"`
   156  	// Specifies the mode of the database activity stream. Database events such as a change or access generate an activity stream event. The database session can handle these events either synchronously or asynchronously. One of: `sync`, `async`.
   157  	Mode *string `pulumi:"mode"`
   158  	// The Amazon Resource Name (ARN) of the DB cluster.
   159  	ResourceArn *string `pulumi:"resourceArn"`
   160  }
   161  
   162  type ClusterActivityStreamState struct {
   163  	// Specifies whether the database activity stream includes engine-native audit fields. This option only applies to an Oracle DB instance. By default, no engine-native audit fields are included. Defaults `false`.
   164  	EngineNativeAuditFieldsIncluded pulumi.BoolPtrInput
   165  	// The name of the Amazon Kinesis data stream to be used for the database activity stream.
   166  	KinesisStreamName pulumi.StringPtrInput
   167  	// The AWS KMS key identifier for encrypting messages in the database activity stream. The AWS KMS key identifier is the key ARN, key ID, alias ARN, or alias name for the KMS key.
   168  	KmsKeyId pulumi.StringPtrInput
   169  	// Specifies the mode of the database activity stream. Database events such as a change or access generate an activity stream event. The database session can handle these events either synchronously or asynchronously. One of: `sync`, `async`.
   170  	Mode pulumi.StringPtrInput
   171  	// The Amazon Resource Name (ARN) of the DB cluster.
   172  	ResourceArn pulumi.StringPtrInput
   173  }
   174  
   175  func (ClusterActivityStreamState) ElementType() reflect.Type {
   176  	return reflect.TypeOf((*clusterActivityStreamState)(nil)).Elem()
   177  }
   178  
   179  type clusterActivityStreamArgs struct {
   180  	// Specifies whether the database activity stream includes engine-native audit fields. This option only applies to an Oracle DB instance. By default, no engine-native audit fields are included. Defaults `false`.
   181  	EngineNativeAuditFieldsIncluded *bool `pulumi:"engineNativeAuditFieldsIncluded"`
   182  	// The AWS KMS key identifier for encrypting messages in the database activity stream. The AWS KMS key identifier is the key ARN, key ID, alias ARN, or alias name for the KMS key.
   183  	KmsKeyId string `pulumi:"kmsKeyId"`
   184  	// Specifies the mode of the database activity stream. Database events such as a change or access generate an activity stream event. The database session can handle these events either synchronously or asynchronously. One of: `sync`, `async`.
   185  	Mode string `pulumi:"mode"`
   186  	// The Amazon Resource Name (ARN) of the DB cluster.
   187  	ResourceArn string `pulumi:"resourceArn"`
   188  }
   189  
   190  // The set of arguments for constructing a ClusterActivityStream resource.
   191  type ClusterActivityStreamArgs struct {
   192  	// Specifies whether the database activity stream includes engine-native audit fields. This option only applies to an Oracle DB instance. By default, no engine-native audit fields are included. Defaults `false`.
   193  	EngineNativeAuditFieldsIncluded pulumi.BoolPtrInput
   194  	// The AWS KMS key identifier for encrypting messages in the database activity stream. The AWS KMS key identifier is the key ARN, key ID, alias ARN, or alias name for the KMS key.
   195  	KmsKeyId pulumi.StringInput
   196  	// Specifies the mode of the database activity stream. Database events such as a change or access generate an activity stream event. The database session can handle these events either synchronously or asynchronously. One of: `sync`, `async`.
   197  	Mode pulumi.StringInput
   198  	// The Amazon Resource Name (ARN) of the DB cluster.
   199  	ResourceArn pulumi.StringInput
   200  }
   201  
   202  func (ClusterActivityStreamArgs) ElementType() reflect.Type {
   203  	return reflect.TypeOf((*clusterActivityStreamArgs)(nil)).Elem()
   204  }
   205  
   206  type ClusterActivityStreamInput interface {
   207  	pulumi.Input
   208  
   209  	ToClusterActivityStreamOutput() ClusterActivityStreamOutput
   210  	ToClusterActivityStreamOutputWithContext(ctx context.Context) ClusterActivityStreamOutput
   211  }
   212  
   213  func (*ClusterActivityStream) ElementType() reflect.Type {
   214  	return reflect.TypeOf((**ClusterActivityStream)(nil)).Elem()
   215  }
   216  
   217  func (i *ClusterActivityStream) ToClusterActivityStreamOutput() ClusterActivityStreamOutput {
   218  	return i.ToClusterActivityStreamOutputWithContext(context.Background())
   219  }
   220  
   221  func (i *ClusterActivityStream) ToClusterActivityStreamOutputWithContext(ctx context.Context) ClusterActivityStreamOutput {
   222  	return pulumi.ToOutputWithContext(ctx, i).(ClusterActivityStreamOutput)
   223  }
   224  
   225  // ClusterActivityStreamArrayInput is an input type that accepts ClusterActivityStreamArray and ClusterActivityStreamArrayOutput values.
   226  // You can construct a concrete instance of `ClusterActivityStreamArrayInput` via:
   227  //
   228  //	ClusterActivityStreamArray{ ClusterActivityStreamArgs{...} }
   229  type ClusterActivityStreamArrayInput interface {
   230  	pulumi.Input
   231  
   232  	ToClusterActivityStreamArrayOutput() ClusterActivityStreamArrayOutput
   233  	ToClusterActivityStreamArrayOutputWithContext(context.Context) ClusterActivityStreamArrayOutput
   234  }
   235  
   236  type ClusterActivityStreamArray []ClusterActivityStreamInput
   237  
   238  func (ClusterActivityStreamArray) ElementType() reflect.Type {
   239  	return reflect.TypeOf((*[]*ClusterActivityStream)(nil)).Elem()
   240  }
   241  
   242  func (i ClusterActivityStreamArray) ToClusterActivityStreamArrayOutput() ClusterActivityStreamArrayOutput {
   243  	return i.ToClusterActivityStreamArrayOutputWithContext(context.Background())
   244  }
   245  
   246  func (i ClusterActivityStreamArray) ToClusterActivityStreamArrayOutputWithContext(ctx context.Context) ClusterActivityStreamArrayOutput {
   247  	return pulumi.ToOutputWithContext(ctx, i).(ClusterActivityStreamArrayOutput)
   248  }
   249  
   250  // ClusterActivityStreamMapInput is an input type that accepts ClusterActivityStreamMap and ClusterActivityStreamMapOutput values.
   251  // You can construct a concrete instance of `ClusterActivityStreamMapInput` via:
   252  //
   253  //	ClusterActivityStreamMap{ "key": ClusterActivityStreamArgs{...} }
   254  type ClusterActivityStreamMapInput interface {
   255  	pulumi.Input
   256  
   257  	ToClusterActivityStreamMapOutput() ClusterActivityStreamMapOutput
   258  	ToClusterActivityStreamMapOutputWithContext(context.Context) ClusterActivityStreamMapOutput
   259  }
   260  
   261  type ClusterActivityStreamMap map[string]ClusterActivityStreamInput
   262  
   263  func (ClusterActivityStreamMap) ElementType() reflect.Type {
   264  	return reflect.TypeOf((*map[string]*ClusterActivityStream)(nil)).Elem()
   265  }
   266  
   267  func (i ClusterActivityStreamMap) ToClusterActivityStreamMapOutput() ClusterActivityStreamMapOutput {
   268  	return i.ToClusterActivityStreamMapOutputWithContext(context.Background())
   269  }
   270  
   271  func (i ClusterActivityStreamMap) ToClusterActivityStreamMapOutputWithContext(ctx context.Context) ClusterActivityStreamMapOutput {
   272  	return pulumi.ToOutputWithContext(ctx, i).(ClusterActivityStreamMapOutput)
   273  }
   274  
   275  type ClusterActivityStreamOutput struct{ *pulumi.OutputState }
   276  
   277  func (ClusterActivityStreamOutput) ElementType() reflect.Type {
   278  	return reflect.TypeOf((**ClusterActivityStream)(nil)).Elem()
   279  }
   280  
   281  func (o ClusterActivityStreamOutput) ToClusterActivityStreamOutput() ClusterActivityStreamOutput {
   282  	return o
   283  }
   284  
   285  func (o ClusterActivityStreamOutput) ToClusterActivityStreamOutputWithContext(ctx context.Context) ClusterActivityStreamOutput {
   286  	return o
   287  }
   288  
   289  // Specifies whether the database activity stream includes engine-native audit fields. This option only applies to an Oracle DB instance. By default, no engine-native audit fields are included. Defaults `false`.
   290  func (o ClusterActivityStreamOutput) EngineNativeAuditFieldsIncluded() pulumi.BoolPtrOutput {
   291  	return o.ApplyT(func(v *ClusterActivityStream) pulumi.BoolPtrOutput { return v.EngineNativeAuditFieldsIncluded }).(pulumi.BoolPtrOutput)
   292  }
   293  
   294  // The name of the Amazon Kinesis data stream to be used for the database activity stream.
   295  func (o ClusterActivityStreamOutput) KinesisStreamName() pulumi.StringOutput {
   296  	return o.ApplyT(func(v *ClusterActivityStream) pulumi.StringOutput { return v.KinesisStreamName }).(pulumi.StringOutput)
   297  }
   298  
   299  // The AWS KMS key identifier for encrypting messages in the database activity stream. The AWS KMS key identifier is the key ARN, key ID, alias ARN, or alias name for the KMS key.
   300  func (o ClusterActivityStreamOutput) KmsKeyId() pulumi.StringOutput {
   301  	return o.ApplyT(func(v *ClusterActivityStream) pulumi.StringOutput { return v.KmsKeyId }).(pulumi.StringOutput)
   302  }
   303  
   304  // Specifies the mode of the database activity stream. Database events such as a change or access generate an activity stream event. The database session can handle these events either synchronously or asynchronously. One of: `sync`, `async`.
   305  func (o ClusterActivityStreamOutput) Mode() pulumi.StringOutput {
   306  	return o.ApplyT(func(v *ClusterActivityStream) pulumi.StringOutput { return v.Mode }).(pulumi.StringOutput)
   307  }
   308  
   309  // The Amazon Resource Name (ARN) of the DB cluster.
   310  func (o ClusterActivityStreamOutput) ResourceArn() pulumi.StringOutput {
   311  	return o.ApplyT(func(v *ClusterActivityStream) pulumi.StringOutput { return v.ResourceArn }).(pulumi.StringOutput)
   312  }
   313  
   314  type ClusterActivityStreamArrayOutput struct{ *pulumi.OutputState }
   315  
   316  func (ClusterActivityStreamArrayOutput) ElementType() reflect.Type {
   317  	return reflect.TypeOf((*[]*ClusterActivityStream)(nil)).Elem()
   318  }
   319  
   320  func (o ClusterActivityStreamArrayOutput) ToClusterActivityStreamArrayOutput() ClusterActivityStreamArrayOutput {
   321  	return o
   322  }
   323  
   324  func (o ClusterActivityStreamArrayOutput) ToClusterActivityStreamArrayOutputWithContext(ctx context.Context) ClusterActivityStreamArrayOutput {
   325  	return o
   326  }
   327  
   328  func (o ClusterActivityStreamArrayOutput) Index(i pulumi.IntInput) ClusterActivityStreamOutput {
   329  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *ClusterActivityStream {
   330  		return vs[0].([]*ClusterActivityStream)[vs[1].(int)]
   331  	}).(ClusterActivityStreamOutput)
   332  }
   333  
   334  type ClusterActivityStreamMapOutput struct{ *pulumi.OutputState }
   335  
   336  func (ClusterActivityStreamMapOutput) ElementType() reflect.Type {
   337  	return reflect.TypeOf((*map[string]*ClusterActivityStream)(nil)).Elem()
   338  }
   339  
   340  func (o ClusterActivityStreamMapOutput) ToClusterActivityStreamMapOutput() ClusterActivityStreamMapOutput {
   341  	return o
   342  }
   343  
   344  func (o ClusterActivityStreamMapOutput) ToClusterActivityStreamMapOutputWithContext(ctx context.Context) ClusterActivityStreamMapOutput {
   345  	return o
   346  }
   347  
   348  func (o ClusterActivityStreamMapOutput) MapIndex(k pulumi.StringInput) ClusterActivityStreamOutput {
   349  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *ClusterActivityStream {
   350  		return vs[0].(map[string]*ClusterActivityStream)[vs[1].(string)]
   351  	}).(ClusterActivityStreamOutput)
   352  }
   353  
   354  func init() {
   355  	pulumi.RegisterInputType(reflect.TypeOf((*ClusterActivityStreamInput)(nil)).Elem(), &ClusterActivityStream{})
   356  	pulumi.RegisterInputType(reflect.TypeOf((*ClusterActivityStreamArrayInput)(nil)).Elem(), ClusterActivityStreamArray{})
   357  	pulumi.RegisterInputType(reflect.TypeOf((*ClusterActivityStreamMapInput)(nil)).Elem(), ClusterActivityStreamMap{})
   358  	pulumi.RegisterOutputType(ClusterActivityStreamOutput{})
   359  	pulumi.RegisterOutputType(ClusterActivityStreamArrayOutput{})
   360  	pulumi.RegisterOutputType(ClusterActivityStreamMapOutput{})
   361  }