1. Packages
  2. Google Cloud (GCP) Classic
  3. API Docs
  4. servicedirectory
  5. Namespace
Google Cloud Classic v7.29.0 published on Wednesday, Jun 26, 2024 by Pulumi

gcp.servicedirectory.Namespace

Explore with Pulumi AI

gcp logo
Google Cloud Classic v7.29.0 published on Wednesday, Jun 26, 2024 by Pulumi

    A container for services. Namespaces allow administrators to group services together and define permissions for a collection of services.

    To get more information about Namespace, see:

    Example Usage

    Service Directory Namespace Basic

    import * as pulumi from "@pulumi/pulumi";
    import * as gcp from "@pulumi/gcp";
    
    const example = new gcp.servicedirectory.Namespace("example", {
        namespaceId: "example-namespace",
        location: "us-central1",
        labels: {
            key: "value",
            foo: "bar",
        },
    });
    
    import pulumi
    import pulumi_gcp as gcp
    
    example = gcp.servicedirectory.Namespace("example",
        namespace_id="example-namespace",
        location="us-central1",
        labels={
            "key": "value",
            "foo": "bar",
        })
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/servicedirectory"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := servicedirectory.NewNamespace(ctx, "example", &servicedirectory.NamespaceArgs{
    			NamespaceId: pulumi.String("example-namespace"),
    			Location:    pulumi.String("us-central1"),
    			Labels: pulumi.StringMap{
    				"key": pulumi.String("value"),
    				"foo": pulumi.String("bar"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Gcp = Pulumi.Gcp;
    
    return await Deployment.RunAsync(() => 
    {
        var example = new Gcp.ServiceDirectory.Namespace("example", new()
        {
            NamespaceId = "example-namespace",
            Location = "us-central1",
            Labels = 
            {
                { "key", "value" },
                { "foo", "bar" },
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.gcp.servicedirectory.Namespace;
    import com.pulumi.gcp.servicedirectory.NamespaceArgs;
    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 Namespace("example", NamespaceArgs.builder()
                .namespaceId("example-namespace")
                .location("us-central1")
                .labels(Map.ofEntries(
                    Map.entry("key", "value"),
                    Map.entry("foo", "bar")
                ))
                .build());
    
        }
    }
    
    resources:
      example:
        type: gcp:servicedirectory:Namespace
        properties:
          namespaceId: example-namespace
          location: us-central1
          labels:
            key: value
            foo: bar
    

    Create Namespace Resource

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

    Constructor syntax

    new Namespace(name: string, args: NamespaceArgs, opts?: CustomResourceOptions);
    @overload
    def Namespace(resource_name: str,
                  args: NamespaceArgs,
                  opts: Optional[ResourceOptions] = None)
    
    @overload
    def Namespace(resource_name: str,
                  opts: Optional[ResourceOptions] = None,
                  location: Optional[str] = None,
                  namespace_id: Optional[str] = None,
                  labels: Optional[Mapping[str, str]] = None,
                  project: Optional[str] = None)
    func NewNamespace(ctx *Context, name string, args NamespaceArgs, opts ...ResourceOption) (*Namespace, error)
    public Namespace(string name, NamespaceArgs args, CustomResourceOptions? opts = null)
    public Namespace(String name, NamespaceArgs args)
    public Namespace(String name, NamespaceArgs args, CustomResourceOptions options)
    
    type: gcp:servicedirectory:Namespace
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args NamespaceArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args NamespaceArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args NamespaceArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args NamespaceArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args NamespaceArgs
    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 gcpNamespaceResource = new Gcp.ServiceDirectory.Namespace("gcpNamespaceResource", new()
    {
        Location = "string",
        NamespaceId = "string",
        Labels = 
        {
            { "string", "string" },
        },
        Project = "string",
    });
    
    example, err := servicedirectory.NewNamespace(ctx, "gcpNamespaceResource", &servicedirectory.NamespaceArgs{
    	Location:    pulumi.String("string"),
    	NamespaceId: pulumi.String("string"),
    	Labels: pulumi.StringMap{
    		"string": pulumi.String("string"),
    	},
    	Project: pulumi.String("string"),
    })
    
    var gcpNamespaceResource = new Namespace("gcpNamespaceResource", NamespaceArgs.builder()
        .location("string")
        .namespaceId("string")
        .labels(Map.of("string", "string"))
        .project("string")
        .build());
    
    gcp_namespace_resource = gcp.servicedirectory.Namespace("gcpNamespaceResource",
        location="string",
        namespace_id="string",
        labels={
            "string": "string",
        },
        project="string")
    
    const gcpNamespaceResource = new gcp.servicedirectory.Namespace("gcpNamespaceResource", {
        location: "string",
        namespaceId: "string",
        labels: {
            string: "string",
        },
        project: "string",
    });
    
    type: gcp:servicedirectory:Namespace
    properties:
        labels:
            string: string
        location: string
        namespaceId: string
        project: string
    

    Namespace Resource Properties

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

    Inputs

    The Namespace resource accepts the following input properties:

    Location string
    The location for the Namespace. A full list of valid locations can be found by running gcloud beta service-directory locations list.
    NamespaceId string
    The Resource ID must be 1-63 characters long, including digits, lowercase letters or the hyphen character.


    Labels Dictionary<string, string>

    Resource labels associated with this Namespace. No more than 64 user labels can be associated with a given resource. Label keys and values can be no longer than 63 characters.

    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.

    Project string
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    Location string
    The location for the Namespace. A full list of valid locations can be found by running gcloud beta service-directory locations list.
    NamespaceId string
    The Resource ID must be 1-63 characters long, including digits, lowercase letters or the hyphen character.


    Labels map[string]string

    Resource labels associated with this Namespace. No more than 64 user labels can be associated with a given resource. Label keys and values can be no longer than 63 characters.

    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.

    Project string
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    location String
    The location for the Namespace. A full list of valid locations can be found by running gcloud beta service-directory locations list.
    namespaceId String
    The Resource ID must be 1-63 characters long, including digits, lowercase letters or the hyphen character.


    labels Map<String,String>

    Resource labels associated with this Namespace. No more than 64 user labels can be associated with a given resource. Label keys and values can be no longer than 63 characters.

    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.

    project String
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    location string
    The location for the Namespace. A full list of valid locations can be found by running gcloud beta service-directory locations list.
    namespaceId string
    The Resource ID must be 1-63 characters long, including digits, lowercase letters or the hyphen character.


    labels {[key: string]: string}

    Resource labels associated with this Namespace. No more than 64 user labels can be associated with a given resource. Label keys and values can be no longer than 63 characters.

    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.

    project string
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    location str
    The location for the Namespace. A full list of valid locations can be found by running gcloud beta service-directory locations list.
    namespace_id str
    The Resource ID must be 1-63 characters long, including digits, lowercase letters or the hyphen character.


    labels Mapping[str, str]

    Resource labels associated with this Namespace. No more than 64 user labels can be associated with a given resource. Label keys and values can be no longer than 63 characters.

    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.

    project str
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    location String
    The location for the Namespace. A full list of valid locations can be found by running gcloud beta service-directory locations list.
    namespaceId String
    The Resource ID must be 1-63 characters long, including digits, lowercase letters or the hyphen character.


    labels Map<String>

    Resource labels associated with this Namespace. No more than 64 user labels can be associated with a given resource. Label keys and values can be no longer than 63 characters.

    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.

    project String
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

    Outputs

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

    EffectiveLabels Dictionary<string, string>
    All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services.
    Id string
    The provider-assigned unique ID for this managed resource.
    Name string
    The resource name for the namespace in the format projects/*/locations/*/namespaces/*.
    PulumiLabels Dictionary<string, string>
    The combination of labels configured directly on the resource and default labels configured on the provider.
    EffectiveLabels map[string]string
    All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services.
    Id string
    The provider-assigned unique ID for this managed resource.
    Name string
    The resource name for the namespace in the format projects/*/locations/*/namespaces/*.
    PulumiLabels map[string]string
    The combination of labels configured directly on the resource and default labels configured on the provider.
    effectiveLabels Map<String,String>
    All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services.
    id String
    The provider-assigned unique ID for this managed resource.
    name String
    The resource name for the namespace in the format projects/*/locations/*/namespaces/*.
    pulumiLabels Map<String,String>
    The combination of labels configured directly on the resource and default labels configured on the provider.
    effectiveLabels {[key: string]: string}
    All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services.
    id string
    The provider-assigned unique ID for this managed resource.
    name string
    The resource name for the namespace in the format projects/*/locations/*/namespaces/*.
    pulumiLabels {[key: string]: string}
    The combination of labels configured directly on the resource and default labels configured on the provider.
    effective_labels Mapping[str, str]
    All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services.
    id str
    The provider-assigned unique ID for this managed resource.
    name str
    The resource name for the namespace in the format projects/*/locations/*/namespaces/*.
    pulumi_labels Mapping[str, str]
    The combination of labels configured directly on the resource and default labels configured on the provider.
    effectiveLabels Map<String>
    All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services.
    id String
    The provider-assigned unique ID for this managed resource.
    name String
    The resource name for the namespace in the format projects/*/locations/*/namespaces/*.
    pulumiLabels Map<String>
    The combination of labels configured directly on the resource and default labels configured on the provider.

    Look up Existing Namespace Resource

    Get an existing Namespace 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?: NamespaceState, opts?: CustomResourceOptions): Namespace
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            effective_labels: Optional[Mapping[str, str]] = None,
            labels: Optional[Mapping[str, str]] = None,
            location: Optional[str] = None,
            name: Optional[str] = None,
            namespace_id: Optional[str] = None,
            project: Optional[str] = None,
            pulumi_labels: Optional[Mapping[str, str]] = None) -> Namespace
    func GetNamespace(ctx *Context, name string, id IDInput, state *NamespaceState, opts ...ResourceOption) (*Namespace, error)
    public static Namespace Get(string name, Input<string> id, NamespaceState? state, CustomResourceOptions? opts = null)
    public static Namespace get(String name, Output<String> id, NamespaceState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    name
    The unique name of the resulting resource.
    id
    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
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    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
    The unique name of the resulting resource.
    id
    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
    The unique name of the resulting resource.
    id
    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:
    EffectiveLabels Dictionary<string, string>
    All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services.
    Labels Dictionary<string, string>

    Resource labels associated with this Namespace. No more than 64 user labels can be associated with a given resource. Label keys and values can be no longer than 63 characters.

    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.

    Location string
    The location for the Namespace. A full list of valid locations can be found by running gcloud beta service-directory locations list.
    Name string
    The resource name for the namespace in the format projects/*/locations/*/namespaces/*.
    NamespaceId string
    The Resource ID must be 1-63 characters long, including digits, lowercase letters or the hyphen character.


    Project string
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    PulumiLabels Dictionary<string, string>
    The combination of labels configured directly on the resource and default labels configured on the provider.
    EffectiveLabels map[string]string
    All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services.
    Labels map[string]string

    Resource labels associated with this Namespace. No more than 64 user labels can be associated with a given resource. Label keys and values can be no longer than 63 characters.

    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.

    Location string
    The location for the Namespace. A full list of valid locations can be found by running gcloud beta service-directory locations list.
    Name string
    The resource name for the namespace in the format projects/*/locations/*/namespaces/*.
    NamespaceId string
    The Resource ID must be 1-63 characters long, including digits, lowercase letters or the hyphen character.


    Project string
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    PulumiLabels map[string]string
    The combination of labels configured directly on the resource and default labels configured on the provider.
    effectiveLabels Map<String,String>
    All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services.
    labels Map<String,String>

    Resource labels associated with this Namespace. No more than 64 user labels can be associated with a given resource. Label keys and values can be no longer than 63 characters.

    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.

    location String
    The location for the Namespace. A full list of valid locations can be found by running gcloud beta service-directory locations list.
    name String
    The resource name for the namespace in the format projects/*/locations/*/namespaces/*.
    namespaceId String
    The Resource ID must be 1-63 characters long, including digits, lowercase letters or the hyphen character.


    project String
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    pulumiLabels Map<String,String>
    The combination of labels configured directly on the resource and default labels configured on the provider.
    effectiveLabels {[key: string]: string}
    All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services.
    labels {[key: string]: string}

    Resource labels associated with this Namespace. No more than 64 user labels can be associated with a given resource. Label keys and values can be no longer than 63 characters.

    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.

    location string
    The location for the Namespace. A full list of valid locations can be found by running gcloud beta service-directory locations list.
    name string
    The resource name for the namespace in the format projects/*/locations/*/namespaces/*.
    namespaceId string
    The Resource ID must be 1-63 characters long, including digits, lowercase letters or the hyphen character.


    project string
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    pulumiLabels {[key: string]: string}
    The combination of labels configured directly on the resource and default labels configured on the provider.
    effective_labels Mapping[str, str]
    All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services.
    labels Mapping[str, str]

    Resource labels associated with this Namespace. No more than 64 user labels can be associated with a given resource. Label keys and values can be no longer than 63 characters.

    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.

    location str
    The location for the Namespace. A full list of valid locations can be found by running gcloud beta service-directory locations list.
    name str
    The resource name for the namespace in the format projects/*/locations/*/namespaces/*.
    namespace_id str
    The Resource ID must be 1-63 characters long, including digits, lowercase letters or the hyphen character.


    project str
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    pulumi_labels Mapping[str, str]
    The combination of labels configured directly on the resource and default labels configured on the provider.
    effectiveLabels Map<String>
    All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services.
    labels Map<String>

    Resource labels associated with this Namespace. No more than 64 user labels can be associated with a given resource. Label keys and values can be no longer than 63 characters.

    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.

    location String
    The location for the Namespace. A full list of valid locations can be found by running gcloud beta service-directory locations list.
    name String
    The resource name for the namespace in the format projects/*/locations/*/namespaces/*.
    namespaceId String
    The Resource ID must be 1-63 characters long, including digits, lowercase letters or the hyphen character.


    project String
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    pulumiLabels Map<String>
    The combination of labels configured directly on the resource and default labels configured on the provider.

    Import

    Namespace can be imported using any of these accepted formats:

    • projects/{{project}}/locations/{{location}}/namespaces/{{namespace_id}}

    • {{project}}/{{location}}/{{namespace_id}}

    • {{location}}/{{namespace_id}}

    When using the pulumi import command, Namespace can be imported using one of the formats above. For example:

    $ pulumi import gcp:servicedirectory/namespace:Namespace default projects/{{project}}/locations/{{location}}/namespaces/{{namespace_id}}
    
    $ pulumi import gcp:servicedirectory/namespace:Namespace default {{project}}/{{location}}/{{namespace_id}}
    
    $ pulumi import gcp:servicedirectory/namespace:Namespace default {{location}}/{{namespace_id}}
    

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

    Package Details

    Repository
    Google Cloud (GCP) Classic pulumi/pulumi-gcp
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the google-beta Terraform Provider.
    gcp logo
    Google Cloud Classic v7.29.0 published on Wednesday, Jun 26, 2024 by Pulumi