github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/timestreamwrite/database.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 timestreamwrite
     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  // Provides a Timestream database resource.
    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/timestreamwrite"
    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 := timestreamwrite.NewDatabase(ctx, "example", &timestreamwrite.DatabaseArgs{
    35  //				DatabaseName: pulumi.String("database-example"),
    36  //			})
    37  //			if err != nil {
    38  //				return err
    39  //			}
    40  //			return nil
    41  //		})
    42  //	}
    43  //
    44  // ```
    45  // <!--End PulumiCodeChooser -->
    46  //
    47  // ### Full usage
    48  //
    49  // <!--Start PulumiCodeChooser -->
    50  // ```go
    51  // package main
    52  //
    53  // import (
    54  //
    55  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/timestreamwrite"
    56  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    57  //
    58  // )
    59  //
    60  //	func main() {
    61  //		pulumi.Run(func(ctx *pulumi.Context) error {
    62  //			_, err := timestreamwrite.NewDatabase(ctx, "example", &timestreamwrite.DatabaseArgs{
    63  //				DatabaseName: pulumi.String("database-example"),
    64  //				KmsKeyId:     pulumi.Any(exampleAwsKmsKey.Arn),
    65  //				Tags: pulumi.StringMap{
    66  //					"Name": pulumi.String("value"),
    67  //				},
    68  //			})
    69  //			if err != nil {
    70  //				return err
    71  //			}
    72  //			return nil
    73  //		})
    74  //	}
    75  //
    76  // ```
    77  // <!--End PulumiCodeChooser -->
    78  //
    79  // ## Import
    80  //
    81  // Using `pulumi import`, import Timestream databases using the `database_name`. For example:
    82  //
    83  // ```sh
    84  // $ pulumi import aws:timestreamwrite/database:Database example example
    85  // ```
    86  type Database struct {
    87  	pulumi.CustomResourceState
    88  
    89  	// The ARN that uniquely identifies this database.
    90  	Arn pulumi.StringOutput `pulumi:"arn"`
    91  	// The name of the Timestream database. Minimum length of 3. Maximum length of 64.
    92  	DatabaseName pulumi.StringOutput `pulumi:"databaseName"`
    93  	// The ARN (not Alias ARN) of the KMS key to be used to encrypt the data stored in the database. If the KMS key is not specified, the database will be encrypted with a Timestream managed KMS key located in your account. Refer to [AWS managed KMS keys](https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#aws-managed-cmk) for more info.
    94  	KmsKeyId pulumi.StringOutput `pulumi:"kmsKeyId"`
    95  	// The total number of tables found within the Timestream database.
    96  	TableCount pulumi.IntOutput `pulumi:"tableCount"`
    97  	// Map of tags to assign to this resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    98  	Tags pulumi.StringMapOutput `pulumi:"tags"`
    99  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   100  	//
   101  	// Deprecated: Please use `tags` instead.
   102  	TagsAll pulumi.StringMapOutput `pulumi:"tagsAll"`
   103  }
   104  
   105  // NewDatabase registers a new resource with the given unique name, arguments, and options.
   106  func NewDatabase(ctx *pulumi.Context,
   107  	name string, args *DatabaseArgs, opts ...pulumi.ResourceOption) (*Database, error) {
   108  	if args == nil {
   109  		return nil, errors.New("missing one or more required arguments")
   110  	}
   111  
   112  	if args.DatabaseName == nil {
   113  		return nil, errors.New("invalid value for required argument 'DatabaseName'")
   114  	}
   115  	opts = internal.PkgResourceDefaultOpts(opts)
   116  	var resource Database
   117  	err := ctx.RegisterResource("aws:timestreamwrite/database:Database", name, args, &resource, opts...)
   118  	if err != nil {
   119  		return nil, err
   120  	}
   121  	return &resource, nil
   122  }
   123  
   124  // GetDatabase gets an existing Database resource's state with the given name, ID, and optional
   125  // state properties that are used to uniquely qualify the lookup (nil if not required).
   126  func GetDatabase(ctx *pulumi.Context,
   127  	name string, id pulumi.IDInput, state *DatabaseState, opts ...pulumi.ResourceOption) (*Database, error) {
   128  	var resource Database
   129  	err := ctx.ReadResource("aws:timestreamwrite/database:Database", name, id, state, &resource, opts...)
   130  	if err != nil {
   131  		return nil, err
   132  	}
   133  	return &resource, nil
   134  }
   135  
   136  // Input properties used for looking up and filtering Database resources.
   137  type databaseState struct {
   138  	// The ARN that uniquely identifies this database.
   139  	Arn *string `pulumi:"arn"`
   140  	// The name of the Timestream database. Minimum length of 3. Maximum length of 64.
   141  	DatabaseName *string `pulumi:"databaseName"`
   142  	// The ARN (not Alias ARN) of the KMS key to be used to encrypt the data stored in the database. If the KMS key is not specified, the database will be encrypted with a Timestream managed KMS key located in your account. Refer to [AWS managed KMS keys](https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#aws-managed-cmk) for more info.
   143  	KmsKeyId *string `pulumi:"kmsKeyId"`
   144  	// The total number of tables found within the Timestream database.
   145  	TableCount *int `pulumi:"tableCount"`
   146  	// Map of tags to assign to this resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   147  	Tags map[string]string `pulumi:"tags"`
   148  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   149  	//
   150  	// Deprecated: Please use `tags` instead.
   151  	TagsAll map[string]string `pulumi:"tagsAll"`
   152  }
   153  
   154  type DatabaseState struct {
   155  	// The ARN that uniquely identifies this database.
   156  	Arn pulumi.StringPtrInput
   157  	// The name of the Timestream database. Minimum length of 3. Maximum length of 64.
   158  	DatabaseName pulumi.StringPtrInput
   159  	// The ARN (not Alias ARN) of the KMS key to be used to encrypt the data stored in the database. If the KMS key is not specified, the database will be encrypted with a Timestream managed KMS key located in your account. Refer to [AWS managed KMS keys](https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#aws-managed-cmk) for more info.
   160  	KmsKeyId pulumi.StringPtrInput
   161  	// The total number of tables found within the Timestream database.
   162  	TableCount pulumi.IntPtrInput
   163  	// Map of tags to assign to this resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   164  	Tags pulumi.StringMapInput
   165  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   166  	//
   167  	// Deprecated: Please use `tags` instead.
   168  	TagsAll pulumi.StringMapInput
   169  }
   170  
   171  func (DatabaseState) ElementType() reflect.Type {
   172  	return reflect.TypeOf((*databaseState)(nil)).Elem()
   173  }
   174  
   175  type databaseArgs struct {
   176  	// The name of the Timestream database. Minimum length of 3. Maximum length of 64.
   177  	DatabaseName string `pulumi:"databaseName"`
   178  	// The ARN (not Alias ARN) of the KMS key to be used to encrypt the data stored in the database. If the KMS key is not specified, the database will be encrypted with a Timestream managed KMS key located in your account. Refer to [AWS managed KMS keys](https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#aws-managed-cmk) for more info.
   179  	KmsKeyId *string `pulumi:"kmsKeyId"`
   180  	// Map of tags to assign to this resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   181  	Tags map[string]string `pulumi:"tags"`
   182  }
   183  
   184  // The set of arguments for constructing a Database resource.
   185  type DatabaseArgs struct {
   186  	// The name of the Timestream database. Minimum length of 3. Maximum length of 64.
   187  	DatabaseName pulumi.StringInput
   188  	// The ARN (not Alias ARN) of the KMS key to be used to encrypt the data stored in the database. If the KMS key is not specified, the database will be encrypted with a Timestream managed KMS key located in your account. Refer to [AWS managed KMS keys](https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#aws-managed-cmk) for more info.
   189  	KmsKeyId pulumi.StringPtrInput
   190  	// Map of tags to assign to this resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   191  	Tags pulumi.StringMapInput
   192  }
   193  
   194  func (DatabaseArgs) ElementType() reflect.Type {
   195  	return reflect.TypeOf((*databaseArgs)(nil)).Elem()
   196  }
   197  
   198  type DatabaseInput interface {
   199  	pulumi.Input
   200  
   201  	ToDatabaseOutput() DatabaseOutput
   202  	ToDatabaseOutputWithContext(ctx context.Context) DatabaseOutput
   203  }
   204  
   205  func (*Database) ElementType() reflect.Type {
   206  	return reflect.TypeOf((**Database)(nil)).Elem()
   207  }
   208  
   209  func (i *Database) ToDatabaseOutput() DatabaseOutput {
   210  	return i.ToDatabaseOutputWithContext(context.Background())
   211  }
   212  
   213  func (i *Database) ToDatabaseOutputWithContext(ctx context.Context) DatabaseOutput {
   214  	return pulumi.ToOutputWithContext(ctx, i).(DatabaseOutput)
   215  }
   216  
   217  // DatabaseArrayInput is an input type that accepts DatabaseArray and DatabaseArrayOutput values.
   218  // You can construct a concrete instance of `DatabaseArrayInput` via:
   219  //
   220  //	DatabaseArray{ DatabaseArgs{...} }
   221  type DatabaseArrayInput interface {
   222  	pulumi.Input
   223  
   224  	ToDatabaseArrayOutput() DatabaseArrayOutput
   225  	ToDatabaseArrayOutputWithContext(context.Context) DatabaseArrayOutput
   226  }
   227  
   228  type DatabaseArray []DatabaseInput
   229  
   230  func (DatabaseArray) ElementType() reflect.Type {
   231  	return reflect.TypeOf((*[]*Database)(nil)).Elem()
   232  }
   233  
   234  func (i DatabaseArray) ToDatabaseArrayOutput() DatabaseArrayOutput {
   235  	return i.ToDatabaseArrayOutputWithContext(context.Background())
   236  }
   237  
   238  func (i DatabaseArray) ToDatabaseArrayOutputWithContext(ctx context.Context) DatabaseArrayOutput {
   239  	return pulumi.ToOutputWithContext(ctx, i).(DatabaseArrayOutput)
   240  }
   241  
   242  // DatabaseMapInput is an input type that accepts DatabaseMap and DatabaseMapOutput values.
   243  // You can construct a concrete instance of `DatabaseMapInput` via:
   244  //
   245  //	DatabaseMap{ "key": DatabaseArgs{...} }
   246  type DatabaseMapInput interface {
   247  	pulumi.Input
   248  
   249  	ToDatabaseMapOutput() DatabaseMapOutput
   250  	ToDatabaseMapOutputWithContext(context.Context) DatabaseMapOutput
   251  }
   252  
   253  type DatabaseMap map[string]DatabaseInput
   254  
   255  func (DatabaseMap) ElementType() reflect.Type {
   256  	return reflect.TypeOf((*map[string]*Database)(nil)).Elem()
   257  }
   258  
   259  func (i DatabaseMap) ToDatabaseMapOutput() DatabaseMapOutput {
   260  	return i.ToDatabaseMapOutputWithContext(context.Background())
   261  }
   262  
   263  func (i DatabaseMap) ToDatabaseMapOutputWithContext(ctx context.Context) DatabaseMapOutput {
   264  	return pulumi.ToOutputWithContext(ctx, i).(DatabaseMapOutput)
   265  }
   266  
   267  type DatabaseOutput struct{ *pulumi.OutputState }
   268  
   269  func (DatabaseOutput) ElementType() reflect.Type {
   270  	return reflect.TypeOf((**Database)(nil)).Elem()
   271  }
   272  
   273  func (o DatabaseOutput) ToDatabaseOutput() DatabaseOutput {
   274  	return o
   275  }
   276  
   277  func (o DatabaseOutput) ToDatabaseOutputWithContext(ctx context.Context) DatabaseOutput {
   278  	return o
   279  }
   280  
   281  // The ARN that uniquely identifies this database.
   282  func (o DatabaseOutput) Arn() pulumi.StringOutput {
   283  	return o.ApplyT(func(v *Database) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput)
   284  }
   285  
   286  // The name of the Timestream database. Minimum length of 3. Maximum length of 64.
   287  func (o DatabaseOutput) DatabaseName() pulumi.StringOutput {
   288  	return o.ApplyT(func(v *Database) pulumi.StringOutput { return v.DatabaseName }).(pulumi.StringOutput)
   289  }
   290  
   291  // The ARN (not Alias ARN) of the KMS key to be used to encrypt the data stored in the database. If the KMS key is not specified, the database will be encrypted with a Timestream managed KMS key located in your account. Refer to [AWS managed KMS keys](https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#aws-managed-cmk) for more info.
   292  func (o DatabaseOutput) KmsKeyId() pulumi.StringOutput {
   293  	return o.ApplyT(func(v *Database) pulumi.StringOutput { return v.KmsKeyId }).(pulumi.StringOutput)
   294  }
   295  
   296  // The total number of tables found within the Timestream database.
   297  func (o DatabaseOutput) TableCount() pulumi.IntOutput {
   298  	return o.ApplyT(func(v *Database) pulumi.IntOutput { return v.TableCount }).(pulumi.IntOutput)
   299  }
   300  
   301  // Map of tags to assign to this resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   302  func (o DatabaseOutput) Tags() pulumi.StringMapOutput {
   303  	return o.ApplyT(func(v *Database) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput)
   304  }
   305  
   306  // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   307  //
   308  // Deprecated: Please use `tags` instead.
   309  func (o DatabaseOutput) TagsAll() pulumi.StringMapOutput {
   310  	return o.ApplyT(func(v *Database) pulumi.StringMapOutput { return v.TagsAll }).(pulumi.StringMapOutput)
   311  }
   312  
   313  type DatabaseArrayOutput struct{ *pulumi.OutputState }
   314  
   315  func (DatabaseArrayOutput) ElementType() reflect.Type {
   316  	return reflect.TypeOf((*[]*Database)(nil)).Elem()
   317  }
   318  
   319  func (o DatabaseArrayOutput) ToDatabaseArrayOutput() DatabaseArrayOutput {
   320  	return o
   321  }
   322  
   323  func (o DatabaseArrayOutput) ToDatabaseArrayOutputWithContext(ctx context.Context) DatabaseArrayOutput {
   324  	return o
   325  }
   326  
   327  func (o DatabaseArrayOutput) Index(i pulumi.IntInput) DatabaseOutput {
   328  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *Database {
   329  		return vs[0].([]*Database)[vs[1].(int)]
   330  	}).(DatabaseOutput)
   331  }
   332  
   333  type DatabaseMapOutput struct{ *pulumi.OutputState }
   334  
   335  func (DatabaseMapOutput) ElementType() reflect.Type {
   336  	return reflect.TypeOf((*map[string]*Database)(nil)).Elem()
   337  }
   338  
   339  func (o DatabaseMapOutput) ToDatabaseMapOutput() DatabaseMapOutput {
   340  	return o
   341  }
   342  
   343  func (o DatabaseMapOutput) ToDatabaseMapOutputWithContext(ctx context.Context) DatabaseMapOutput {
   344  	return o
   345  }
   346  
   347  func (o DatabaseMapOutput) MapIndex(k pulumi.StringInput) DatabaseOutput {
   348  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *Database {
   349  		return vs[0].(map[string]*Database)[vs[1].(string)]
   350  	}).(DatabaseOutput)
   351  }
   352  
   353  func init() {
   354  	pulumi.RegisterInputType(reflect.TypeOf((*DatabaseInput)(nil)).Elem(), &Database{})
   355  	pulumi.RegisterInputType(reflect.TypeOf((*DatabaseArrayInput)(nil)).Elem(), DatabaseArray{})
   356  	pulumi.RegisterInputType(reflect.TypeOf((*DatabaseMapInput)(nil)).Elem(), DatabaseMap{})
   357  	pulumi.RegisterOutputType(DatabaseOutput{})
   358  	pulumi.RegisterOutputType(DatabaseArrayOutput{})
   359  	pulumi.RegisterOutputType(DatabaseMapOutput{})
   360  }