1. Packages
  2. AWS
  3. API Docs
  4. glue
  5. UserDefinedFunction
AWS v6.75.0 published on Wednesday, Apr 2, 2025 by Pulumi

aws.glue.UserDefinedFunction

Explore with Pulumi AI

Provides a Glue User Defined Function Resource.

Example Usage

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",
    }],
});
Copy
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",
    }])
Copy
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
	})
}
Copy
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",
            },
        },
    });

});
Copy
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());

    }
}
Copy
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
Copy

Create UserDefinedFunction Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new UserDefinedFunction(name: string, args: UserDefinedFunctionArgs, opts?: CustomResourceOptions);
@overload
def UserDefinedFunction(resource_name: str,
                        args: UserDefinedFunctionArgs,
                        opts: Optional[ResourceOptions] = None)

@overload
def UserDefinedFunction(resource_name: str,
                        opts: Optional[ResourceOptions] = None,
                        class_name: Optional[str] = None,
                        database_name: Optional[str] = None,
                        owner_name: Optional[str] = None,
                        owner_type: Optional[str] = None,
                        catalog_id: Optional[str] = None,
                        name: Optional[str] = None,
                        resource_uris: Optional[Sequence[UserDefinedFunctionResourceUriArgs]] = None)
func NewUserDefinedFunction(ctx *Context, name string, args UserDefinedFunctionArgs, opts ...ResourceOption) (*UserDefinedFunction, error)
public UserDefinedFunction(string name, UserDefinedFunctionArgs args, CustomResourceOptions? opts = null)
public UserDefinedFunction(String name, UserDefinedFunctionArgs args)
public UserDefinedFunction(String name, UserDefinedFunctionArgs args, CustomResourceOptions options)
type: aws:glue:UserDefinedFunction
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. UserDefinedFunctionArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. UserDefinedFunctionArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. UserDefinedFunctionArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. UserDefinedFunctionArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. UserDefinedFunctionArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Constructor example

The following reference example uses placeholder values for all input properties.

var userDefinedFunctionResource = new Aws.Glue.UserDefinedFunction("userDefinedFunctionResource", new()
{
    ClassName = "string",
    DatabaseName = "string",
    OwnerName = "string",
    OwnerType = "string",
    CatalogId = "string",
    Name = "string",
    ResourceUris = new[]
    {
        new Aws.Glue.Inputs.UserDefinedFunctionResourceUriArgs
        {
            ResourceType = "string",
            Uri = "string",
        },
    },
});
Copy
example, err := glue.NewUserDefinedFunction(ctx, "userDefinedFunctionResource", &glue.UserDefinedFunctionArgs{
	ClassName:    pulumi.String("string"),
	DatabaseName: pulumi.String("string"),
	OwnerName:    pulumi.String("string"),
	OwnerType:    pulumi.String("string"),
	CatalogId:    pulumi.String("string"),
	Name:         pulumi.String("string"),
	ResourceUris: glue.UserDefinedFunctionResourceUriArray{
		&glue.UserDefinedFunctionResourceUriArgs{
			ResourceType: pulumi.String("string"),
			Uri:          pulumi.String("string"),
		},
	},
})
Copy
var userDefinedFunctionResource = new UserDefinedFunction("userDefinedFunctionResource", UserDefinedFunctionArgs.builder()
    .className("string")
    .databaseName("string")
    .ownerName("string")
    .ownerType("string")
    .catalogId("string")
    .name("string")
    .resourceUris(UserDefinedFunctionResourceUriArgs.builder()
        .resourceType("string")
        .uri("string")
        .build())
    .build());
Copy
user_defined_function_resource = aws.glue.UserDefinedFunction("userDefinedFunctionResource",
    class_name="string",
    database_name="string",
    owner_name="string",
    owner_type="string",
    catalog_id="string",
    name="string",
    resource_uris=[{
        "resource_type": "string",
        "uri": "string",
    }])
