1. Packages
  2. Databricks
  3. API Docs
  4. getMetastores
Databricks v1.56.0 published on Tuesday, Nov 12, 2024 by Pulumi

databricks.getMetastores

Explore with Pulumi AI

databricks logo
Databricks v1.56.0 published on Tuesday, Nov 12, 2024 by Pulumi

    Note This data source can only be used with an account-level provider!

    Retrieves a mapping of name to id of databricks.Metastore objects, that were created by Pulumi or manually, so that special handling could be applied.

    Note account_id provider configuration property is required for this resource to work. Data resource will error in case of metastores with duplicate names. This data source is only available for users & service principals with account admin status

    Example Usage

    Mapping of name to id of all metastores:

    import * as pulumi from "@pulumi/pulumi";
    import * as databricks from "@pulumi/databricks";
    
    const all = databricks.getMetastores({});
    export const allMetastores = all.then(all => all.ids);
    
    import pulumi
    import pulumi_databricks as databricks
    
    all = databricks.get_metastores()
    pulumi.export("allMetastores", all.ids)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-databricks/sdk/go/databricks"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		all, err := databricks.GetMetastores(ctx, &databricks.GetMetastoresArgs{}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("allMetastores", all.Ids)
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Databricks = Pulumi.Databricks;
    
    return await Deployment.RunAsync(() => 
    {
        var all = Databricks.GetMetastores.Invoke();
    
        return new Dictionary<string, object?>
        {
            ["allMetastores"] = all.Apply(getMetastoresResult => getMetastoresResult.Ids),
        };
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.databricks.DatabricksFunctions;
    import com.pulumi.databricks.inputs.GetMetastoresArgs;
    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) {
            final var all = DatabricksFunctions.getMetastores();
    
            ctx.export("allMetastores", all.applyValue(getMetastoresResult -> getMetastoresResult.ids()));
        }
    }
    
    variables:
      all:
        fn::invoke:
          Function: databricks:getMetastores
          Arguments: {}
    outputs:
      allMetastores: ${all.ids}
    

    The following resources are used in the same context:

    • databricks.Metastore to get information about a single metastore.
    • databricks.Metastore to manage Metastores within Unity Catalog.
    • databricks.Catalog to manage catalogs within Unity Catalog.

    Using getMetastores

    Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

    function getMetastores(args: GetMetastoresArgs, opts?: InvokeOptions): Promise<GetMetastoresResult>
    function getMetastoresOutput(args: GetMetastoresOutputArgs, opts?: InvokeOptions): Output<GetMetastoresResult>
    def get_metastores(ids: Optional[Mapping[str, str]] = None,
                       opts: Optional[InvokeOptions] = None) -> GetMetastoresResult
    def get_metastores_output(ids: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
                       opts: Optional[InvokeOptions] = None) -> Output[GetMetastoresResult]
    func GetMetastores(ctx *Context, args *GetMetastoresArgs, opts ...InvokeOption) (*GetMetastoresResult, error)
    func GetMetastoresOutput(ctx *Context, args *GetMetastoresOutputArgs, opts ...InvokeOption) GetMetastoresResultOutput

    > Note: This function is named GetMetastores in the Go SDK.

    public static class GetMetastores 
    {
        public static Task<GetMetastoresResult> InvokeAsync(GetMetastoresArgs args, InvokeOptions? opts = null)
        public static Output<GetMetastoresResult> Invoke(GetMetastoresInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetMetastoresResult> getMetastores(GetMetastoresArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: databricks:index/getMetastores:getMetastores
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Ids Dictionary<string, string>
    Mapping of name to id of databricks_metastore
    Ids map[string]string
    Mapping of name to id of databricks_metastore
    ids Map<String,String>
    Mapping of name to id of databricks_metastore
    ids {[key: string]: string}
    Mapping of name to id of databricks_metastore
    ids Mapping[str, str]
    Mapping of name to id of databricks_metastore
    ids Map<String>
    Mapping of name to id of databricks_metastore

    getMetastores Result

    The following output properties are available:

    Id string
    The provider-assigned unique ID for this managed resource.
    Ids Dictionary<string, string>
    Mapping of name to id of databricks_metastore
    Id string
    The provider-assigned unique ID for this managed resource.
    Ids map[string]string
    Mapping of name to id of databricks_metastore
    id String
    The provider-assigned unique ID for this managed resource.
    ids Map<String,String>
    Mapping of name to id of databricks_metastore
    id string
    The provider-assigned unique ID for this managed resource.
    ids {[key: string]: string}
    Mapping of name to id of databricks_metastore
    id str
    The provider-assigned unique ID for this managed resource.
    ids Mapping[str, str]
    Mapping of name to id of databricks_metastore
    id String
    The provider-assigned unique ID for this managed resource.
    ids Map<String>
    Mapping of name to id of databricks_metastore

    Package Details

    Repository
    databricks pulumi/pulumi-databricks
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the databricks Terraform Provider.
    databricks logo
    Databricks v1.56.0 published on Tuesday, Nov 12, 2024 by Pulumi