1. Packages
  2. HashiCorp Vault
  3. API Docs
  4. getNamespaces
HashiCorp Vault v6.1.0 published on Thursday, Apr 4, 2024 by Pulumi

vault.getNamespaces

Explore with Pulumi AI

vault logo
HashiCorp Vault v6.1.0 published on Thursday, Apr 4, 2024 by Pulumi

    Example Usage

    Child namespaces

    import * as pulumi from "@pulumi/pulumi";
    import * as vault from "@pulumi/vault";
    
    const children = vault.getNamespaces({});
    
    import pulumi
    import pulumi_vault as vault
    
    children = vault.get_namespaces()
    
    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.GetNamespaces(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 children = Vault.GetNamespaces.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.GetNamespacesArgs;
    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 children = VaultFunctions.getNamespaces();
    
        }
    }
    
    variables:
      children:
        fn::invoke:
          Function: vault:getNamespaces
          Arguments: {}
    

    Nested namespace

    To fetch the details of nested namespaces:

    import * as pulumi from "@pulumi/pulumi";
    import * as vault from "@pulumi/vault";
    
    const children = vault.getNamespaces({
        namespace: "parent",
    });
    const child = .map(([, ]) => (vault.getNamespace({
        namespace: _arg0_.namespace,
        path: __key,
    })));
    
    import pulumi
    import pulumi_vault as vault
    
    children = vault.get_namespaces(namespace="parent")
    child = [vault.get_namespace(namespace=children.namespace,
        path=__key) for __key, __value in children.paths]
    
    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 {
    		children, err := vault.GetNamespaces(ctx, &vault.GetNamespacesArgs{
    			Namespace: pulumi.StringRef("parent"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		_ := "TODO: For expression"
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Vault = Pulumi.Vault;
    
    return await Deployment.RunAsync(() => 
    {
        var children = Vault.GetNamespaces.Invoke(new()
        {
            Namespace = "parent",
        });
    
        var child = .Select(__value => 
        {
            return Vault.GetNamespace.Invoke(new()
            {
                Namespace = _arg0_.Namespace,
                Path = __key,
            });
        }).ToList();
    
    });
    
    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.GetNamespacesArgs;
    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 children = VaultFunctions.getNamespaces(GetNamespacesArgs.builder()
                .namespace("parent")
                .build());
    
            final var child = "TODO: ForExpression";
    
        }
    }
    
    Coming soon!
    

    Using getNamespaces

    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 getNamespaces(args: GetNamespacesArgs, opts?: InvokeOptions): Promise<GetNamespacesResult>
    function getNamespacesOutput(args: GetNamespacesOutputArgs, opts?: InvokeOptions): Output<GetNamespacesResult>
    def get_namespaces(namespace: Optional[str] = None,
                       opts: Optional[InvokeOptions] = None) -> GetNamespacesResult
    def get_namespaces_output(namespace: Optional[pulumi.Input[str]] = None,
                       opts: Optional[InvokeOptions] = None) -> Output[GetNamespacesResult]
    func GetNamespaces(ctx *Context, args *GetNamespacesArgs, opts ...InvokeOption) (*GetNamespacesResult, error)
    func GetNamespacesOutput(ctx *Context, args *GetNamespacesOutputArgs, opts ...InvokeOption) GetNamespacesResultOutput

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

    public static class GetNamespaces 
    {
        public static Task<GetNamespacesResult> InvokeAsync(GetNamespacesArgs args, InvokeOptions? opts = null)
        public static Output<GetNamespacesResult> Invoke(GetNamespacesInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetNamespacesResult> getNamespaces(GetNamespacesArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: vault:index/getNamespaces:getNamespaces
      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.
    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.
    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.
    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.
    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.
    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.

    getNamespaces Result

    The following output properties are available:

    Id string
    The provider-assigned unique ID for this managed resource.
    Paths List<string>
    Set of the paths of direct child namespaces.
    Namespace string
    Id string
    The provider-assigned unique ID for this managed resource.
    Paths []string
    Set of the paths of direct child namespaces.
    Namespace string
    id String
    The provider-assigned unique ID for this managed resource.
    paths List<String>
    Set of the paths of direct child namespaces.
    namespace String
    id string
    The provider-assigned unique ID for this managed resource.
    paths string[]
    Set of the paths of direct child namespaces.
    namespace string
    id str
    The provider-assigned unique ID for this managed resource.
    paths Sequence[str]
    Set of the paths of direct child namespaces.
    namespace str
    id String
    The provider-assigned unique ID for this managed resource.
    paths List<String>
    Set of the paths of direct child namespaces.
    namespace 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.1.0 published on Thursday, Apr 4, 2024 by Pulumi