Copy
const userDefinedFunctionResource = new aws.glue.UserDefinedFunction("userDefinedFunctionResource", {
    className: "string",
    databaseName: "string",
    ownerName: "string",
    ownerType: "string",
    catalogId: "string",
    name: "string",
    resourceUris: [{
        resourceType: "string",
        uri: "string",
    }],
});
Copy
type: aws:glue:UserDefinedFunction
properties:
    catalogId: string
    className: string
    databaseName: string
    name: string
    ownerName: string
    ownerType: string
    resourceUris:
        - resourceType: string
          uri: string
Copy

UserDefinedFunction Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The UserDefinedFunction resource accepts the following input properties:

ClassName This property is required. string
The Java class that contains the function code.
DatabaseName
This property is required.
Changes to this property will trigger replacement.
string
The name of the Database to create the Function.
OwnerName This property is required. string
The owner of the function.
OwnerType This property is required. string
The owner type. can be one of USER, ROLE, and GROUP.
CatalogId Changes to this property will trigger replacement. string
ID of the Glue Catalog to create the function in. If omitted, this defaults to the AWS Account ID.
Name Changes to this property will trigger replacement. string
The name of the function.
ResourceUris List<UserDefinedFunctionResourceUri>
The configuration block for Resource URIs. See resource uris below for more details.
ClassName This property is required. string
The Java class that contains the function code.
DatabaseName
This property is required.
Changes to this property will trigger replacement.
string
The name of the Database to create the Function.
OwnerName This property is required. string
The owner of the function.
OwnerType This property is required. string
The owner type. can be one of USER, ROLE, and GROUP.
CatalogId Changes to this property will trigger replacement. string
ID of the Glue Catalog to create the function in. If omitted, this defaults to the AWS Account ID.
Name Changes to this property will trigger replacement. string
The name of the function.
ResourceUris []UserDefinedFunctionResourceUriArgs
The configuration block for Resource URIs. See resource uris below for more details.
className This property is required. String
The Java class that contains the function code.
databaseName
This property is required.
Changes to this property will trigger replacement.
String
The name of the Database to create the Function.
ownerName This property is required. String
The owner of the function.
ownerType This property is required. String
The owner type. can be one of USER, ROLE, and GROUP.
catalogId Changes to this property will trigger replacement. String
ID of the Glue Catalog to create the function in. If omitted, this defaults to the AWS Account ID.
name Changes to this property will trigger replacement. String
The name of the function.
resourceUris List<UserDefinedFunctionResourceUri>
The configuration block for Resource URIs. See resource uris below for more details.
className This property is required. string
The Java class that contains the function code.
databaseName
This property is required.
Changes to this property will trigger replacement.
string
The name of the Database to create the Function.
ownerName This property is required. string
The owner of the function.
ownerType This property is required. string
The owner type. can be one of USER, ROLE, and GROUP.
catalogId Changes to this property will trigger replacement. string
ID of the Glue Catalog to create the function in. If omitted, this defaults to the AWS Account ID.
name Changes to this property will trigger replacement. string
The name of the function.
resourceUris UserDefinedFunctionResourceUri[]
The configuration block for Resource URIs. See resource uris below for more details.
class_name This property is required. str
The Java class that contains the function code.
database_name
This property is required.
Changes to this property will trigger replacement.
str
The name of the Database to create the Function.
owner_name This property is required. str
The owner of the function.
owner_type This property is required. str
The owner type. can be one of USER, ROLE, and GROUP.
catalog_id Changes to this property will trigger replacement. str
ID of the Glue Catalog to create the function in. If omitted, this defaults to the AWS Account ID.
name Changes to this property will trigger replacement. str
The name of the function.
resource_uris Sequence[UserDefinedFunctionResourceUriArgs]
The configuration block for Resource URIs. See resource uris below for more details.
className This property is required. String
The Java class that contains the function code.
databaseName
This property is required.
Changes to this property will trigger replacement.
String
The name of the Database to create the Function.
ownerName This property is required. String
The owner of the function.
ownerType This property is required. String
The owner type. can be one of USER, ROLE, and GROUP.
catalogId Changes to this property will trigger replacement. String
ID of the Glue Catalog to create the function in. If omitted, this defaults to the AWS Account ID.
name Changes to this property will trigger replacement. String
The name of the function.
resourceUris List<Property Map>
The configuration block for Resource URIs. See resource uris below for more details.

Outputs

All input properties are implicitly available as output properties. Additionally, the UserDefinedFunction resource produces the following output properties:

Arn string
The ARN of the Glue User Defined Function.
CreateTime string
The time at which the function was created.
Id string
The provider-assigned unique ID for this managed resource.
Arn string
The ARN of the Glue User Defined Function.
CreateTime string
The time at which the function was created.
Id string
The provider-assigned unique ID for this managed resource.
arn String
The ARN of the Glue User Defined Function.
createTime String
The time at which the function was created.
id String
The provider-assigned unique ID for this managed resource.
arn string
The ARN of the Glue User Defined Function.
createTime string
The time at which the function was created.
id string
The provider-assigned unique ID for this managed resource.
arn str
The ARN of the Glue User Defined Function.
create_time str
The time at which the function was created.
id str
The provider-assigned unique ID for this managed resource.
arn String
The ARN of the Glue User Defined Function.
createTime String
The time at which the function was created.
id String
The provider-assigned unique ID for this managed resource.

Look up Existing UserDefinedFunction Resource

Get an existing UserDefinedFunction resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: UserDefinedFunctionState, opts?: CustomResourceOptions): UserDefinedFunction
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        arn: Optional[str] = None,
        catalog_id: Optional[str] = None,
        class_name: Optional[str] = None,
        create_time: Optional[str] = None,
        database_name: Optional[str] = None,
        name: Optional[str] = None,
        owner_name: Optional[str] = None,
        owner_type: Optional[str] = None,
        resource_uris: Optional[Sequence[UserDefinedFunctionResourceUriArgs]] = None) -> UserDefinedFunction
func GetUserDefinedFunction(ctx *Context, name string, id IDInput, state *UserDefinedFunctionState, opts ...ResourceOption) (*UserDefinedFunction, error)
public static UserDefinedFunction Get(string name, Input<string> id, UserDefinedFunctionState? state, CustomResourceOptions? opts = null)
public static UserDefinedFunction get(String name, Output<String> id, UserDefinedFunctionState state, CustomResourceOptions options)
resources:  _:    type: aws:glue:UserDefinedFunction    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
Arn string
The ARN of the Glue User Defined Function.
CatalogId Changes to this property will trigger replacement. string
ID of the Glue Catalog to create the function in. If omitted, this defaults to the AWS Account ID.
ClassName string
The Java class that contains the function code.
CreateTime string
The time at which the function was created.
DatabaseName Changes to this property will trigger replacement. string
The name of the Database to create the Function.
Name Changes to this property will trigger replacement. string
The name of the function.
OwnerName string
The owner of the function.
OwnerType string
The owner type. can be one of USER, ROLE, and GROUP.
ResourceUris List<UserDefinedFunctionResourceUri>
The configuration block for Resource URIs. See resource uris below for more details.
Arn string
The ARN of the Glue User Defined Function.
CatalogId Changes to this property will trigger replacement. string
ID of the Glue Catalog to create the function in. If omitted, this defaults to the AWS Account ID.
ClassName string
The Java class that contains the function code.
CreateTime string
The time at which the function was created.
DatabaseName Changes to this property will trigger replacement. string
The name of the Database to create the Function.
Name Changes to this property will trigger replacement. string
The name of the function.
OwnerName string
The owner of the function.
OwnerType string
The owner type. can be one of USER, ROLE, and GROUP.
ResourceUris []UserDefinedFunctionResourceUriArgs
The configuration block for Resource URIs. See resource uris below for more details.
arn String
The ARN of the Glue User Defined Function.
catalogId Changes to this property will trigger replacement. String
ID of the Glue Catalog to create the function in. If omitted, this defaults to the AWS Account ID.
className String
The Java class that contains the function code.
createTime String
The time at which the function was created.
databaseName Changes to this property will trigger replacement. String
The name of the Database to create the Function.
name Changes to this property will trigger replacement. String
The name of the function.
ownerName String
The owner of the function.
ownerType String
The owner type. can be one of USER, ROLE, and GROUP.
resourceUris List<UserDefinedFunctionResourceUri>
The configuration block for Resource URIs. See resource uris below for more details.
arn string
The ARN of the Glue User Defined Function.
catalogId Changes to this property will trigger replacement. string
ID of the Glue Catalog to create the function in. If omitted, this defaults to the AWS Account ID.
className string
The Java class that contains the function code.
createTime string
The time at which the function was created.
databaseName Changes to this property will trigger replacement. string
The name of the Database to create the Function.
name Changes to this property will trigger replacement. string
The name of the function.
ownerName string
The owner of the function.
ownerType string
The owner type. can be one of USER, ROLE, and GROUP.
resourceUris UserDefinedFunctionResourceUri[]
The configuration block for Resource URIs. See resource uris below for more details.
arn str
The ARN of the Glue User Defined Function.
catalog_id Changes to this property will trigger replacement. str
ID of the Glue Catalog to create the function in. If omitted, this defaults to the AWS Account ID.
class_name str
The Java class that contains the function code.
create_time str
The time at which the function was created.
database_name Changes to this property will trigger replacement. str
The name of the Database to create the Function.
name Changes to this property will trigger replacement. str
The name of the function.
owner_name str
The owner of the function.
owner_type str
The owner type. can be one of USER, ROLE, and GROUP.
resource_uris Sequence[UserDefinedFunctionResourceUriArgs]
The configuration block for Resource URIs. See resource uris below for more details.
arn String
The ARN of the Glue User Defined Function.
catalogId Changes to this property will trigger replacement. String
ID of the Glue Catalog to create the function in. If omitted, this defaults to the AWS Account ID.
className String
The Java class that contains the function code.
createTime String
The time at which the function was created.
databaseName Changes to this property will trigger replacement. String
The name of the Database to create the Function.
name Changes to this property will trigger replacement. String
The name of the function.
ownerName String
The owner of the function.
ownerType String
The owner type. can be one of USER, ROLE, and GROUP.
resourceUris List<Property Map>
The configuration block for Resource URIs. See resource uris below for more details.

Supporting Types

UserDefinedFunctionResourceUri
, UserDefinedFunctionResourceUriArgs

ResourceType This property is required. string
The type of the resource. can be one of JAR, FILE, and ARCHIVE.
Uri This property is required. string
The URI for accessing the resource.
ResourceType This property is required. string
The type of the resource. can be one of JAR, FILE, and ARCHIVE.
Uri This property is required. string
The URI for accessing the resource.
resourceType This property is required. String
The type of the resource. can be one of JAR, FILE, and ARCHIVE.
uri This property is required. String
The URI for accessing the resource.
resourceType This property is required. string
The type of the resource. can be one of JAR, FILE, and ARCHIVE.
uri This property is required. string
The URI for accessing the resource.
resource_type This property is required. str
The type of the resource. can be one of JAR, FILE, and ARCHIVE.
uri This property is required. str
The URI for accessing the resource.
resourceType This property is required. String
The type of the resource. can be one of JAR, FILE, and ARCHIVE.
uri This property is required. String
The URI for accessing the resource.

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:

$ pulumi import aws:glue/userDefinedFunction:UserDefinedFunction func 123456789012:my_database:my_func
Copy

To learn more about importing existing cloud resources, see Importing resources.

Package Details

Repository
AWS Classic pulumi/pulumi-aws
License
Apache-2.0
Notes
This Pulumi package is based on the aws Terraform Provider.