All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.pulumi.aws.athena.kotlin.DataCatalog.kt Maven / Gradle / Ivy

Go to download

Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.

There is a newer version: 6.57.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.aws.athena.kotlin

import com.pulumi.core.Output
import com.pulumi.kotlin.KotlinCustomResource
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.ResourceMapper
import com.pulumi.kotlin.options.CustomResourceOptions
import com.pulumi.kotlin.options.CustomResourceOptionsBuilder
import com.pulumi.resources.Resource
import kotlin.Boolean
import kotlin.Deprecated
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.Map

/**
 * Builder for [DataCatalog].
 */
@PulumiTagMarker
public class DataCatalogResourceBuilder internal constructor() {
    public var name: String? = null

    public var args: DataCatalogArgs = DataCatalogArgs()

    public var opts: CustomResourceOptions = CustomResourceOptions()

    /**
     * @param name The _unique_ name of the resulting resource.
     */
    public fun name(`value`: String) {
        this.name = value
    }

    /**
     * @param block The arguments to use to populate this resource's properties.
     */
    public suspend fun args(block: suspend DataCatalogArgsBuilder.() -> Unit) {
        val builder = DataCatalogArgsBuilder()
        block(builder)
        this.args = builder.build()
    }

    /**
     * @param block A bag of options that control this resource's behavior.
     */
    public suspend fun opts(block: suspend CustomResourceOptionsBuilder.() -> Unit) {
        this.opts = com.pulumi.kotlin.options.CustomResourceOptions.opts(block)
    }

    internal fun build(): DataCatalog {
        val builtJavaResource = com.pulumi.aws.athena.DataCatalog(
            this.name,
            this.args.toJava(),
            this.opts.toJava(),
        )
        return DataCatalog(builtJavaResource)
    }
}

