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

com.pulumi.gcp.dataproc.kotlin.MetastoreFederation.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: 8.10.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.gcp.dataproc.kotlin

import com.pulumi.core.Output
import com.pulumi.gcp.dataproc.kotlin.outputs.MetastoreFederationBackendMetastore
import com.pulumi.gcp.dataproc.kotlin.outputs.MetastoreFederationBackendMetastore.Companion.toKotlin
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
import kotlin.collections.Map

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

    public var args: MetastoreFederationArgs = MetastoreFederationArgs()

    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 MetastoreFederationArgsBuilder.() -> Unit) {
        val builder = MetastoreFederationArgsBuilder()
        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(): MetastoreFederation {
        val builtJavaResource = com.pulumi.gcp.dataproc.MetastoreFederation(
            this.name,
            this.args.toJava(),
            this.opts.toJava(),
        )
        return MetastoreFederation(builtJavaResource)
    }
}

/**
 * A managed metastore federation.
 * ## Example Usage
 * ### Dataproc Metastore Federation Basic
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const defaultMetastoreService = new gcp.dataproc.MetastoreService("default", {
 *     serviceId: "",
 *     location: "us-central1",
 *     tier: "DEVELOPER",
 *     hiveMetastoreConfig: {
 *         version: "3.1.2",
 *         endpointProtocol: "GRPC",
 *     },
 * });
 * const _default = new gcp.dataproc.MetastoreFederation("default", {
 *     location: "us-central1",
 *     federationId: "",
 *     version: "3.1.2",
 *     backendMetastores: [{
 *         rank: "1",
 *         name: defaultMetastoreService.id,
 *         metastoreType: "DATAPROC_METASTORE",
 *     }],
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * default_metastore_service = gcp.dataproc.MetastoreService("default",
 *     service_id="",
 *     location="us-central1",
 *     tier="DEVELOPER",
 *     hive_metastore_config=gcp.dataproc.MetastoreServiceHiveMetastoreConfigArgs(
 *         version="3.1.2",
 *         endpoint_protocol="GRPC",
 *     ))
 * default = gcp.dataproc.MetastoreFederation("default",
 *     location="us-central1",
 *     federation_id="",
 *     version="3.1.2",
 *     backend_metastores=[gcp.dataproc.MetastoreFederationBackendMetastoreArgs(
 *         rank="1",
 *         name=default_metastore_service.id,
 *         metastore_type="DATAPROC_METASTORE",
 *     )])
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var defaultMetastoreService = new Gcp.Dataproc.MetastoreService("default", new()
 *     {
 *         ServiceId = "",
 *         Location = "us-central1",
 *         Tier = "DEVELOPER",
 *         HiveMetastoreConfig = new Gcp.Dataproc.Inputs.MetastoreServiceHiveMetastoreConfigArgs
 *         {
 *             Version = "3.1.2",
 *             EndpointProtocol = "GRPC",
 *         },
 *     });
 *     var @default = new Gcp.Dataproc.MetastoreFederation("default", new()
 *     {
 *         Location = "us-central1",
 *         FederationId = "",
 *         Version = "3.1.2",
 *         BackendMetastores = new[]
 *         {
 *             new Gcp.Dataproc.Inputs.MetastoreFederationBackendMetastoreArgs
 *             {
 *                 Rank = "1",
 *                 Name = defaultMetastoreService.Id,
 *                 MetastoreType = "DATAPROC_METASTORE",
 *             },
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/dataproc"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		defaultMetastoreService, err := dataproc.NewMetastoreService(ctx, "default", &dataproc.MetastoreServiceArgs{
 * 			ServiceId: pulumi.String(""),
 * 			Location:  pulumi.String("us-central1"),
 * 			Tier:      pulumi.String("DEVELOPER"),
 * 			HiveMetastoreConfig: &dataproc.MetastoreServiceHiveMetastoreConfigArgs{
 * 				Version:          pulumi.String("3.1.2"),
 * 				EndpointProtocol: pulumi.String("GRPC"),
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = dataproc.NewMetastoreFederation(ctx, "default", &dataproc.MetastoreFederationArgs{
 * 			Location:     pulumi.String("us-central1"),
 * 			FederationId: pulumi.String(""),
 * 			Version:      pulumi.String("3.1.2"),
 * 			BackendMetastores: dataproc.MetastoreFederationBackendMetastoreArray{
 * 				&dataproc.MetastoreFederationBackendMetastoreArgs{
 * 					Rank:          pulumi.String("1"),
 * 					Name:          defaultMetastoreService.ID(),
 * 					MetastoreType: pulumi.String("DATAPROC_METASTORE"),
 * 				},
 * 			},
 * 		})
 * 		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.gcp.dataproc.MetastoreService;
 * import com.pulumi.gcp.dataproc.MetastoreServiceArgs;
 * import com.pulumi.gcp.dataproc.inputs.MetastoreServiceHiveMetastoreConfigArgs;
 * import com.pulumi.gcp.dataproc.MetastoreFederation;
 * import com.pulumi.gcp.dataproc.MetastoreFederationArgs;
 * import com.pulumi.gcp.dataproc.inputs.MetastoreFederationBackendMetastoreArgs;
 * 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 defaultMetastoreService = new MetastoreService("defaultMetastoreService", MetastoreServiceArgs.builder()
 *             .serviceId("")
 *             .location("us-central1")
 *             .tier("DEVELOPER")
 *             .hiveMetastoreConfig(MetastoreServiceHiveMetastoreConfigArgs.builder()
 *                 .version("3.1.2")
 *                 .endpointProtocol("GRPC")
 *                 .build())
 *             .build());
 *         var default_ = new MetastoreFederation("default", MetastoreFederationArgs.builder()
 *             .location("us-central1")
 *             .federationId("")
 *             .version("3.1.2")
 *             .backendMetastores(MetastoreFederationBackendMetastoreArgs.builder()
 *                 .rank("1")
 *                 .name(defaultMetastoreService.id())
 *                 .metastoreType("DATAPROC_METASTORE")
 *                 .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   default:
 *     type: gcp:dataproc:MetastoreFederation
 *     properties:
 *       location: us-central1
 *       federationId:
 *       version: 3.1.2
 *       backendMetastores:
 *         - rank: '1'
 *           name: ${defaultMetastoreService.id}
 *           metastoreType: DATAPROC_METASTORE
 *   defaultMetastoreService:
 *     type: gcp:dataproc:MetastoreService
 *     name: default
 *     properties:
 *       serviceId:
 *       location: us-central1
 *       tier: DEVELOPER
 *       hiveMetastoreConfig:
 *         version: 3.1.2
 *         endpointProtocol: GRPC
 * ```
 * 
 * ### Dataproc Metastore Federation Bigquery
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const defaultMetastoreService = new gcp.dataproc.MetastoreService("default", {
 *     serviceId: "",
 *     location: "us-central1",
 *     tier: "DEVELOPER",
 *     hiveMetastoreConfig: {
 *         version: "3.1.2",
 *         endpointProtocol: "GRPC",
 *     },
 * });
 * const project = gcp.organizations.getProject({});
 * const _default = new gcp.dataproc.MetastoreFederation("default", {
 *     location: "us-central1",
 *     federationId: "",
 *     version: "3.1.2",
 *     backendMetastores: [
 *         {
 *             rank: "2",
 *             name: project.then(project => project.id),
 *             metastoreType: "BIGQUERY",
 *         },
 *         {
 *             rank: "1",
 *             name: defaultMetastoreService.id,
 *             metastoreType: "DATAPROC_METASTORE",
 *         },
 *     ],
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * default_metastore_service = gcp.dataproc.MetastoreService("default",
 *     service_id="",
 *     location="us-central1",
 *     tier="DEVELOPER",
 *     hive_metastore_config=gcp.dataproc.MetastoreServiceHiveMetastoreConfigArgs(
 *         version="3.1.2",
 *         endpoint_protocol="GRPC",
 *     ))
 * project = gcp.organizations.get_project()
 * default = gcp.dataproc.MetastoreFederation("default",
 *     location="us-central1",
 *     federation_id="",
 *     version="3.1.2",
 *     backend_metastores=[
 *         gcp.dataproc.MetastoreFederationBackendMetastoreArgs(
 *             rank="2",
 *             name=project.id,
 *             metastore_type="BIGQUERY",
 *         ),
 *         gcp.dataproc.MetastoreFederationBackendMetastoreArgs(
 *             rank="1",
 *             name=default_metastore_service.id,
 *             metastore_type="DATAPROC_METASTORE",
 *         ),
 *     ])
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var defaultMetastoreService = new Gcp.Dataproc.MetastoreService("default", new()
 *     {
 *         ServiceId = "",
 *         Location = "us-central1",
 *         Tier = "DEVELOPER",
 *         HiveMetastoreConfig = new Gcp.Dataproc.Inputs.MetastoreServiceHiveMetastoreConfigArgs
 *         {
 *             Version = "3.1.2",
 *             EndpointProtocol = "GRPC",
 *         },
 *     });
 *     var project = Gcp.Organizations.GetProject.Invoke();
 *     var @default = new Gcp.Dataproc.MetastoreFederation("default", new()
 *     {
 *         Location = "us-central1",
 *         FederationId = "",
 *         Version = "3.1.2",
 *         BackendMetastores = new[]
 *         {
 *             new Gcp.Dataproc.Inputs.MetastoreFederationBackendMetastoreArgs
 *             {
 *                 Rank = "2",
 *                 Name = project.Apply(getProjectResult => getProjectResult.Id),
 *                 MetastoreType = "BIGQUERY",
 *             },
 *             new Gcp.Dataproc.Inputs.MetastoreFederationBackendMetastoreArgs
 *             {
 *                 Rank = "1",
 *                 Name = defaultMetastoreService.Id,
 *                 MetastoreType = "DATAPROC_METASTORE",
 *             },
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/dataproc"
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/organizations"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		defaultMetastoreService, err := dataproc.NewMetastoreService(ctx, "default", &dataproc.MetastoreServiceArgs{
 * 			ServiceId: pulumi.String(""),
 * 			Location:  pulumi.String("us-central1"),
 * 			Tier:      pulumi.String("DEVELOPER"),
 * 			HiveMetastoreConfig: &dataproc.MetastoreServiceHiveMetastoreConfigArgs{
 * 				Version:          pulumi.String("3.1.2"),
 * 				EndpointProtocol: pulumi.String("GRPC"),
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		project, err := organizations.LookupProject(ctx, nil, nil)
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = dataproc.NewMetastoreFederation(ctx, "default", &dataproc.MetastoreFederationArgs{
 * 			Location:     pulumi.String("us-central1"),
 * 			FederationId: pulumi.String(""),
 * 			Version:      pulumi.String("3.1.2"),
 * 			BackendMetastores: dataproc.MetastoreFederationBackendMetastoreArray{
 * 				&dataproc.MetastoreFederationBackendMetastoreArgs{
 * 					Rank:          pulumi.String("2"),
 * 					Name:          pulumi.String(project.Id),
 * 					MetastoreType: pulumi.String("BIGQUERY"),
 * 				},
 * 				&dataproc.MetastoreFederationBackendMetastoreArgs{
 * 					Rank:          pulumi.String("1"),
 * 					Name:          defaultMetastoreService.ID(),
 * 					MetastoreType: pulumi.String("DATAPROC_METASTORE"),
 * 				},
 * 			},
 * 		})
 * 		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.gcp.dataproc.MetastoreService;
 * import com.pulumi.gcp.dataproc.MetastoreServiceArgs;
 * import com.pulumi.gcp.dataproc.inputs.MetastoreServiceHiveMetastoreConfigArgs;
 * import com.pulumi.gcp.organizations.OrganizationsFunctions;
 * import com.pulumi.gcp.organizations.inputs.GetProjectArgs;
 * import com.pulumi.gcp.dataproc.MetastoreFederation;
 * import com.pulumi.gcp.dataproc.MetastoreFederationArgs;
 * import com.pulumi.gcp.dataproc.inputs.MetastoreFederationBackendMetastoreArgs;
 * 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 defaultMetastoreService = new MetastoreService("defaultMetastoreService", MetastoreServiceArgs.builder()
 *             .serviceId("")
 *             .location("us-central1")
 *             .tier("DEVELOPER")
 *             .hiveMetastoreConfig(MetastoreServiceHiveMetastoreConfigArgs.builder()
 *                 .version("3.1.2")
 *                 .endpointProtocol("GRPC")
 *                 .build())
 *             .build());
 *         final var project = OrganizationsFunctions.getProject();
 *         var default_ = new MetastoreFederation("default", MetastoreFederationArgs.builder()
 *             .location("us-central1")
 *             .federationId("")
 *             .version("3.1.2")
 *             .backendMetastores(
 *                 MetastoreFederationBackendMetastoreArgs.builder()
 *                     .rank("2")
 *                     .name(project.applyValue(getProjectResult -> getProjectResult.id()))
 *                     .metastoreType("BIGQUERY")
 *                     .build(),
 *                 MetastoreFederationBackendMetastoreArgs.builder()
 *                     .rank("1")
 *                     .name(defaultMetastoreService.id())
 *                     .metastoreType("DATAPROC_METASTORE")
 *                     .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   default:
 *     type: gcp:dataproc:MetastoreFederation
 *     properties:
 *       location: us-central1
 *       federationId:
 *       version: 3.1.2
 *       backendMetastores:
 *         - rank: '2'
 *           name: ${project.id}
 *           metastoreType: BIGQUERY
 *         - rank: '1'
 *           name: ${defaultMetastoreService.id}
 *           metastoreType: DATAPROC_METASTORE
 *   defaultMetastoreService:
 *     type: gcp:dataproc:MetastoreService
 *     name: default
 *     properties:
 *       serviceId:
 *       location: us-central1
 *       tier: DEVELOPER
 *       hiveMetastoreConfig:
 *         version: 3.1.2
 *         endpointProtocol: GRPC
 * variables:
 *   project:
 *     fn::invoke:
 *       Function: gcp:organizations:getProject
 *       Arguments: {}
 * ```
 * 
 * ## Import
 * Federation can be imported using any of these accepted formats:
 * * `projects/{{project}}/locations/{{location}}/federations/{{federation_id}}`
 * * `{{project}}/{{location}}/{{federation_id}}`
 * * `{{location}}/{{federation_id}}`
 * When using the `pulumi import` command, Federation can be imported using one of the formats above. For example:
 * ```sh
 * $ pulumi import gcp:dataproc/metastoreFederation:MetastoreFederation default projects/{{project}}/locations/{{location}}/federations/{{federation_id}}
 * ```
 * ```sh
 * $ pulumi import gcp:dataproc/metastoreFederation:MetastoreFederation default {{project}}/{{location}}/{{federation_id}}
 * ```
 * ```sh
 * $ pulumi import gcp:dataproc/metastoreFederation:MetastoreFederation default {{location}}/{{federation_id}}
 * ```
 */
public class MetastoreFederation internal constructor(
    override val javaResource: com.pulumi.gcp.dataproc.MetastoreFederation,
) : KotlinCustomResource(javaResource, MetastoreFederationMapper) {
    /**
     * A map from BackendMetastore rank to BackendMetastores from which the federation service serves metadata at query time. The map key represents the order in which BackendMetastores should be evaluated to resolve database names at query time and should be greater than or equal to zero. A BackendMetastore with a lower number will be evaluated before a BackendMetastore with a higher number.
     * Structure is documented below.
     */
    public val backendMetastores: Output>
        get() = javaResource.backendMetastores().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> toKotlin(args0) })
            })
        })

    /**
     * All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services.
     */
    public val effectiveLabels: Output>
        get() = javaResource.effectiveLabels().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.key.to(args0.value)
            }).toMap()
        })

    /**
     * The URI of the endpoint used to access the metastore federation.
     */
    public val endpointUri: Output
        get() = javaResource.endpointUri().applyValue({ args0 -> args0 })

    /**
     * The ID of the metastore federation. The id must contain only letters (a-z, A-Z), numbers (0-9), underscores (_),
     * and hyphens (-). Cannot begin or end with underscore or hyphen. Must consist of between
     * 3 and 63 characters.
     */
    public val federationId: Output
        get() = javaResource.federationId().applyValue({ args0 -> args0 })

    /**
     * User-defined labels for the metastore federation. **Note**: This field is non-authoritative, and will only manage the
     * labels present in your configuration. Please refer to the field 'effective_labels' for all of the labels present on the
     * resource.
     */
    public val labels: Output>?
        get() = javaResource.labels().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.key.to(args0.value)
                }).toMap()
            }).orElse(null)
        })

    /**
     * The location where the metastore federation should reside.
     */
    public val location: Output?
        get() = javaResource.location().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

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

    public val project: Output
        get() = javaResource.project().applyValue({ args0 -> args0 })

    /**
     * The combination of labels configured directly on the resource
     * and default labels configured on the provider.
     */
    public val pulumiLabels: Output>
        get() = javaResource.pulumiLabels().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.key.to(args0.value)
            }).toMap()
        })

    /**
     * The current state of the metastore federation.
     */
    public val state: Output
        get() = javaResource.state().applyValue({ args0 -> args0 })

    /**
     * Additional information about the current state of the metastore federation, if available.
     */
    public val stateMessage: Output
        get() = javaResource.stateMessage().applyValue({ args0 -> args0 })

    /**
     * The globally unique resource identifier of the metastore federation.
     */
    public val uid: Output
        get() = javaResource.uid().applyValue({ args0 -> args0 })

    /**
     * The Apache Hive metastore version of the federation. All backend metastore versions must be compatible with the federation version.
     */
    public val version: Output
        get() = javaResource.version().applyValue({ args0 -> args0 })
}

public object MetastoreFederationMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.gcp.dataproc.MetastoreFederation::class == javaResource::class

    override fun map(javaResource: Resource): MetastoreFederation = MetastoreFederation(
        javaResource
            as com.pulumi.gcp.dataproc.MetastoreFederation,
    )
}

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy