github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/athena/dataCatalog.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 athena
     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 an Athena data catalog.
    16  //
    17  // More information about Athena and Athena data catalogs can be found in the [Athena User Guide](https://docs.aws.amazon.com/athena/latest/ug/what-is.html).
    18  //
    19  // > **Tip:** for a more detailed explanation on the usage of `parameters`, see the [DataCatalog API documentation](https://docs.aws.amazon.com/athena/latest/APIReference/API_DataCatalog.html)
    20  //
    21  // ## Example Usage
    22  //
    23  // <!--Start PulumiCodeChooser -->
    24  // ```go
    25  // package main
    26  //
    27  // import (
    28  //
    29  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/athena"
    30  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    31  //
    32  // )
    33  //
    34  //	func main() {
    35  //		pulumi.Run(func(ctx *pulumi.Context) error {
    36  //			_, err := athena.NewDataCatalog(ctx, "example", &athena.DataCatalogArgs{
    37  //				Name:        pulumi.String("athena-data-catalog"),
    38  //				Description: pulumi.String("Example Athena data catalog"),
    39  //				Type:        pulumi.String("LAMBDA"),
    40  //				Parameters: pulumi.StringMap{
    41  //					"function": pulumi.String("arn:aws:lambda:eu-central-1:123456789012:function:not-important-lambda-function"),
    42  //				},
    43  //				Tags: pulumi.StringMap{
    44  //					"Name": pulumi.String("example-athena-data-catalog"),
    45  //				},
    46  //			})
    47  //			if err != nil {
    48  //				return err
    49  //			}
    50  //			return nil
    51  //		})
    52  //	}
    53  //
    54  // ```
    55  // <!--End PulumiCodeChooser -->
    56  //
    57  // ### Hive based Data Catalog
    58  //
    59  // <!--Start PulumiCodeChooser -->
    60  // ```go
    61  // package main
    62  //
    63  // import (
    64  //
    65  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/athena"
    66  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    67  //
    68  // )
    69  //
    70  //	func main() {
    71  //		pulumi.Run(func(ctx *pulumi.Context) error {
    72  //			_, err := athena.NewDataCatalog(ctx, "example", &athena.DataCatalogArgs{
    73  //				Name:        pulumi.String("hive-data-catalog"),
    74  //				Description: pulumi.String("Hive based Data Catalog"),
    75  //				Type:        pulumi.String("HIVE"),
    76  //				Parameters: pulumi.StringMap{
    77  //					"metadata-function": pulumi.String("arn:aws:lambda:eu-central-1:123456789012:function:not-important-lambda-function"),
    78  //				},
    79  //			})
    80  //			if err != nil {
    81  //				return err
    82  //			}
    83  //			return nil
    84  //		})
    85  //	}
    86  //
    87  // ```
    88  // <!--End PulumiCodeChooser -->
    89  //
    90  // ### Glue based Data Catalog
    91  //
    92  // <!--Start PulumiCodeChooser -->
    93  // ```go
    94  // package main
    95  //
    96  // import (
    97  //
    98  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/athena"
    99  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
   100  //
   101  // )
   102  //
   103  //	func main() {
   104  //		pulumi.Run(func(ctx *pulumi.Context) error {
   105  //			_, err := athena.NewDataCatalog(ctx, "example", &athena.DataCatalogArgs{
   106  //				Name:        pulumi.String("glue-data-catalog"),
   107  //				Description: pulumi.String("Glue based Data Catalog"),
   108  //				Type:        pulumi.String("GLUE"),
   109  //				Parameters: pulumi.StringMap{
   110  //					"catalog-id": pulumi.String("123456789012"),
   111  //				},
   112  //			})
   113  //			if err != nil {
   114  //				return err
   115  //			}
   116  //			return nil
   117  //		})
   118  //	}
   119  //
   120  // ```
   121  // <!--End PulumiCodeChooser -->
   122  //
   123  // ### Lambda based Data Catalog
   124  //
   125  // <!--Start PulumiCodeChooser -->
   126  // ```go
   127  // package main
   128  //
   129  // import (
   130  //
   131  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/athena"
   132  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
   133  //
   134  // )
   135  //
   136  //	func main() {
   137  //		pulumi.Run(func(ctx *pulumi.Context) error {
   138  //			_, err := athena.NewDataCatalog(ctx, "example", &athena.DataCatalogArgs{
   139  //				Name:        pulumi.String("lambda-data-catalog"),
   140  //				Description: pulumi.String("Lambda based Data Catalog"),
   141  //				Type:        pulumi.String("LAMBDA"),
   142  //				Parameters: pulumi.StringMap{
   143  //					"metadata-function": pulumi.String("arn:aws:lambda:eu-central-1:123456789012:function:not-important-lambda-function-1"),
   144  //					"record-function":   pulumi.String("arn:aws:lambda:eu-central-1:123456789012:function:not-important-lambda-function-2"),
   145  //				},
   146  //			})
   147  //			if err != nil {
   148  //				return err
   149  //			}
   150  //			return nil
   151  //		})
   152  //	}
   153  //
   154  // ```
   155  // <!--End PulumiCodeChooser -->
   156  //
   157  // ## Import
   158  //
   159  // Using `pulumi import`, import data catalogs using their `name`. For example:
   160  //
   161  // ```sh
   162  // $ pulumi import aws:athena/dataCatalog:DataCatalog example example-data-catalog
   163  // ```
   164  type DataCatalog struct {
   165  	pulumi.CustomResourceState
   166  
   167  	// ARN of the data catalog.
   168  	Arn pulumi.StringOutput `pulumi:"arn"`
   169  	// Description of the data catalog.
   170  	Description pulumi.StringOutput `pulumi:"description"`
   171  	// Name of the data catalog. The catalog name must be unique for the AWS account and can use a maximum of 128 alphanumeric, underscore, at sign, or hyphen characters.
   172  	Name pulumi.StringOutput `pulumi:"name"`
   173  	// Key value pairs that specifies the Lambda function or functions to use for the data catalog. The mapping used depends on the catalog type.
   174  	Parameters pulumi.StringMapOutput `pulumi:"parameters"`
   175  	// Map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   176  	Tags pulumi.StringMapOutput `pulumi:"tags"`
   177  	// Map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   178  	//
   179  	// Deprecated: Please use `tags` instead.
   180  	TagsAll pulumi.StringMapOutput `pulumi:"tagsAll"`
   181  	// Type of data catalog: `LAMBDA` for a federated catalog, `GLUE` for AWS Glue Catalog, or `HIVE` for an external hive metastore.
   182  	Type pulumi.StringOutput `pulumi:"type"`
   183  }
   184  
   185  // NewDataCatalog registers a new resource with the given unique name, arguments, and options.
   186  func NewDataCatalog(ctx *pulumi.Context,
   187  	name string, args *DataCatalogArgs, opts ...pulumi.ResourceOption) (*DataCatalog, error) {
   188  	if args == nil {
   189  		return nil, errors.New("missing one or more required arguments")
   190  	}
   191  
   192  	if args.Description == nil {
   193  		return nil, errors.New("invalid value for required argument 'Description'")
   194  	}
   195  	if args.Parameters == nil {
   196  		return nil, errors.New("invalid value for required argument 'Parameters'")
   197  	}
   198  	if args.Type == nil {
   199  		return nil, errors.New("invalid value for required argument 'Type'")
   200  	}
   201  	opts = internal.PkgResourceDefaultOpts(opts)
   202  	var resource DataCatalog
   203  	err := ctx.RegisterResource("aws:athena/dataCatalog:DataCatalog", name, args, &resource, opts...)
   204  	if err != nil {
   205  		return nil, err
   206  	}
   207  	return &resource, nil
   208  }
   209  
   210  // GetDataCatalog gets an existing DataCatalog resource's state with the given name, ID, and optional
   211  // state properties that are used to uniquely qualify the lookup (nil if not required).
   212  func GetDataCatalog(ctx *pulumi.Context,
   213  	name string, id pulumi.IDInput, state *DataCatalogState, opts ...pulumi.ResourceOption) (*DataCatalog, error) {
   214  	var resource DataCatalog
   215  	err := ctx.ReadResource("aws:athena/dataCatalog:DataCatalog", name, id, state, &resource, opts...)
   216  	if err != nil {
   217  		return nil, err
   218  	}
   219  	return &resource, nil
   220  }
   221  
   222  // Input properties used for looking up and filtering DataCatalog resources.
   223  type dataCatalogState struct {
   224  	// ARN of the data catalog.
   225  	Arn *string `pulumi:"arn"`
   226  	// Description of the data catalog.
   227  	Description *string `pulumi:"description"`
   228  	// Name of the data catalog. The catalog name must be unique for the AWS account and can use a maximum of 128 alphanumeric, underscore, at sign, or hyphen characters.
   229  	Name *string `pulumi:"name"`
   230  	// Key value pairs that specifies the Lambda function or functions to use for the data catalog. The mapping used depends on the catalog type.
   231  	Parameters map[string]string `pulumi:"parameters"`
   232  	// Map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   233  	Tags map[string]string `pulumi:"tags"`
   234  	// Map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   235  	//
   236  	// Deprecated: Please use `tags` instead.
   237  	TagsAll map[string]string `pulumi:"tagsAll"`
   238  	// Type of data catalog: `LAMBDA` for a federated catalog, `GLUE` for AWS Glue Catalog, or `HIVE` for an external hive metastore.
   239  	Type *string `pulumi:"type"`
   240  }
   241  
   242  type DataCatalogState struct {
   243  	// ARN of the data catalog.
   244  	Arn pulumi.StringPtrInput
   245  	// Description of the data catalog.
   246  	Description pulumi.StringPtrInput
   247  	// Name of the data catalog. The catalog name must be unique for the AWS account and can use a maximum of 128 alphanumeric, underscore, at sign, or hyphen characters.
   248  	Name pulumi.StringPtrInput
   249  	// Key value pairs that specifies the Lambda function or functions to use for the data catalog. The mapping used depends on the catalog type.
   250  	Parameters pulumi.StringMapInput
   251  	// Map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   252  	Tags pulumi.StringMapInput
   253  	// Map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   254  	//
   255  	// Deprecated: Please use `tags` instead.
   256  	TagsAll pulumi.StringMapInput
   257  	// Type of data catalog: `LAMBDA` for a federated catalog, `GLUE` for AWS Glue Catalog, or `HIVE` for an external hive metastore.
   258  	Type pulumi.StringPtrInput
   259  }
   260  
   261  func (DataCatalogState) ElementType() reflect.Type {
   262  	return reflect.TypeOf((*dataCatalogState)(nil)).Elem()
   263  }
   264  
   265  type dataCatalogArgs struct {
   266  	// Description of the data catalog.
   267  	Description string `pulumi:"description"`
   268  	// Name of the data catalog. The catalog name must be unique for the AWS account and can use a maximum of 128 alphanumeric, underscore, at sign, or hyphen characters.
   269  	Name *string `pulumi:"name"`
   270  	// Key value pairs that specifies the Lambda function or functions to use for the data catalog. The mapping used depends on the catalog type.
   271  	Parameters map[string]string `pulumi:"parameters"`
   272  	// Map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   273  	Tags map[string]string `pulumi:"tags"`
   274  	// Type of data catalog: `LAMBDA` for a federated catalog, `GLUE` for AWS Glue Catalog, or `HIVE` for an external hive metastore.
   275  	Type string `pulumi:"type"`
   276  }
   277  
   278  // The set of arguments for constructing a DataCatalog resource.
   279  type DataCatalogArgs struct {
   280  	// Description of the data catalog.
   281  	Description pulumi.StringInput
   282  	// Name of the data catalog. The catalog name must be unique for the AWS account and can use a maximum of 128 alphanumeric, underscore, at sign, or hyphen characters.
   283  	Name pulumi.StringPtrInput
   284  	// Key value pairs that specifies the Lambda function or functions to use for the data catalog. The mapping used depends on the catalog type.
   285  	Parameters pulumi.StringMapInput
   286  	// Map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   287  	Tags pulumi.StringMapInput
   288  	// Type of data catalog: `LAMBDA` for a federated catalog, `GLUE` for AWS Glue Catalog, or `HIVE` for an external hive metastore.
   289  	Type pulumi.StringInput
   290  }
   291  
   292  func (DataCatalogArgs) ElementType() reflect.Type {
   293  	return reflect.TypeOf((*dataCatalogArgs)(nil)).Elem()
   294  }
   295  
   296  type DataCatalogInput interface {
   297  	pulumi.Input
   298  
   299  	ToDataCatalogOutput() DataCatalogOutput
   300  	ToDataCatalogOutputWithContext(ctx context.Context) DataCatalogOutput
   301  }
   302  
   303  func (*DataCatalog) ElementType() reflect.Type {
   304  	return reflect.TypeOf((**DataCatalog)(nil)).Elem()
   305  }
   306  
   307  func (i *DataCatalog) ToDataCatalogOutput() DataCatalogOutput {
   308  	return i.ToDataCatalogOutputWithContext(context.Background())
   309  }
   310  
   311  func (i *DataCatalog) ToDataCatalogOutputWithContext(ctx context.Context) DataCatalogOutput {
   312  	return pulumi.ToOutputWithContext(ctx, i).(DataCatalogOutput)
   313  }
   314  
   315  // DataCatalogArrayInput is an input type that accepts DataCatalogArray and DataCatalogArrayOutput values.
   316  // You can construct a concrete instance of `DataCatalogArrayInput` via:
   317  //
   318  //	DataCatalogArray{ DataCatalogArgs{...} }
   319  type DataCatalogArrayInput interface {
   320  	pulumi.Input
   321  
   322  	ToDataCatalogArrayOutput() DataCatalogArrayOutput
   323  	ToDataCatalogArrayOutputWithContext(context.Context) DataCatalogArrayOutput
   324  }
   325  
   326  type DataCatalogArray []DataCatalogInput
   327  
   328  func (DataCatalogArray) ElementType() reflect.Type {
   329  	return reflect.TypeOf((*[]*DataCatalog)(nil)).Elem()
   330  }
   331  
   332  func (i DataCatalogArray) ToDataCatalogArrayOutput() DataCatalogArrayOutput {
   333  	return i.ToDataCatalogArrayOutputWithContext(context.Background())
   334  }
   335  
   336  func (i DataCatalogArray) ToDataCatalogArrayOutputWithContext(ctx context.Context) DataCatalogArrayOutput {
   337  	return pulumi.ToOutputWithContext(ctx, i).(DataCatalogArrayOutput)
   338  }
   339  
   340  // DataCatalogMapInput is an input type that accepts DataCatalogMap and DataCatalogMapOutput values.
   341  // You can construct a concrete instance of `DataCatalogMapInput` via:
   342  //
   343  //	DataCatalogMap{ "key": DataCatalogArgs{...} }
   344  type DataCatalogMapInput interface {
   345  	pulumi.Input
   346  
   347  	ToDataCatalogMapOutput() DataCatalogMapOutput
   348  	ToDataCatalogMapOutputWithContext(context.Context) DataCatalogMapOutput
   349  }
   350  
   351  type DataCatalogMap map[string]DataCatalogInput
   352  
   353  func (DataCatalogMap) ElementType() reflect.Type {
   354  	return reflect.TypeOf((*map[string]*DataCatalog)(nil)).Elem()
   355  }
   356  
   357  func (i DataCatalogMap) ToDataCatalogMapOutput() DataCatalogMapOutput {
   358  	return i.ToDataCatalogMapOutputWithContext(context.Background())
   359  }
   360  
   361  func (i DataCatalogMap) ToDataCatalogMapOutputWithContext(ctx context.Context) DataCatalogMapOutput {
   362  	return pulumi.ToOutputWithContext(ctx, i).(DataCatalogMapOutput)
   363  }
   364  
   365  type DataCatalogOutput struct{ *pulumi.OutputState }
   366  
   367  func (DataCatalogOutput) ElementType() reflect.Type {
   368  	return reflect.TypeOf((**DataCatalog)(nil)).Elem()
   369  }
   370  
   371  func (o DataCatalogOutput) ToDataCatalogOutput() DataCatalogOutput {
   372  	return o
   373  }
   374  
   375  func (o DataCatalogOutput) ToDataCatalogOutputWithContext(ctx context.Context) DataCatalogOutput {
   376  	return o
   377  }
   378  
   379  // ARN of the data catalog.
   380  func (o DataCatalogOutput) Arn() pulumi.StringOutput {
   381  	return o.ApplyT(func(v *DataCatalog) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput)
   382  }
   383  
   384  // Description of the data catalog.
   385  func (o DataCatalogOutput) Description() pulumi.StringOutput {
   386  	return o.ApplyT(func(v *DataCatalog) pulumi.StringOutput { return v.Description }).(pulumi.StringOutput)
   387  }
   388  
   389  // Name of the data catalog. The catalog name must be unique for the AWS account and can use a maximum of 128 alphanumeric, underscore, at sign, or hyphen characters.
   390  func (o DataCatalogOutput) Name() pulumi.StringOutput {
   391  	return o.ApplyT(func(v *DataCatalog) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
   392  }
   393  
   394  // Key value pairs that specifies the Lambda function or functions to use for the data catalog. The mapping used depends on the catalog type.
   395  func (o DataCatalogOutput) Parameters() pulumi.StringMapOutput {
   396  	return o.ApplyT(func(v *DataCatalog) pulumi.StringMapOutput { return v.Parameters }).(pulumi.StringMapOutput)
   397  }
   398  
   399  // Map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   400  func (o DataCatalogOutput) Tags() pulumi.StringMapOutput {
   401  	return o.ApplyT(func(v *DataCatalog) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput)
   402  }
   403  
   404  // Map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   405  //
   406  // Deprecated: Please use `tags` instead.
   407  func (o DataCatalogOutput) TagsAll() pulumi.StringMapOutput {
   408  	return o.ApplyT(func(v *DataCatalog) pulumi.StringMapOutput { return v.TagsAll }).(pulumi.StringMapOutput)
   409  }
   410  
   411  // Type of data catalog: `LAMBDA` for a federated catalog, `GLUE` for AWS Glue Catalog, or `HIVE` for an external hive metastore.
   412  func (o DataCatalogOutput) Type() pulumi.StringOutput {
   413  	return o.ApplyT(func(v *DataCatalog) pulumi.StringOutput { return v.Type }).(pulumi.StringOutput)
   414  }
   415  
   416  type DataCatalogArrayOutput struct{ *pulumi.OutputState }
   417  
   418  func (DataCatalogArrayOutput) ElementType() reflect.Type {
   419  	return reflect.TypeOf((*[]*DataCatalog)(nil)).Elem()
   420  }
   421  
   422  func (o DataCatalogArrayOutput) ToDataCatalogArrayOutput() DataCatalogArrayOutput {
   423  	return o
   424  }
   425  
   426  func (o DataCatalogArrayOutput) ToDataCatalogArrayOutputWithContext(ctx context.Context) DataCatalogArrayOutput {
   427  	return o
   428  }
   429  
   430  func (o DataCatalogArrayOutput) Index(i pulumi.IntInput) DataCatalogOutput {
   431  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *DataCatalog {
   432  		return vs[0].([]*DataCatalog)[vs[1].(int)]
   433  	}).(DataCatalogOutput)
   434  }
   435  
   436  type DataCatalogMapOutput struct{ *pulumi.OutputState }
   437  
   438  func (DataCatalogMapOutput) ElementType() reflect.Type {
   439  	return reflect.TypeOf((*map[string]*DataCatalog)(nil)).Elem()
   440  }
   441  
   442  func (o DataCatalogMapOutput) ToDataCatalogMapOutput() DataCatalogMapOutput {
   443  	return o
   444  }
   445  
   446  func (o DataCatalogMapOutput) ToDataCatalogMapOutputWithContext(ctx context.Context) DataCatalogMapOutput {
   447  	return o
   448  }
   449  
   450  func (o DataCatalogMapOutput) MapIndex(k pulumi.StringInput) DataCatalogOutput {
   451  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *DataCatalog {
   452  		return vs[0].(map[string]*DataCatalog)[vs[1].(string)]
   453  	}).(DataCatalogOutput)
   454  }
   455  
   456  func init() {
   457  	pulumi.RegisterInputType(reflect.TypeOf((*DataCatalogInput)(nil)).Elem(), &DataCatalog{})
   458  	pulumi.RegisterInputType(reflect.TypeOf((*DataCatalogArrayInput)(nil)).Elem(), DataCatalogArray{})
   459  	pulumi.RegisterInputType(reflect.TypeOf((*DataCatalogMapInput)(nil)).Elem(), DataCatalogMap{})
   460  	pulumi.RegisterOutputType(DataCatalogOutput{})
   461  	pulumi.RegisterOutputType(DataCatalogArrayOutput{})
   462  	pulumi.RegisterOutputType(DataCatalogMapOutput{})
   463  }