/**
 * Provides an Athena data catalog.
 * 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).
 * > **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)
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as aws from "@pulumi/aws";
 * const example = new aws.athena.DataCatalog("example", {
 *     name: "athena-data-catalog",
 *     description: "Example Athena data catalog",
 *     type: "LAMBDA",
 *     parameters: {
 *         "function": "arn:aws:lambda:eu-central-1:123456789012:function:not-important-lambda-function",
 *     },
 *     tags: {
 *         Name: "example-athena-data-catalog",
 *     },
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_aws as aws
 * example = aws.athena.DataCatalog("example",
 *     name="athena-data-catalog",
 *     description="Example Athena data catalog",
 *     type="LAMBDA",
 *     parameters={
 *         "function": "arn:aws:lambda:eu-central-1:123456789012:function:not-important-lambda-function",
 *     },
 *     tags={
 *         "Name": "example-athena-data-catalog",
 *     })
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Aws = Pulumi.Aws;
 * return await Deployment.RunAsync(() =>
 * {
 *     var example = new Aws.Athena.DataCatalog("example", new()
 *     {
 *         Name = "athena-data-catalog",
 *         Description = "Example Athena data catalog",
 *         Type = "LAMBDA",
 *         Parameters =
 *         {
 *             { "function", "arn:aws:lambda:eu-central-1:123456789012:function:not-important-lambda-function" },
 *         },
 *         Tags =
 *         {
 *             { "Name", "example-athena-data-catalog" },
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/athena"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := athena.NewDataCatalog(ctx, "example", &athena.DataCatalogArgs{
 * 			Name:        pulumi.String("athena-data-catalog"),
 * 			Description: pulumi.String("Example Athena data catalog"),
 * 			Type:        pulumi.String("LAMBDA"),
 * 			Parameters: pulumi.StringMap{
 * 				"function": pulumi.String("arn:aws:lambda:eu-central-1:123456789012:function:not-important-lambda-function"),
 * 			},
 * 			Tags: pulumi.StringMap{
 * 				"Name": pulumi.String("example-athena-data-catalog"),
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		return nil
 * 	})
 * }
 * ```
 * ```java
 * package generated_program;
 * import com.pulumi.Context;
 * import com.pulumi.Pulumi;
 * import com.pulumi.core.Output;
 * import com.pulumi.aws.athena.DataCatalog;
 * import com.pulumi.aws.athena.DataCatalogArgs;
 * import java.util.List;
 * import java.util.ArrayList;
 * import java.util.Map;
 * import java.io.File;
 * import java.nio.file.Files;
 * import java.nio.file.Paths;
 * public class App {
 *     public static void main(String[] args) {
 *         Pulumi.run(App::stack);
 *     }
 *     public static void stack(Context ctx) {
 *         var example = new DataCatalog("example", DataCatalogArgs.builder()
 *             .name("athena-data-catalog")
 *             .description("Example Athena data catalog")
 *             .type("LAMBDA")
 *             .parameters(Map.of("function", "arn:aws:lambda:eu-central-1:123456789012:function:not-important-lambda-function"))
 *             .tags(Map.of("Name", "example-athena-data-catalog"))
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: aws:athena:DataCatalog
 *     properties:
 *       name: athena-data-catalog
 *       description: Example Athena data catalog
 *       type: LAMBDA
 *       parameters:
 *         function: arn:aws:lambda:eu-central-1:123456789012:function:not-important-lambda-function
 *       tags:
 *         Name: example-athena-data-catalog
 * ```
 * 
 * ### Hive based Data Catalog
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as aws from "@pulumi/aws";
 * const example = new aws.athena.DataCatalog("example", {
 *     name: "hive-data-catalog",
 *     description: "Hive based Data Catalog",
 *     type: "HIVE",
 *     parameters: {
 *         "metadata-function": "arn:aws:lambda:eu-central-1:123456789012:function:not-important-lambda-function",
 *     },
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_aws as aws
 * example = aws.athena.DataCatalog("example",
 *     name="hive-data-catalog",
 *     description="Hive based Data Catalog",
 *     type="HIVE",
 *     parameters={
 *         "metadata-function": "arn:aws:lambda:eu-central-1:123456789012:function:not-important-lambda-function",
 *     })
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Aws = Pulumi.Aws;
 * return await Deployment.RunAsync(() =>
 * {
 *     var example = new Aws.Athena.DataCatalog("example", new()
 *     {
 *         Name = "hive-data-catalog",
 *         Description = "Hive based Data Catalog",
 *         Type = "HIVE",
 *         Parameters =
 *         {
 *             { "metadata-function", "arn:aws:lambda:eu-central-1:123456789012:function:not-important-lambda-function" },
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/athena"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := athena.NewDataCatalog(ctx, "example", &athena.DataCatalogArgs{
 * 			Name:        pulumi.String("hive-data-catalog"),
 * 			Description: pulumi.String("Hive based Data Catalog"),
 * 			Type:        pulumi.String("HIVE"),
 * 			Parameters: pulumi.StringMap{
 * 				"metadata-function": pulumi.String("arn:aws:lambda:eu-central-1:123456789012:function:not-important-lambda-function"),
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		return nil
 * 	})
 * }
 * ```
 * ```java
 * package generated_program;
 * import com.pulumi.Context;
 * import com.pulumi.Pulumi;
 * import com.pulumi.core.Output;
 * import com.pulumi.aws.athena.DataCatalog;
 * import com.pulumi.aws.athena.DataCatalogArgs;
 * import java.util.List;
 * import java.util.ArrayList;
 * import java.util.Map;
 * import java.io.File;
 * import java.nio.file.Files;
 * import java.nio.file.Paths;
 * public class App {
 *     public static void main(String[] args) {
 *         Pulumi.run(App::stack);
 *     }
 *     public static void stack(Context ctx) {
 *         var example = new DataCatalog("example", DataCatalogArgs.builder()
 *             .name("hive-data-catalog")
 *             .description("Hive based Data Catalog")
 *             .type("HIVE")
 *             .parameters(Map.of("metadata-function", "arn:aws:lambda:eu-central-1:123456789012:function:not-important-lambda-function"))
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: aws:athena:DataCatalog
 *     properties:
 *       name: hive-data-catalog
 *       description: Hive based Data Catalog
 *       type: HIVE
 *       parameters:
 *         metadata-function: arn:aws:lambda:eu-central-1:123456789012:function:not-important-lambda-function
 * ```
 * 
 * ### Glue based Data Catalog
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as aws from "@pulumi/aws";
 * const example = new aws.athena.DataCatalog("example", {
 *     name: "glue-data-catalog",
 *     description: "Glue based Data Catalog",
 *     type: "GLUE",
 *     parameters: {
 *         "catalog-id": "123456789012",
 *     },
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_aws as aws
 * example = aws.athena.DataCatalog("example",
 *     name="glue-data-catalog",
 *     description="Glue based Data Catalog",
 *     type="GLUE",
 *     parameters={
 *         "catalog-id": "123456789012",
 *     })
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Aws = Pulumi.Aws;
 * return await Deployment.RunAsync(() =>
 * {
 *     var example = new Aws.Athena.DataCatalog("example", new()
 *     {
 *         Name = "glue-data-catalog",
 *         Description = "Glue based Data Catalog",
 *         Type = "GLUE",
 *         Parameters =
 *         {
 *             { "catalog-id", "123456789012" },
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/athena"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := athena.NewDataCatalog(ctx, "example", &athena.DataCatalogArgs{
 * 			Name:        pulumi.String("glue-data-catalog"),
 * 			Description: pulumi.String("Glue based Data Catalog"),
 * 			Type:        pulumi.String("GLUE"),
 * 			Parameters: pulumi.StringMap{
 * 				"catalog-id": pulumi.String("123456789012"),
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		return nil
 * 	})
 * }
 * ```
 * ```java
 * package generated_program;
 * import com.pulumi.Context;
 * import com.pulumi.Pulumi;
 * import com.pulumi.core.Output;
 * import com.pulumi.aws.athena.DataCatalog;
 * import com.pulumi.aws.athena.DataCatalogArgs;
 * import java.util.List;
 * import java.util.ArrayList;
 * import java.util.Map;
 * import java.io.File;
 * import java.nio.file.Files;
 * import java.nio.file.Paths;
 * public class App {
 *     public static void main(String[] args) {
 *         Pulumi.run(App::stack);
 *     }
 *     public static void stack(Context ctx) {
 *         var example = new DataCatalog("example", DataCatalogArgs.builder()
 *             .name("glue-data-catalog")
 *             .description("Glue based Data Catalog")
 *             .type("GLUE")
 *             .parameters(Map.of("catalog-id", "123456789012"))
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: aws:athena:DataCatalog
 *     properties:
 *       name: glue-data-catalog
 *       description: Glue based Data Catalog
 *       type: GLUE
 *       parameters:
 *         catalog-id: '123456789012'
 * ```
 * 
 * ### Lambda based Data Catalog
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as aws from "@pulumi/aws";
 * const example = new aws.athena.DataCatalog("example", {
 *     name: "lambda-data-catalog",
 *     description: "Lambda based Data Catalog",
 *     type: "LAMBDA",
 *     parameters: {
 *         "metadata-function": "arn:aws:lambda:eu-central-1:123456789012:function:not-important-lambda-function-1",
 *         "record-function": "arn:aws:lambda:eu-central-1:123456789012:function:not-important-lambda-function-2",
 *     },
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_aws as aws
 * example = aws.athena.DataCatalog("example",
 *     name="lambda-data-catalog",
 *     description="Lambda based Data Catalog",
 *     type="LAMBDA",
 *     parameters={
 *         "metadata-function": "arn:aws:lambda:eu-central-1:123456789012:function:not-important-lambda-function-1",
 *         "record-function": "arn:aws:lambda:eu-central-1:123456789012:function:not-important-lambda-function-2",
 *     })
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Aws = Pulumi.Aws;
 * return await Deployment.RunAsync(() =>
 * {
 *     var example = new Aws.Athena.DataCatalog("example", new()
 *     {
 *         Name = "lambda-data-catalog",
 *         Description = "Lambda based Data Catalog",
 *         Type = "LAMBDA",
 *         Parameters =
 *         {
 *             { "metadata-function", "arn:aws:lambda:eu-central-1:123456789012:function:not-important-lambda-function-1" },
 *             { "record-function", "arn:aws:lambda:eu-central-1:123456789012:function:not-important-lambda-function-2" },
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/athena"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := athena.NewDataCatalog(ctx, "example", &athena.DataCatalogArgs{
 * 			Name:        pulumi.String("lambda-data-catalog"),
 * 			Description: pulumi.String("Lambda based Data Catalog"),
 * 			Type:        pulumi.String("LAMBDA"),
 * 			Parameters: pulumi.StringMap{
 * 				"metadata-function": pulumi.String("arn:aws:lambda:eu-central-1:123456789012:function:not-important-lambda-function-1"),
 * 				"record-function":   pulumi.String("arn:aws:lambda:eu-central-1:123456789012:function:not-important-lambda-function-2"),
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		return nil
 * 	})
 * }
 * ```
 * ```java
 * package generated_program;
 * import com.pulumi.Context;
 * import com.pulumi.Pulumi;
 * import com.pulumi.core.Output;
 * import com.pulumi.aws.athena.DataCatalog;
 * import com.pulumi.aws.athena.DataCatalogArgs;
 * import java.util.List;
 * import java.util.ArrayList;
 * import java.util.Map;
 * import java.io.File;
 * import java.nio.file.Files;
 * import java.nio.file.Paths;
 * public class App {
 *     public static void main(String[] args) {
 *         Pulumi.run(App::stack);
 *     }
 *     public static void stack(Context ctx) {
 *         var example = new DataCatalog("example", DataCatalogArgs.builder()
 *             .name("lambda-data-catalog")
 *             .description("Lambda based Data Catalog")
 *             .type("LAMBDA")
 *             .parameters(Map.ofEntries(
 *                 Map.entry("metadata-function", "arn:aws:lambda:eu-central-1:123456789012:function:not-important-lambda-function-1"),
 *                 Map.entry("record-function", "arn:aws:lambda:eu-central-1:123456789012:function:not-important-lambda-function-2")
 *             ))
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: aws:athena:DataCatalog
 *     properties:
 *       name: lambda-data-catalog
 *       description: Lambda based Data Catalog
 *       type: LAMBDA
 *       parameters:
 *         metadata-function: arn:aws:lambda:eu-central-1:123456789012:function:not-important-lambda-function-1
 *         record-function: arn:aws:lambda:eu-central-1:123456789012:function:not-important-lambda-function-2
 * ```
 * 
 * ## Import
 * Using `pulumi import`, import data catalogs using their `name`. For example:
 * ```sh
 * $ pulumi import aws:athena/dataCatalog:DataCatalog example example-data-catalog
 * ```
 */
