github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/redshift/logging.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 redshift
     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  // Resource for managing an AWS Redshift Logging configuration.
    16  //
    17  // ## Example Usage
    18  //
    19  // ### Basic Usage
    20  //
    21  // <!--Start PulumiCodeChooser -->
    22  // ```go
    23  // package main
    24  //
    25  // import (
    26  //
    27  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/redshift"
    28  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    29  //
    30  // )
    31  //
    32  //	func main() {
    33  //		pulumi.Run(func(ctx *pulumi.Context) error {
    34  //			_, err := redshift.NewLogging(ctx, "example", &redshift.LoggingArgs{
    35  //				ClusterIdentifier:  pulumi.Any(exampleAwsRedshiftCluster.Id),
    36  //				LogDestinationType: pulumi.String("cloudwatch"),
    37  //				LogExports: pulumi.StringArray{
    38  //					pulumi.String("connectionlog"),
    39  //					pulumi.String("userlog"),
    40  //				},
    41  //			})
    42  //			if err != nil {
    43  //				return err
    44  //			}
    45  //			return nil
    46  //		})
    47  //	}
    48  //
    49  // ```
    50  // <!--End PulumiCodeChooser -->
    51  //
    52  // ### S3 Destination Type
    53  //
    54  // <!--Start PulumiCodeChooser -->
    55  // ```go
    56  // package main
    57  //
    58  // import (
    59  //
    60  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/redshift"
    61  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    62  //
    63  // )
    64  //
    65  //	func main() {
    66  //		pulumi.Run(func(ctx *pulumi.Context) error {
    67  //			_, err := redshift.NewLogging(ctx, "example", &redshift.LoggingArgs{
    68  //				ClusterIdentifier:  pulumi.Any(exampleAwsRedshiftCluster.Id),
    69  //				LogDestinationType: pulumi.String("s3"),
    70  //				BucketName:         pulumi.Any(exampleAwsS3Bucket.Id),
    71  //				S3KeyPrefix:        pulumi.String("example-prefix/"),
    72  //			})
    73  //			if err != nil {
    74  //				return err
    75  //			}
    76  //			return nil
    77  //		})
    78  //	}
    79  //
    80  // ```
    81  // <!--End PulumiCodeChooser -->
    82  //
    83  // ## Import
    84  //
    85  // Using `pulumi import`, import Redshift Logging using the `id`. For example:
    86  //
    87  // ```sh
    88  // $ pulumi import aws:redshift/logging:Logging example cluster-id-12345678
    89  // ```
    90  type Logging struct {
    91  	pulumi.CustomResourceState
    92  
    93  	// Name of an existing S3 bucket where the log files are to be stored. Required when `logDestinationType` is `s3`. Must be in the same region as the cluster and the cluster must have read bucket and put object permissions. For more information on the permissions required for the bucket, please read the AWS [documentation](http://docs.aws.amazon.com/redshift/latest/mgmt/db-auditing.html#db-auditing-enable-logging)
    94  	BucketName pulumi.StringPtrOutput `pulumi:"bucketName"`
    95  	// Identifier of the source cluster.
    96  	//
    97  	// The following arguments are optional:
    98  	ClusterIdentifier pulumi.StringOutput `pulumi:"clusterIdentifier"`
    99  	// Log destination type. Valid values are `s3` and `cloudwatch`.
   100  	LogDestinationType pulumi.StringPtrOutput `pulumi:"logDestinationType"`
   101  	// Collection of exported log types. Required when `logDestinationType` is `cloudwatch`. Valid values are `connectionlog`, `useractivitylog`, and `userlog`.
   102  	LogExports pulumi.StringArrayOutput `pulumi:"logExports"`
   103  	// Prefix applied to the log file names.
   104  	S3KeyPrefix pulumi.StringPtrOutput `pulumi:"s3KeyPrefix"`
   105  }
   106  
   107  // NewLogging registers a new resource with the given unique name, arguments, and options.
   108  func NewLogging(ctx *pulumi.Context,
   109  	name string, args *LoggingArgs, opts ...pulumi.ResourceOption) (*Logging, error) {
   110  	if args == nil {
   111  		return nil, errors.New("missing one or more required arguments")
   112  	}
   113  
   114  	if args.ClusterIdentifier == nil {
   115  		return nil, errors.New("invalid value for required argument 'ClusterIdentifier'")
   116  	}
   117  	opts = internal.PkgResourceDefaultOpts(opts)
   118  	var resource Logging
   119  	err := ctx.RegisterResource("aws:redshift/logging:Logging", name, args, &resource, opts...)
   120  	if err != nil {
   121  		return nil, err
   122  	}
   123  	return &resource, nil
   124  }
   125  
   126  // GetLogging gets an existing Logging resource's state with the given name, ID, and optional
   127  // state properties that are used to uniquely qualify the lookup (nil if not required).
   128  func GetLogging(ctx *pulumi.Context,
   129  	name string, id pulumi.IDInput, state *LoggingState, opts ...pulumi.ResourceOption) (*Logging, error) {
   130  	var resource Logging
   131  	err := ctx.ReadResource("aws:redshift/logging:Logging", name, id, state, &resource, opts...)
   132  	if err != nil {
   133  		return nil, err
   134  	}
   135  	return &resource, nil
   136  }
   137  
   138  // Input properties used for looking up and filtering Logging resources.
   139  type loggingState struct {
   140  	// Name of an existing S3 bucket where the log files are to be stored. Required when `logDestinationType` is `s3`. Must be in the same region as the cluster and the cluster must have read bucket and put object permissions. For more information on the permissions required for the bucket, please read the AWS [documentation](http://docs.aws.amazon.com/redshift/latest/mgmt/db-auditing.html#db-auditing-enable-logging)
   141  	BucketName *string `pulumi:"bucketName"`
   142  	// Identifier of the source cluster.
   143  	//
   144  	// The following arguments are optional:
   145  	ClusterIdentifier *string `pulumi:"clusterIdentifier"`
   146  	// Log destination type. Valid values are `s3` and `cloudwatch`.
   147  	LogDestinationType *string `pulumi:"logDestinationType"`
   148  	// Collection of exported log types. Required when `logDestinationType` is `cloudwatch`. Valid values are `connectionlog`, `useractivitylog`, and `userlog`.
   149  	LogExports []string `pulumi:"logExports"`
   150  	// Prefix applied to the log file names.
   151  	S3KeyPrefix *string `pulumi:"s3KeyPrefix"`
   152  }
   153  
   154  type LoggingState struct {
   155  	// Name of an existing S3 bucket where the log files are to be stored. Required when `logDestinationType` is `s3`. Must be in the same region as the cluster and the cluster must have read bucket and put object permissions. For more information on the permissions required for the bucket, please read the AWS [documentation](http://docs.aws.amazon.com/redshift/latest/mgmt/db-auditing.html#db-auditing-enable-logging)
   156  	BucketName pulumi.StringPtrInput
   157  	// Identifier of the source cluster.
   158  	//
   159  	// The following arguments are optional:
   160  	ClusterIdentifier pulumi.StringPtrInput
   161  	// Log destination type. Valid values are `s3` and `cloudwatch`.
   162  	LogDestinationType pulumi.StringPtrInput
   163  	// Collection of exported log types. Required when `logDestinationType` is `cloudwatch`. Valid values are `connectionlog`, `useractivitylog`, and `userlog`.
   164  	LogExports pulumi.StringArrayInput
   165  	// Prefix applied to the log file names.
   166  	S3KeyPrefix pulumi.StringPtrInput
   167  }
   168  
   169  func (LoggingState) ElementType() reflect.Type {
   170  	return reflect.TypeOf((*loggingState)(nil)).Elem()
   171  }
   172  
   173  type loggingArgs struct {
   174  	// Name of an existing S3 bucket where the log files are to be stored. Required when `logDestinationType` is `s3`. Must be in the same region as the cluster and the cluster must have read bucket and put object permissions. For more information on the permissions required for the bucket, please read the AWS [documentation](http://docs.aws.amazon.com/redshift/latest/mgmt/db-auditing.html#db-auditing-enable-logging)
   175  	BucketName *string `pulumi:"bucketName"`
   176  	// Identifier of the source cluster.
   177  	//
   178  	// The following arguments are optional:
   179  	ClusterIdentifier string `pulumi:"clusterIdentifier"`
   180  	// Log destination type. Valid values are `s3` and `cloudwatch`.
   181  	LogDestinationType *string `pulumi:"logDestinationType"`
   182  	// Collection of exported log types. Required when `logDestinationType` is `cloudwatch`. Valid values are `connectionlog`, `useractivitylog`, and `userlog`.
   183  	LogExports []string `pulumi:"logExports"`
   184  	// Prefix applied to the log file names.
   185  	S3KeyPrefix *string `pulumi:"s3KeyPrefix"`
   186  }
   187  
   188  // The set of arguments for constructing a Logging resource.
   189  type LoggingArgs struct {
   190  	// Name of an existing S3 bucket where the log files are to be stored. Required when `logDestinationType` is `s3`. Must be in the same region as the cluster and the cluster must have read bucket and put object permissions. For more information on the permissions required for the bucket, please read the AWS [documentation](http://docs.aws.amazon.com/redshift/latest/mgmt/db-auditing.html#db-auditing-enable-logging)
   191  	BucketName pulumi.StringPtrInput
   192  	// Identifier of the source cluster.
   193  	//
   194  	// The following arguments are optional:
   195  	ClusterIdentifier pulumi.StringInput
   196  	// Log destination type. Valid values are `s3` and `cloudwatch`.
   197  	LogDestinationType pulumi.StringPtrInput
   198  	// Collection of exported log types. Required when `logDestinationType` is `cloudwatch`. Valid values are `connectionlog`, `useractivitylog`, and `userlog`.
   199  	LogExports pulumi.StringArrayInput
   200  	// Prefix applied to the log file names.
   201  	S3KeyPrefix pulumi.StringPtrInput
   202  }
   203  
   204  func (LoggingArgs) ElementType() reflect.Type {
   205  	return reflect.TypeOf((*loggingArgs)(nil)).Elem()
   206  }
   207  
   208  type LoggingInput interface {
   209  	pulumi.Input
   210  
   211  	ToLoggingOutput() LoggingOutput
   212  	ToLoggingOutputWithContext(ctx context.Context) LoggingOutput
   213  }
   214  
   215  func (*Logging) ElementType() reflect.Type {
   216  	return reflect.TypeOf((**Logging)(nil)).Elem()
   217  }
   218  
   219  func (i *Logging) ToLoggingOutput() LoggingOutput {
   220  	return i.ToLoggingOutputWithContext(context.Background())
   221  }
   222  
   223  func (i *Logging) ToLoggingOutputWithContext(ctx context.Context) LoggingOutput {
   224  	return pulumi.ToOutputWithContext(ctx, i).(LoggingOutput)
   225  }
   226  
   227  // LoggingArrayInput is an input type that accepts LoggingArray and LoggingArrayOutput values.
   228  // You can construct a concrete instance of `LoggingArrayInput` via:
   229  //
   230  //	LoggingArray{ LoggingArgs{...} }
   231  type LoggingArrayInput interface {
   232  	pulumi.Input
   233  
   234  	ToLoggingArrayOutput() LoggingArrayOutput
   235  	ToLoggingArrayOutputWithContext(context.Context) LoggingArrayOutput
   236  }
   237  
   238  type LoggingArray []LoggingInput
   239  
   240  func (LoggingArray) ElementType() reflect.Type {
   241  	return reflect.TypeOf((*[]*Logging)(nil)).Elem()
   242  }
   243  
   244  func (i LoggingArray) ToLoggingArrayOutput() LoggingArrayOutput {
   245  	return i.ToLoggingArrayOutputWithContext(context.Background())
   246  }
   247  
   248  func (i LoggingArray) ToLoggingArrayOutputWithContext(ctx context.Context) LoggingArrayOutput {
   249  	return pulumi.ToOutputWithContext(ctx, i).(LoggingArrayOutput)
   250  }
   251  
   252  // LoggingMapInput is an input type that accepts LoggingMap and LoggingMapOutput values.
   253  // You can construct a concrete instance of `LoggingMapInput` via:
   254  //
   255  //	LoggingMap{ "key": LoggingArgs{...} }
   256  type LoggingMapInput interface {
   257  	pulumi.Input
   258  
   259  	ToLoggingMapOutput() LoggingMapOutput
   260  	ToLoggingMapOutputWithContext(context.Context) LoggingMapOutput
   261  }
   262  
   263  type LoggingMap map[string]LoggingInput
   264  
   265  func (LoggingMap) ElementType() reflect.Type {
   266  	return reflect.TypeOf((*map[string]*Logging)(nil)).Elem()
   267  }
   268  
   269  func (i LoggingMap) ToLoggingMapOutput() LoggingMapOutput {
   270  	return i.ToLoggingMapOutputWithContext(context.Background())
   271  }
   272  
   273  func (i LoggingMap) ToLoggingMapOutputWithContext(ctx context.Context) LoggingMapOutput {
   274  	return pulumi.ToOutputWithContext(ctx, i).(LoggingMapOutput)
   275  }
   276  
   277  type LoggingOutput struct{ *pulumi.OutputState }
   278  
   279  func (LoggingOutput) ElementType() reflect.Type {
   280  	return reflect.TypeOf((**Logging)(nil)).Elem()
   281  }
   282  
   283  func (o LoggingOutput) ToLoggingOutput() LoggingOutput {
   284  	return o
   285  }
   286  
   287  func (o LoggingOutput) ToLoggingOutputWithContext(ctx context.Context) LoggingOutput {
   288  	return o
   289  }
   290  
   291  // Name of an existing S3 bucket where the log files are to be stored. Required when `logDestinationType` is `s3`. Must be in the same region as the cluster and the cluster must have read bucket and put object permissions. For more information on the permissions required for the bucket, please read the AWS [documentation](http://docs.aws.amazon.com/redshift/latest/mgmt/db-auditing.html#db-auditing-enable-logging)
   292  func (o LoggingOutput) BucketName() pulumi.StringPtrOutput {
   293  	return o.ApplyT(func(v *Logging) pulumi.StringPtrOutput { return v.BucketName }).(pulumi.StringPtrOutput)
   294  }
   295  
   296  // Identifier of the source cluster.
   297  //
   298  // The following arguments are optional:
   299  func (o LoggingOutput) ClusterIdentifier() pulumi.StringOutput {
   300  	return o.ApplyT(func(v *Logging) pulumi.StringOutput { return v.ClusterIdentifier }).(pulumi.StringOutput)
   301  }
   302  
   303  // Log destination type. Valid values are `s3` and `cloudwatch`.
   304  func (o LoggingOutput) LogDestinationType() pulumi.StringPtrOutput {
   305  	return o.ApplyT(func(v *Logging) pulumi.StringPtrOutput { return v.LogDestinationType }).(pulumi.StringPtrOutput)
   306  }
   307  
   308  // Collection of exported log types. Required when `logDestinationType` is `cloudwatch`. Valid values are `connectionlog`, `useractivitylog`, and `userlog`.
   309  func (o LoggingOutput) LogExports() pulumi.StringArrayOutput {
   310  	return o.ApplyT(func(v *Logging) pulumi.StringArrayOutput { return v.LogExports }).(pulumi.StringArrayOutput)
   311  }
   312  
   313  // Prefix applied to the log file names.
   314  func (o LoggingOutput) S3KeyPrefix() pulumi.StringPtrOutput {
   315  	return o.ApplyT(func(v *Logging) pulumi.StringPtrOutput { return v.S3KeyPrefix }).(pulumi.StringPtrOutput)
   316  }
   317  
   318  type LoggingArrayOutput struct{ *pulumi.OutputState }
   319  
   320  func (LoggingArrayOutput) ElementType() reflect.Type {
   321  	return reflect.TypeOf((*[]*Logging)(nil)).Elem()
   322  }
   323  
   324  func (o LoggingArrayOutput) ToLoggingArrayOutput() LoggingArrayOutput {
   325  	return o
   326  }
   327  
   328  func (o LoggingArrayOutput) ToLoggingArrayOutputWithContext(ctx context.Context) LoggingArrayOutput {
   329  	return o
   330  }
   331  
   332  func (o LoggingArrayOutput) Index(i pulumi.IntInput) LoggingOutput {
   333  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *Logging {
   334  		return vs[0].([]*Logging)[vs[1].(int)]
   335  	}).(LoggingOutput)
   336  }
   337  
   338  type LoggingMapOutput struct{ *pulumi.OutputState }
   339  
   340  func (LoggingMapOutput) ElementType() reflect.Type {
   341  	return reflect.TypeOf((*map[string]*Logging)(nil)).Elem()
   342  }
   343  
   344  func (o LoggingMapOutput) ToLoggingMapOutput() LoggingMapOutput {
   345  	return o
   346  }
   347  
   348  func (o LoggingMapOutput) ToLoggingMapOutputWithContext(ctx context.Context) LoggingMapOutput {
   349  	return o
   350  }
   351  
   352  func (o LoggingMapOutput) MapIndex(k pulumi.StringInput) LoggingOutput {
   353  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *Logging {
   354  		return vs[0].(map[string]*Logging)[vs[1].(string)]
   355  	}).(LoggingOutput)
   356  }
   357  
   358  func init() {
   359  	pulumi.RegisterInputType(reflect.TypeOf((*LoggingInput)(nil)).Elem(), &Logging{})
   360  	pulumi.RegisterInputType(reflect.TypeOf((*LoggingArrayInput)(nil)).Elem(), LoggingArray{})
   361  	pulumi.RegisterInputType(reflect.TypeOf((*LoggingMapInput)(nil)).Elem(), LoggingMap{})
   362  	pulumi.RegisterOutputType(LoggingOutput{})
   363  	pulumi.RegisterOutputType(LoggingArrayOutput{})
   364  	pulumi.RegisterOutputType(LoggingMapOutput{})
   365  }