gcp.servicedirectory.Service
Explore with Pulumi AI
An individual service. A service contains a name and optional metadata.
To get more information about Service, see:
- API documentation
- How-to Guides
Example Usage
Service Directory Service 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",
});
const exampleService = new gcp.servicedirectory.Service("example", {
serviceId: "example-service",
namespace: example.id,
metadata: {
stage: "prod",
region: "us-central1",
},
});
import pulumi
import pulumi_gcp as gcp
example = gcp.servicedirectory.Namespace("example",
namespace_id="example-namespace",
location="us-central1")
example_service = gcp.servicedirectory.Service("example",
service_id="example-service",
namespace=example.id,
metadata={
"stage": "prod",
"region": "us-central1",
})
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 {
example, err := servicedirectory.NewNamespace(ctx, "example", &servicedirectory.NamespaceArgs{
NamespaceId: pulumi.String("example-namespace"),
Location: pulumi.String("us-central1"),
})
if err != nil {
return err
}
_, err = servicedirectory.NewService(ctx, "example", &servicedirectory.ServiceArgs{
ServiceId: pulumi.String("example-service"),
Namespace: example.ID(),
Metadata: pulumi.StringMap{
"stage": pulumi.String("prod"),
"region": pulumi.String("us-central1"),
},
})
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",
});
var exampleService = new Gcp.ServiceDirectory.Service("example", new()
{
ServiceId = "example-service",
Namespace = example.Id,
Metadata =
{
{ "stage", "prod" },
{ "region", "us-central1" },
},
});
});
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 com.pulumi.gcp.servicedirectory.Service;
import com.pulumi.gcp.servicedirectory.ServiceArgs;
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")
.build());
var exampleService = new Service("exampleService", ServiceArgs.builder()
.serviceId("example-service")
.namespace(example.id())
.metadata(Map.ofEntries(
Map.entry("stage", "prod"),
Map.entry("region", "us-central1")
))
.build());
}
}
resources:
example:
type: gcp:servicedirectory:Namespace
properties:
namespaceId: example-namespace
location: us-central1
exampleService:
type: gcp:servicedirectory:Service
name: example
properties:
serviceId: example-service
namespace: ${example.id}
metadata:
stage: prod
region: us-central1
Create Service Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new Service(name: string, args: ServiceArgs, opts?: CustomResourceOptions);
@overload
def Service(resource_name: str,
args: ServiceArgs,
opts: Optional[ResourceOptions] = None)
@overload
def Service(resource_name: str,
opts: Optional[ResourceOptions] = None,
namespace: Optional[str] = None,
service_id: Optional[str] = None,
metadata: Optional[Mapping[str, str]] = None)
func NewService(ctx *Context, name string, args ServiceArgs, opts ...ResourceOption) (*Service, error)
public Service(string name, ServiceArgs args, CustomResourceOptions? opts = null)
public Service(String name, ServiceArgs args)
public Service(String name, ServiceArgs args, CustomResourceOptions options)
type: gcp:servicedirectory:Service
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 ServiceArgs
- 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 ServiceArgs
- 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 ServiceArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args ServiceArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args ServiceArgs
- 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 exampleserviceResourceResourceFromServicedirectoryservice = new Gcp.ServiceDirectory.Service("exampleserviceResourceResourceFromServicedirectoryservice", new()
{
Namespace = "string",
ServiceId = "string",
Metadata =
{
{ "string", "string" },
},
});
example, err := servicedirectory.NewService(ctx, "exampleserviceResourceResourceFromServicedirectoryservice", &servicedirectory.ServiceArgs{
Namespace: pulumi.String("string"),
ServiceId: pulumi.String("string"),
Metadata: pulumi.StringMap{
"string": pulumi.String("string"),
},
})
var exampleserviceResourceResourceFromServicedirectoryservice = new Service("exampleserviceResourceResourceFromServicedirectoryservice", ServiceArgs.builder()
.namespace("string")
.serviceId("string")
.metadata(Map.of("string", "string"))
.build());
exampleservice_resource_resource_from_servicedirectoryservice = gcp.servicedirectory.Service("exampleserviceResourceResourceFromServicedirectoryservice",
namespace="string",
service_id="string",
metadata={
"string": "string",
})
const exampleserviceResourceResourceFromServicedirectoryservice = new gcp.servicedirectory.Service("exampleserviceResourceResourceFromServicedirectoryservice", {
namespace: "string",
serviceId: "string",
metadata: {
string: "string",
},
});
type: gcp:servicedirectory:Service
properties:
metadata:
string: string
namespace: string
serviceId: string
Service 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 Service resource accepts the following input properties:
- Namespace string
- The resource name of the namespace this service will belong to.
- Service
Id string - The Resource ID must be 1-63 characters long, including digits,
lowercase letters or the hyphen character.
- Metadata Dictionary<string, string>
- Metadata for the service. This data can be consumed by service clients. The entire metadata dictionary may contain up to 2000 characters, spread across all key-value pairs. Metadata that goes beyond any these limits will be rejected.
- Namespace string
- The resource name of the namespace this service will belong to.
- Service
Id string - The Resource ID must be 1-63 characters long, including digits,
lowercase letters or the hyphen character.
- Metadata map[string]string
- Metadata for the service. This data can be consumed by service clients. The entire metadata dictionary may contain up to 2000 characters, spread across all key-value pairs. Metadata that goes beyond any these limits will be rejected.
- namespace String
- The resource name of the namespace this service will belong to.
- service
Id String - The Resource ID must be 1-63 characters long, including digits,
lowercase letters or the hyphen character.
- metadata Map<String,String>
- Metadata for the service. This data can be consumed by service clients. The entire metadata dictionary may contain up to 2000 characters, spread across all key-value pairs. Metadata that goes beyond any these limits will be rejected.
- namespace string
- The resource name of the namespace this service will belong to.
- service
Id string - The Resource ID must be 1-63 characters long, including digits,
lowercase letters or the hyphen character.
- metadata {[key: string]: string}
- Metadata for the service. This data can be consumed by service clients. The entire metadata dictionary may contain up to 2000 characters, spread across all key-value pairs. Metadata that goes beyond any these limits will be rejected.
- namespace str
- The resource name of the namespace this service will belong to.
- service_
id str - The Resource ID must be 1-63 characters long, including digits,
lowercase letters or the hyphen character.
- metadata Mapping[str, str]
- Metadata for the service. This data can be consumed by service clients. The entire metadata dictionary may contain up to 2000 characters, spread across all key-value pairs. Metadata that goes beyond any these limits will be rejected.
- namespace String
- The resource name of the namespace this service will belong to.
- service
Id String - The Resource ID must be 1-63 characters long, including digits,
lowercase letters or the hyphen character.
- metadata Map<String>
- Metadata for the service. This data can be consumed by service clients. The entire metadata dictionary may contain up to 2000 characters, spread across all key-value pairs. Metadata that goes beyond any these limits will be rejected.
Outputs
All input properties are implicitly available as output properties. Additionally, the Service resource produces the following output properties:
Look up Existing Service Resource
Get an existing Service 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?: ServiceState, opts?: CustomResourceOptions): Service
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
metadata: Optional[Mapping[str, str]] = None,
name: Optional[str] = None,
namespace: Optional[str] = None,
service_id: Optional[str] = None) -> Service
func GetService(ctx *Context, name string, id IDInput, state *ServiceState, opts ...ResourceOption) (*Service, error)
public static Service Get(string name, Input<string> id, ServiceState? state, CustomResourceOptions? opts = null)
public static Service get(String name, Output<String> id, ServiceState 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.
- Metadata Dictionary<string, string>
- Metadata for the service. This data can be consumed by service clients. The entire metadata dictionary may contain up to 2000 characters, spread across all key-value pairs. Metadata that goes beyond any these limits will be rejected.
- Name string
- The resource name for the service in the
format
projects/*/locations/*/namespaces/*/services/*
. - Namespace string
- The resource name of the namespace this service will belong to.
- Service
Id string - The Resource ID must be 1-63 characters long, including digits,
lowercase letters or the hyphen character.
- Metadata map[string]string
- Metadata for the service. This data can be consumed by service clients. The entire metadata dictionary may contain up to 2000 characters, spread across all key-value pairs. Metadata that goes beyond any these limits will be rejected.
- Name string
- The resource name for the service in the
format
projects/*/locations/*/namespaces/*/services/*
. - Namespace string
- The resource name of the namespace this service will belong to.
- Service
Id string - The Resource ID must be 1-63 characters long, including digits,
lowercase letters or the hyphen character.
- metadata Map<String,String>
- Metadata for the service. This data can be consumed by service clients. The entire metadata dictionary may contain up to 2000 characters, spread across all key-value pairs. Metadata that goes beyond any these limits will be rejected.
- name String
- The resource name for the service in the
format
projects/*/locations/*/namespaces/*/services/*
. - namespace String
- The resource name of the namespace this service will belong to.
- service
Id String - The Resource ID must be 1-63 characters long, including digits,
lowercase letters or the hyphen character.
- metadata {[key: string]: string}
- Metadata for the service. This data can be consumed by service clients. The entire metadata dictionary may contain up to 2000 characters, spread across all key-value pairs. Metadata that goes beyond any these limits will be rejected.
- name string
- The resource name for the service in the
format
projects/*/locations/*/namespaces/*/services/*
. - namespace string
- The resource name of the namespace this service will belong to.
- service
Id string - The Resource ID must be 1-63 characters long, including digits,
lowercase letters or the hyphen character.
- metadata Mapping[str, str]
- Metadata for the service. This data can be consumed by service clients. The entire metadata dictionary may contain up to 2000 characters, spread across all key-value pairs. Metadata that goes beyond any these limits will be rejected.
- name str
- The resource name for the service in the
format
projects/*/locations/*/namespaces/*/services/*
. - namespace str
- The resource name of the namespace this service will belong to.
- service_
id str - The Resource ID must be 1-63 characters long, including digits,
lowercase letters or the hyphen character.
- metadata Map<String>
- Metadata for the service. This data can be consumed by service clients. The entire metadata dictionary may contain up to 2000 characters, spread across all key-value pairs. Metadata that goes beyond any these limits will be rejected.
- name String
- The resource name for the service in the
format
projects/*/locations/*/namespaces/*/services/*
. - namespace String
- The resource name of the namespace this service will belong to.
- service
Id String - The Resource ID must be 1-63 characters long, including digits,
lowercase letters or the hyphen character.
Import
Service can be imported using any of these accepted formats:
projects/{{project}}/locations/{{location}}/namespaces/{{namespace_id}}/services/{{service_id}}
{{project}}/{{location}}/{{namespace_id}}/{{service_id}}
{{location}}/{{namespace_id}}/{{service_id}}
When using the pulumi import
command, Service can be imported using one of the formats above. For example:
$ pulumi import gcp:servicedirectory/service:Service default projects/{{project}}/locations/{{location}}/namespaces/{{namespace_id}}/services/{{service_id}}
$ pulumi import gcp:servicedirectory/service:Service default {{project}}/{{location}}/{{namespace_id}}/{{service_id}}
$ pulumi import gcp:servicedirectory/service:Service default {{location}}/{{namespace_id}}/{{service_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.