github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/glue/partition.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 glue
     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 Glue Partition Resource.
    16  //
    17  // ## Import
    18  //
    19  // Using `pulumi import`, import Glue Partitions using the catalog ID (usually AWS account ID), database name, table name and partition values. For example:
    20  //
    21  // ```sh
    22  // $ pulumi import aws:glue/partition:Partition part 123456789012:MyDatabase:MyTable:val1#val2
    23  // ```
    24  type Partition struct {
    25  	pulumi.CustomResourceState
    26  
    27  	// ID of the Glue Catalog and database to create the table in. If omitted, this defaults to the AWS Account ID plus the database name.
    28  	CatalogId pulumi.StringOutput `pulumi:"catalogId"`
    29  	// The time at which the partition was created.
    30  	CreationTime pulumi.StringOutput `pulumi:"creationTime"`
    31  	// Name of the metadata database where the table metadata resides. For Hive compatibility, this must be all lowercase.
    32  	DatabaseName pulumi.StringOutput `pulumi:"databaseName"`
    33  	// The last time at which the partition was accessed.
    34  	LastAccessedTime pulumi.StringOutput `pulumi:"lastAccessedTime"`
    35  	// The last time at which column statistics were computed for this partition.
    36  	LastAnalyzedTime pulumi.StringOutput `pulumi:"lastAnalyzedTime"`
    37  	// Properties associated with this table, as a list of key-value pairs.
    38  	Parameters pulumi.StringMapOutput `pulumi:"parameters"`
    39  	// The values that define the partition.
    40  	PartitionValues pulumi.StringArrayOutput `pulumi:"partitionValues"`
    41  	// A storage descriptor object containing information about the physical storage of this table. You can refer to the [Glue Developer Guide](https://docs.aws.amazon.com/glue/latest/dg/aws-glue-api-catalog-tables.html#aws-glue-api-catalog-tables-StorageDescriptor) for a full explanation of this object.
    42  	StorageDescriptor PartitionStorageDescriptorPtrOutput `pulumi:"storageDescriptor"`
    43  	TableName         pulumi.StringOutput                 `pulumi:"tableName"`
    44  }
    45  
    46  // NewPartition registers a new resource with the given unique name, arguments, and options.
    47  func NewPartition(ctx *pulumi.Context,
    48  	name string, args *PartitionArgs, opts ...pulumi.ResourceOption) (*Partition, error) {
    49  	if args == nil {
    50  		return nil, errors.New("missing one or more required arguments")
    51  	}
    52  
    53  	if args.DatabaseName == nil {
    54  		return nil, errors.New("invalid value for required argument 'DatabaseName'")
    55  	}
    56  	if args.PartitionValues == nil {
    57  		return nil, errors.New("invalid value for required argument 'PartitionValues'")
    58  	}
    59  	if args.TableName == nil {
    60  		return nil, errors.New("invalid value for required argument 'TableName'")
    61  	}
    62  	opts = internal.PkgResourceDefaultOpts(opts)
    63  	var resource Partition
    64  	err := ctx.RegisterResource("aws:glue/partition:Partition", name, args, &resource, opts...)
    65  	if err != nil {
    66  		return nil, err
    67  	}
    68  	return &resource, nil
    69  }
    70  
    71  // GetPartition gets an existing Partition resource's state with the given name, ID, and optional
    72  // state properties that are used to uniquely qualify the lookup (nil if not required).
    73  func GetPartition(ctx *pulumi.Context,
    74  	name string, id pulumi.IDInput, state *PartitionState, opts ...pulumi.ResourceOption) (*Partition, error) {
    75  	var resource Partition
    76  	err := ctx.ReadResource("aws:glue/partition:Partition", name, id, state, &resource, opts...)
    77  	if err != nil {
    78  		return nil, err
    79  	}
    80  	return &resource, nil
    81  }
    82  
    83  // Input properties used for looking up and filtering Partition resources.
    84  type partitionState struct {
    85  	// ID of the Glue Catalog and database to create the table in. If omitted, this defaults to the AWS Account ID plus the database name.
    86  	CatalogId *string `pulumi:"catalogId"`
    87  	// The time at which the partition was created.
    88  	CreationTime *string `pulumi:"creationTime"`
    89  	// Name of the metadata database where the table metadata resides. For Hive compatibility, this must be all lowercase.
    90  	DatabaseName *string `pulumi:"databaseName"`
    91  	// The last time at which the partition was accessed.
    92  	LastAccessedTime *string `pulumi:"lastAccessedTime"`
    93  	// The last time at which column statistics were computed for this partition.
    94  	LastAnalyzedTime *string `pulumi:"lastAnalyzedTime"`
    95  	// Properties associated with this table, as a list of key-value pairs.
    96  	Parameters map[string]string `pulumi:"parameters"`
    97  	// The values that define the partition.
    98  	PartitionValues []string `pulumi:"partitionValues"`
    99  	// A storage descriptor object containing information about the physical storage of this table. You can refer to the [Glue Developer Guide](https://docs.aws.amazon.com/glue/latest/dg/aws-glue-api-catalog-tables.html#aws-glue-api-catalog-tables-StorageDescriptor) for a full explanation of this object.
   100  	StorageDescriptor *PartitionStorageDescriptor `pulumi:"storageDescriptor"`
   101  	TableName         *string                     `pulumi:"tableName"`
   102  }
   103  
   104  type PartitionState struct {
   105  	// ID of the Glue Catalog and database to create the table in. If omitted, this defaults to the AWS Account ID plus the database name.
   106  	CatalogId pulumi.StringPtrInput
   107  	// The time at which the partition was created.
   108  	CreationTime pulumi.StringPtrInput
   109  	// Name of the metadata database where the table metadata resides. For Hive compatibility, this must be all lowercase.
   110  	DatabaseName pulumi.StringPtrInput
   111  	// The last time at which the partition was accessed.
   112  	LastAccessedTime pulumi.StringPtrInput
   113  	// The last time at which column statistics were computed for this partition.
   114  	LastAnalyzedTime pulumi.StringPtrInput
   115  	// Properties associated with this table, as a list of key-value pairs.
   116  	Parameters pulumi.StringMapInput
   117  	// The values that define the partition.
   118  	PartitionValues pulumi.StringArrayInput
   119  	// A storage descriptor object containing information about the physical storage of this table. You can refer to the [Glue Developer Guide](https://docs.aws.amazon.com/glue/latest/dg/aws-glue-api-catalog-tables.html#aws-glue-api-catalog-tables-StorageDescriptor) for a full explanation of this object.
   120  	StorageDescriptor PartitionStorageDescriptorPtrInput
   121  	TableName         pulumi.StringPtrInput
   122  }
   123  
   124  func (PartitionState) ElementType() reflect.Type {
   125  	return reflect.TypeOf((*partitionState)(nil)).Elem()
   126  }
   127  
   128  type partitionArgs struct {
   129  	// ID of the Glue Catalog and database to create the table in. If omitted, this defaults to the AWS Account ID plus the database name.
   130  	CatalogId *string `pulumi:"catalogId"`
   131  	// Name of the metadata database where the table metadata resides. For Hive compatibility, this must be all lowercase.
   132  	DatabaseName string `pulumi:"databaseName"`
   133  	// Properties associated with this table, as a list of key-value pairs.
   134  	Parameters map[string]string `pulumi:"parameters"`
   135  	// The values that define the partition.
   136  	PartitionValues []string `pulumi:"partitionValues"`
   137  	// A storage descriptor object containing information about the physical storage of this table. You can refer to the [Glue Developer Guide](https://docs.aws.amazon.com/glue/latest/dg/aws-glue-api-catalog-tables.html#aws-glue-api-catalog-tables-StorageDescriptor) for a full explanation of this object.
   138  	StorageDescriptor *PartitionStorageDescriptor `pulumi:"storageDescriptor"`
   139  	TableName         string                      `pulumi:"tableName"`
   140  }
   141  
   142  // The set of arguments for constructing a Partition resource.
   143  type PartitionArgs struct {
   144  	// ID of the Glue Catalog and database to create the table in. If omitted, this defaults to the AWS Account ID plus the database name.
   145  	CatalogId pulumi.StringPtrInput
   146  	// Name of the metadata database where the table metadata resides. For Hive compatibility, this must be all lowercase.
   147  	DatabaseName pulumi.StringInput
   148  	// Properties associated with this table, as a list of key-value pairs.
   149  	Parameters pulumi.StringMapInput
   150  	// The values that define the partition.
   151  	PartitionValues pulumi.StringArrayInput
   152  	// A storage descriptor object containing information about the physical storage of this table. You can refer to the [Glue Developer Guide](https://docs.aws.amazon.com/glue/latest/dg/aws-glue-api-catalog-tables.html#aws-glue-api-catalog-tables-StorageDescriptor) for a full explanation of this object.
   153  	StorageDescriptor PartitionStorageDescriptorPtrInput
   154  	TableName         pulumi.StringInput
   155  }
   156  
   157  func (PartitionArgs) ElementType() reflect.Type {
   158  	return reflect.TypeOf((*partitionArgs)(nil)).Elem()
   159  }
   160  
   161  type PartitionInput interface {
   162  	pulumi.Input
   163  
   164  	ToPartitionOutput() PartitionOutput
   165  	ToPartitionOutputWithContext(ctx context.Context) PartitionOutput
   166  }
   167  
   168  func (*Partition) ElementType() reflect.Type {
   169  	return reflect.TypeOf((**Partition)(nil)).Elem()
   170  }
   171  
   172  func (i *Partition) ToPartitionOutput() PartitionOutput {
   173  	return i.ToPartitionOutputWithContext(context.Background())
   174  }
   175  
   176  func (i *Partition) ToPartitionOutputWithContext(ctx context.Context) PartitionOutput {
   177  	return pulumi.ToOutputWithContext(ctx, i).(PartitionOutput)
   178  }
   179  
   180  // PartitionArrayInput is an input type that accepts PartitionArray and PartitionArrayOutput values.
   181  // You can construct a concrete instance of `PartitionArrayInput` via:
   182  //
   183  //	PartitionArray{ PartitionArgs{...} }
   184  type PartitionArrayInput interface {
   185  	pulumi.Input
   186  
   187  	ToPartitionArrayOutput() PartitionArrayOutput
   188  	ToPartitionArrayOutputWithContext(context.Context) PartitionArrayOutput
   189  }
   190  
   191  type PartitionArray []PartitionInput
   192  
   193  func (PartitionArray) ElementType() reflect.Type {
   194  	return reflect.TypeOf((*[]*Partition)(nil)).Elem()
   195  }
   196  
   197  func (i PartitionArray) ToPartitionArrayOutput() PartitionArrayOutput {
   198  	return i.ToPartitionArrayOutputWithContext(context.Background())
   199  }
   200  
   201  func (i PartitionArray) ToPartitionArrayOutputWithContext(ctx context.Context) PartitionArrayOutput {
   202  	return pulumi.ToOutputWithContext(ctx, i).(PartitionArrayOutput)
   203  }
   204  
   205  // PartitionMapInput is an input type that accepts PartitionMap and PartitionMapOutput values.
   206  // You can construct a concrete instance of `PartitionMapInput` via:
   207  //
   208  //	PartitionMap{ "key": PartitionArgs{...} }
   209  type PartitionMapInput interface {
   210  	pulumi.Input
   211  
   212  	ToPartitionMapOutput() PartitionMapOutput
   213  	ToPartitionMapOutputWithContext(context.Context) PartitionMapOutput
   214  }
   215  
   216  type PartitionMap map[string]PartitionInput
   217  
   218  func (PartitionMap) ElementType() reflect.Type {
   219  	return reflect.TypeOf((*map[string]*Partition)(nil)).Elem()
   220  }
   221  
   222  func (i PartitionMap) ToPartitionMapOutput() PartitionMapOutput {
   223  	return i.ToPartitionMapOutputWithContext(context.Background())
   224  }
   225  
   226  func (i PartitionMap) ToPartitionMapOutputWithContext(ctx context.Context) PartitionMapOutput {
   227  	return pulumi.ToOutputWithContext(ctx, i).(PartitionMapOutput)
   228  }
   229  
   230  type PartitionOutput struct{ *pulumi.OutputState }
   231  
   232  func (PartitionOutput) ElementType() reflect.Type {
   233  	return reflect.TypeOf((**Partition)(nil)).Elem()
   234  }
   235  
   236  func (o PartitionOutput) ToPartitionOutput() PartitionOutput {
   237  	return o
   238  }
   239  
   240  func (o PartitionOutput) ToPartitionOutputWithContext(ctx context.Context) PartitionOutput {
   241  	return o
   242  }
   243  
   244  // ID of the Glue Catalog and database to create the table in. If omitted, this defaults to the AWS Account ID plus the database name.
   245  func (o PartitionOutput) CatalogId() pulumi.StringOutput {
   246  	return o.ApplyT(func(v *Partition) pulumi.StringOutput { return v.CatalogId }).(pulumi.StringOutput)
   247  }
   248  
   249  // The time at which the partition was created.
   250  func (o PartitionOutput) CreationTime() pulumi.StringOutput {
   251  	return o.ApplyT(func(v *Partition) pulumi.StringOutput { return v.CreationTime }).(pulumi.StringOutput)
   252  }
   253  
   254  // Name of the metadata database where the table metadata resides. For Hive compatibility, this must be all lowercase.
   255  func (o PartitionOutput) DatabaseName() pulumi.StringOutput {
   256  	return o.ApplyT(func(v *Partition) pulumi.StringOutput { return v.DatabaseName }).(pulumi.StringOutput)
   257  }
   258  
   259  // The last time at which the partition was accessed.
   260  func (o PartitionOutput) LastAccessedTime() pulumi.StringOutput {
   261  	return o.ApplyT(func(v *Partition) pulumi.StringOutput { return v.LastAccessedTime }).(pulumi.StringOutput)
   262  }
   263  
   264  // The last time at which column statistics were computed for this partition.
   265  func (o PartitionOutput) LastAnalyzedTime() pulumi.StringOutput {
   266  	return o.ApplyT(func(v *Partition) pulumi.StringOutput { return v.LastAnalyzedTime }).(pulumi.StringOutput)
   267  }
   268  
   269  // Properties associated with this table, as a list of key-value pairs.
   270  func (o PartitionOutput) Parameters() pulumi.StringMapOutput {
   271  	return o.ApplyT(func(v *Partition) pulumi.StringMapOutput { return v.Parameters }).(pulumi.StringMapOutput)
   272  }
   273  
   274  // The values that define the partition.
   275  func (o PartitionOutput) PartitionValues() pulumi.StringArrayOutput {
   276  	return o.ApplyT(func(v *Partition) pulumi.StringArrayOutput { return v.PartitionValues }).(pulumi.StringArrayOutput)
   277  }
   278  
   279  // A storage descriptor object containing information about the physical storage of this table. You can refer to the [Glue Developer Guide](https://docs.aws.amazon.com/glue/latest/dg/aws-glue-api-catalog-tables.html#aws-glue-api-catalog-tables-StorageDescriptor) for a full explanation of this object.
   280  func (o PartitionOutput) StorageDescriptor() PartitionStorageDescriptorPtrOutput {
   281  	return o.ApplyT(func(v *Partition) PartitionStorageDescriptorPtrOutput { return v.StorageDescriptor }).(PartitionStorageDescriptorPtrOutput)
   282  }
   283  
   284  func (o PartitionOutput) TableName() pulumi.StringOutput {
   285  	return o.ApplyT(func(v *Partition) pulumi.StringOutput { return v.TableName }).(pulumi.StringOutput)
   286  }
   287  
   288  type PartitionArrayOutput struct{ *pulumi.OutputState }
   289  
   290  func (PartitionArrayOutput) ElementType() reflect.Type {
   291  	return reflect.TypeOf((*[]*Partition)(nil)).Elem()
   292  }
   293  
   294  func (o PartitionArrayOutput) ToPartitionArrayOutput() PartitionArrayOutput {
   295  	return o
   296  }
   297  
   298  func (o PartitionArrayOutput) ToPartitionArrayOutputWithContext(ctx context.Context) PartitionArrayOutput {
   299  	return o
   300  }
   301  
   302  func (o PartitionArrayOutput) Index(i pulumi.IntInput) PartitionOutput {
   303  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *Partition {
   304  		return vs[0].([]*Partition)[vs[1].(int)]
   305  	}).(PartitionOutput)
   306  }
   307  
   308  type PartitionMapOutput struct{ *pulumi.OutputState }
   309  
   310  func (PartitionMapOutput) ElementType() reflect.Type {
   311  	return reflect.TypeOf((*map[string]*Partition)(nil)).Elem()
   312  }
   313  
   314  func (o PartitionMapOutput) ToPartitionMapOutput() PartitionMapOutput {
   315  	return o
   316  }
   317  
   318  func (o PartitionMapOutput) ToPartitionMapOutputWithContext(ctx context.Context) PartitionMapOutput {
   319  	return o
   320  }
   321  
   322  func (o PartitionMapOutput) MapIndex(k pulumi.StringInput) PartitionOutput {
   323  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *Partition {
   324  		return vs[0].(map[string]*Partition)[vs[1].(string)]
   325  	}).(PartitionOutput)
   326  }
   327  
   328  func init() {
   329  	pulumi.RegisterInputType(reflect.TypeOf((*PartitionInput)(nil)).Elem(), &Partition{})
   330  	pulumi.RegisterInputType(reflect.TypeOf((*PartitionArrayInput)(nil)).Elem(), PartitionArray{})
   331  	pulumi.RegisterInputType(reflect.TypeOf((*PartitionMapInput)(nil)).Elem(), PartitionMap{})
   332  	pulumi.RegisterOutputType(PartitionOutput{})
   333  	pulumi.RegisterOutputType(PartitionArrayOutput{})
   334  	pulumi.RegisterOutputType(PartitionMapOutput{})
   335  }