1. Packages
  2. HashiCorp Vault
  3. API Docs
  4. getNamespace
HashiCorp Vault v6.3.0 published on Thursday, Aug 8, 2024 by Pulumi

vault.getNamespace

Explore with Pulumi AI

vault logo
HashiCorp Vault v6.3.0 published on Thursday, Aug 8, 2024 by Pulumi

    Example Usage

    Current namespace

    import * as pulumi from "@pulumi/pulumi";
    import * as vault from "@pulumi/vault";
    
    const current = vault.getNamespace({});
    
    import pulumi
    import pulumi_vault as vault
    
    current = vault.get_namespace()
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-vault/sdk/v6/go/vault"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := vault.LookupNamespace(ctx, nil, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Vault = Pulumi.Vault;
    
    return await Deployment.RunAsync(() => 
    {
        var current = Vault.GetNamespace.Invoke();
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.vault.VaultFunctions;
    import com.pulumi.vault.inputs.GetNamespaceArgs;
    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 current = VaultFunctions.getNamespace();
    
        }
    }
    
    variables:
      current:
        fn::invoke:
          Function: vault:getNamespace
          Arguments: {}
    

    Single namespace

    import * as pulumi from "@pulumi/pulumi";
    import * as vault from "@pulumi/vault";
    
    const ns1 = vault.getNamespace({
        path: "ns1",
    });
    
    import pulumi
    import pulumi_vault as vault
    
    ns1 = vault.get_namespace(path="ns1")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-vault/sdk/v6/go/vault"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := vault.LookupNamespace(ctx, &vault.LookupNamespaceArgs{
    			Path: pulumi.StringRef("ns1"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Vault = Pulumi.Vault;
    
    return await Deployment.RunAsync(() => 
    {
        var ns1 = Vault.GetNamespace.Invoke(new()
        {
            Path = "ns1",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.vault.VaultFunctions;
    import com.pulumi.vault.inputs.GetNamespaceArgs;
    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 ns1 = VaultFunctions.getNamespace(GetNamespaceArgs.builder()
                .path("ns1")
                .build());
    
        }
    }
    
    variables:
      ns1:
        fn::invoke:
          Function: vault:getNamespace
          Arguments:
            path: ns1
    

    Nested namespace

    import * as pulumi from "@pulumi/pulumi";
    import * as vault from "@pulumi/vault";
    
    const child = vault.getNamespace({
        namespace: "parent",
        path: "child",
    });
    const fullPath = child.then(child => child.id);
    // -> foo/parent/child/
    const pathFq = child.then(child => child.pathFq);
    
    import pulumi
    import pulumi_vault as vault
    
    child = vault.get_namespace(namespace="parent",
        path="child")
    full_path = child.id
    # -> foo/parent/child/
    path_fq = child.path_fq
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-vault/sdk/v6/go/vault"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		child, err := vault.LookupNamespace(ctx, &vault.LookupNamespaceArgs{
    			Namespace: pulumi.StringRef("parent"),
    			Path:      pulumi.StringRef("child"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		_ := child.Id
    		// -> foo/parent/child/
    		_ := child.PathFq
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Vault = Pulumi.Vault;
    
    return await Deployment.RunAsync(() => 
    {
        var child = Vault.GetNamespace.Invoke(new()
        {
            Namespace = "parent",
            Path = "child",
        });
    
        var fullPath = child.Apply(getNamespaceResult => getNamespaceResult.Id);
    
        // -> foo/parent/child/
        var pathFq = child.Apply(getNamespaceResult => getNamespaceResult.PathFq);
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.vault.VaultFunctions;
    import com.pulumi.vault.inputs.GetNamespaceArgs;
    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 child = VaultFunctions.getNamespace(GetNamespaceArgs.builder()
                .namespace("parent")
                .path("child")
                .build());
    
            final var fullPath = child.applyValue(getNamespaceResult -> getNamespaceResult.id());
    
            // -> foo/parent/child/
            final var pathFq = child.applyValue(getNamespaceResult -> getNamespaceResult.pathFq());
    
        }
    }
    
    variables:
      child:
        fn::invoke:
          Function: vault:getNamespace
          Arguments:
            namespace: parent
            path: child
      fullPath: ${child.id}
      # -> foo/parent/child/
      pathFq: ${child.pathFq}
    

    Using getNamespace

    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 getNamespace(args: GetNamespaceArgs, opts?: InvokeOptions): Promise<GetNamespaceResult>
    function getNamespaceOutput(args: GetNamespaceOutputArgs, opts?: InvokeOptions): Output<GetNamespaceResult>
    def get_namespace(namespace: Optional[str] = None,
                      path: Optional[str] = None,
                      opts: Optional[InvokeOptions] = None) -> GetNamespaceResult
    def get_namespace_output(namespace: Optional[pulumi.Input[str]] = None,
                      path: Optional[pulumi.Input[str]] = None,
                      opts: Optional[InvokeOptions] = None) -> Output[GetNamespaceResult]
    func LookupNamespace(ctx *Context, args *LookupNamespaceArgs, opts ...InvokeOption) (*LookupNamespaceResult, error)
    func LookupNamespaceOutput(ctx *Context, args *LookupNamespaceOutputArgs, opts ...InvokeOption) LookupNamespaceResultOutput

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

    public static class GetNamespace 
    {
        public static Task<GetNamespaceResult> InvokeAsync(GetNamespaceArgs args, InvokeOptions? opts = null)
        public static Output<GetNamespaceResult> Invoke(GetNamespaceInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetNamespaceResult> getNamespace(GetNamespaceArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: vault:index/getNamespace:getNamespace
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Namespace string
    The namespace to provision the resource in. The value should not contain leading or trailing forward slashes. The namespace is always relative to the provider's configured namespace.
    Path string
    The path of the namespace. Must not have a trailing /. If not specified or empty, path attributes are set for the current namespace based on the namespace arguments of the provider and this data source. Other path related attributes will be empty in this case.
    Namespace string
    The namespace to provision the resource in. The value should not contain leading or trailing forward slashes. The namespace is always relative to the provider's configured namespace.
    Path string
    The path of the namespace. Must not have a trailing /. If not specified or empty, path attributes are set for the current namespace based on the namespace arguments of the provider and this data source. Other path related attributes will be empty in this case.
    namespace String
    The namespace to provision the resource in. The value should not contain leading or trailing forward slashes. The namespace is always relative to the provider's configured namespace.
    path String
    The path of the namespace. Must not have a trailing /. If not specified or empty, path attributes are set for the current namespace based on the namespace arguments of the provider and this data source. Other path related attributes will be empty in this case.
    namespace string
    The namespace to provision the resource in. The value should not contain leading or trailing forward slashes. The namespace is always relative to the provider's configured namespace.
    path string
    The path of the namespace. Must not have a trailing /. If not specified or empty, path attributes are set for the current namespace based on the namespace arguments of the provider and this data source. Other path related attributes will be empty in this case.
    namespace str
    The namespace to provision the resource in. The value should not contain leading or trailing forward slashes. The namespace is always relative to the provider's configured namespace.
    path str
    The path of the namespace. Must not have a trailing /. If not specified or empty, path attributes are set for the current namespace based on the namespace arguments of the provider and this data source. Other path related attributes will be empty in this case.
    namespace String
    The namespace to provision the resource in. The value should not contain leading or trailing forward slashes. The namespace is always relative to the provider's configured namespace.
    path String
    The path of the namespace. Must not have a trailing /. If not specified or empty, path attributes are set for the current namespace based on the namespace arguments of the provider and this data source. Other path related attributes will be empty in this case.

    getNamespace Result

    The following output properties are available:

    CustomMetadata Dictionary<string, object>
    (Optional) A map of strings containing arbitrary metadata for the namespace. Only fetched if path is specified. Requires Vault 1.12+.
    Id string
    The provider-assigned unique ID for this managed resource.
    NamespaceId string
    Vault server's internal ID of the namespace. Only fetched if path is specified.
    PathFq string
    The fully qualified path to the namespace. Useful when provisioning resources in a child namespace. The path is relative to the provider's namespace argument.
    Namespace string
    Path string
    CustomMetadata map[string]interface{}
    (Optional) A map of strings containing arbitrary metadata for the namespace. Only fetched if path is specified. Requires Vault 1.12+.
    Id string
    The provider-assigned unique ID for this managed resource.
    NamespaceId string
    Vault server's internal ID of the namespace. Only fetched if path is specified.
    PathFq string
    The fully qualified path to the namespace. Useful when provisioning resources in a child namespace. The path is relative to the provider's namespace argument.
    Namespace string
    Path string
    customMetadata Map<String,Object>
    (Optional) A map of strings containing arbitrary metadata for the namespace. Only fetched if path is specified. Requires Vault 1.12+.
    id String
    The provider-assigned unique ID for this managed resource.
    namespaceId String
    Vault server's internal ID of the namespace. Only fetched if path is specified.
    pathFq String
    The fully qualified path to the namespace. Useful when provisioning resources in a child namespace. The path is relative to the provider's namespace argument.
    namespace String
    path String
    customMetadata {[key: string]: any}
    (Optional) A map of strings containing arbitrary metadata for the namespace. Only fetched if path is specified. Requires Vault 1.12+.
    id string
    The provider-assigned unique ID for this managed resource.
    namespaceId string
    Vault server's internal ID of the namespace. Only fetched if path is specified.
    pathFq string
    The fully qualified path to the namespace. Useful when provisioning resources in a child namespace. The path is relative to the provider's namespace argument.
    namespace string
    path string
    custom_metadata Mapping[str, Any]
    (Optional) A map of strings containing arbitrary metadata for the namespace. Only fetched if path is specified. Requires Vault 1.12+.
    id str
    The provider-assigned unique ID for this managed resource.
    namespace_id str
    Vault server's internal ID of the namespace. Only fetched if path is specified.
    path_fq str
    The fully qualified path to the namespace. Useful when provisioning resources in a child namespace. The path is relative to the provider's namespace argument.
    namespace str
    path str
    customMetadata Map<Any>
    (Optional) A map of strings containing arbitrary metadata for the namespace. Only fetched if path is specified. Requires Vault 1.12+.
    id String
    The provider-assigned unique ID for this managed resource.
    namespaceId String
    Vault server's internal ID of the namespace. Only fetched if path is specified.
    pathFq String
    The fully qualified path to the namespace. Useful when provisioning resources in a child namespace. The path is relative to the provider's namespace argument.
    namespace String
    path String

    Package Details

    Repository
    Vault pulumi/pulumi-vault
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the vault Terraform Provider.
    vault logo
    HashiCorp Vault v6.3.0 published on Thursday, Aug 8, 2024 by Pulumi