public class DataCatalog internal constructor(
    override val javaResource: com.pulumi.aws.athena.DataCatalog,
) : KotlinCustomResource(javaResource, DataCatalogMapper) {
    /**
     * ARN of the data catalog.
     */
    public val arn: Output
        get() = javaResource.arn().applyValue({ args0 -> args0 })

    /**
     * Description of the data catalog.
     */
    public val description: Output
        get() = javaResource.description().applyValue({ args0 -> args0 })

    /**
     * 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.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * Key value pairs that specifies the Lambda function or functions to use for the data catalog. The mapping used depends on the catalog type.
     */
    public val parameters: Output>
        get() = javaResource.parameters().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.key.to(args0.value)
            }).toMap()
        })

    /**
     * Map of tags to assign to the resource. If configured with a provider `default_tags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
     */
    public val tags: Output>?
        get() = javaResource.tags().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.key.to(args0.value)
                }).toMap()
            }).orElse(null)
        })

    /**
     * Map of tags assigned to the resource, including those inherited from the provider `default_tags` configuration block.
     */
    @Deprecated(
        message = """
  Please use `tags` instead.
  """,
    )
    public val tagsAll: Output>
        get() = javaResource.tagsAll().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.key.to(args0.value)
            }).toMap()
        })

    /**
     * Type of data catalog: `LAMBDA` for a federated catalog, `GLUE` for AWS Glue Catalog, or `HIVE` for an external hive metastore.
     */
    public val type: Output
        get() = javaResource.type().applyValue({ args0 -> args0 })
}

public object DataCatalogMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.aws.athena.DataCatalog::class == javaResource::class

    override fun map(javaResource: Resource): DataCatalog = DataCatalog(
        javaResource as
            com.pulumi.aws.athena.DataCatalog,
    )
}

/**
 * @see [DataCatalog].
 * @param name The _unique_ name of the resulting resource.
 * @param block Builder for [DataCatalog].
 */
public suspend fun dataCatalog(name: String, block: suspend DataCatalogResourceBuilder.() -> Unit): DataCatalog {
    val builder = DataCatalogResourceBuilder()
    builder.name(name)
    block(builder)
    return builder.build()
}

/**
 * @see [DataCatalog].
 * @param name The _unique_ name of the resulting resource.
 */
public fun dataCatalog(name: String): DataCatalog {
    val builder = DataCatalogResourceBuilder()
    builder.name(name)
    return builder.build()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy