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

com.pulumi.aws.glue.kotlin.UserDefinedFunction.kt Maven / Gradle / Ivy

@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.aws.glue.kotlin

import com.pulumi.aws.glue.kotlin.outputs.UserDefinedFunctionResourceUri
import com.pulumi.aws.glue.kotlin.outputs.UserDefinedFunctionResourceUri.Companion.toKotlin
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.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List

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

    public var args: UserDefinedFunctionArgs = UserDefinedFunctionArgs()

    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 UserDefinedFunctionArgsBuilder.() -> Unit) {
        val builder = UserDefinedFunctionArgsBuilder()
        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(): UserDefinedFunction {
        val builtJavaResource = com.pulumi.aws.glue.UserDefinedFunction(
            this.name,
            this.args.toJava(),
            this.opts.toJava(),
        )
        return UserDefinedFunction(builtJavaResource)
    }
}

/**
 * Provides a Glue User Defined Function Resource.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as aws from "@pulumi/aws";
 * const example = new aws.glue.CatalogDatabase("example", {name: "my_database"});
 * const exampleUserDefinedFunction = new aws.glue.UserDefinedFunction("example", {
 *     name: "my_func",
 *     catalogId: example.catalogId,
 *     databaseName: example.name,
 *     className: "class",
 *     ownerName: "owner",
 *     ownerType: "GROUP",
 *     resourceUris: [{
 *         resourceType: "ARCHIVE",
 *         uri: "uri",
 *     }],
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_aws as aws
 * example = aws.glue.CatalogDatabase("example", name="my_database")
 * example_user_defined_function = aws.glue.UserDefinedFunction("example",
 *     name="my_func",
 *     catalog_id=example.catalog_id,
 *     database_name=example.name,
 *     class_name="class",
 *     owner_name="owner",
 *     owner_type="GROUP",
 *     resource_uris=[{
 *         "resource_type": "ARCHIVE",
 *         "uri": "uri",
 *     }])
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Aws = Pulumi.Aws;
 * return await Deployment.RunAsync(() =>
 * {
 *     var example = new Aws.Glue.CatalogDatabase("example", new()
 *     {
 *         Name = "my_database",
 *     });
 *     var exampleUserDefinedFunction = new Aws.Glue.UserDefinedFunction("example", new()
 *     {
 *         Name = "my_func",
 *         CatalogId = example.CatalogId,
 *         DatabaseName = example.Name,
 *         ClassName = "class",
 *         OwnerName = "owner",
 *         OwnerType = "GROUP",
 *         ResourceUris = new[]
 *         {
 *             new Aws.Glue.Inputs.UserDefinedFunctionResourceUriArgs
 *             {
 *                 ResourceType = "ARCHIVE",
 *                 Uri = "uri",
 *             },
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/glue"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		example, err := glue.NewCatalogDatabase(ctx, "example", &glue.CatalogDatabaseArgs{
 * 			Name: pulumi.String("my_database"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = glue.NewUserDefinedFunction(ctx, "example", &glue.UserDefinedFunctionArgs{
 * 			Name:         pulumi.String("my_func"),
 * 			CatalogId:    example.CatalogId,
 * 			DatabaseName: example.Name,
 * 			ClassName:    pulumi.String("class"),
 * 			OwnerName:    pulumi.String("owner"),
 * 			OwnerType:    pulumi.String("GROUP"),
 * 			ResourceUris: glue.UserDefinedFunctionResourceUriArray{
 * 				&glue.UserDefinedFunctionResourceUriArgs{
 * 					ResourceType: pulumi.String("ARCHIVE"),
 * 					Uri:          pulumi.String("uri"),
 * 				},
 * 			},
 * 		})
 * 		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.glue.CatalogDatabase;
 * import com.pulumi.aws.glue.CatalogDatabaseArgs;
 * import com.pulumi.aws.glue.UserDefinedFunction;
 * import com.pulumi.aws.glue.UserDefinedFunctionArgs;
 * import com.pulumi.aws.glue.inputs.UserDefinedFunctionResourceUriArgs;
 * 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 CatalogDatabase("example", CatalogDatabaseArgs.builder()
 *             .name("my_database")
 *             .build());
 *         var exampleUserDefinedFunction = new UserDefinedFunction("exampleUserDefinedFunction", UserDefinedFunctionArgs.builder()
 *             .name("my_func")
 *             .catalogId(example.catalogId())
 *             .databaseName(example.name())
 *             .className("class")
 *             .ownerName("owner")
 *             .ownerType("GROUP")
 *             .resourceUris(UserDefinedFunctionResourceUriArgs.builder()
 *                 .resourceType("ARCHIVE")
 *                 .uri("uri")
 *                 .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: aws:glue:CatalogDatabase
 *     properties:
 *       name: my_database
 *   exampleUserDefinedFunction:
 *     type: aws:glue:UserDefinedFunction
 *     name: example
 *     properties:
 *       name: my_func
 *       catalogId: ${example.catalogId}
 *       databaseName: ${example.name}
 *       className: class
 *       ownerName: owner
 *       ownerType: GROUP
 *       resourceUris:
 *         - resourceType: ARCHIVE
 *           uri: uri
 * ```
 * 
 * ## Import
 * Using `pulumi import`, import Glue User Defined Functions using the `catalog_id:database_name:function_name`. If you have not set a Catalog ID specify the AWS Account ID that the database is in. For example:
 * ```sh
 * $ pulumi import aws:glue/userDefinedFunction:UserDefinedFunction func 123456789012:my_database:my_func
 * ```
 */
public class UserDefinedFunction internal constructor(
    override val javaResource: com.pulumi.aws.glue.UserDefinedFunction,
) : KotlinCustomResource(javaResource, UserDefinedFunctionMapper) {
    /**
     * The ARN of the Glue User Defined Function.
     */
    public val arn: Output
        get() = javaResource.arn().applyValue({ args0 -> args0 })

    /**
     * ID of the Glue Catalog to create the function in. If omitted, this defaults to the AWS Account ID.
     */
    public val catalogId: Output?
        get() = javaResource.catalogId().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * The Java class that contains the function code.
     */
    public val className: Output
        get() = javaResource.className().applyValue({ args0 -> args0 })

    /**
     * The time at which the function was created.
     */
    public val createTime: Output
        get() = javaResource.createTime().applyValue({ args0 -> args0 })

    /**
     * The name of the Database to create the Function.
     */
    public val databaseName: Output
        get() = javaResource.databaseName().applyValue({ args0 -> args0 })

    /**
     * The name of the function.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * The owner of the function.
     */
    public val ownerName: Output
        get() = javaResource.ownerName().applyValue({ args0 -> args0 })

    /**
     * The owner type. can be one of `USER`, `ROLE`, and `GROUP`.
     */
    public val ownerType: Output
        get() = javaResource.ownerType().applyValue({ args0 -> args0 })

    /**
     * The configuration block for Resource URIs. See resource uris below for more details.
     */
    public val resourceUris: Output>?
        get() = javaResource.resourceUris().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.let({ args0 -> toKotlin(args0) })
                })
            }).orElse(null)
        })
}

public object UserDefinedFunctionMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.aws.glue.UserDefinedFunction::class == javaResource::class

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

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

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy