Skip to main content

namespaces

Creates, updates, deletes, gets or lists a namespaces resource.

Overview

Namenamespaces
TypeResource
Idgoogle.servicedirectory.namespaces

Fields

The following fields are returned by SELECT queries:

Successful response

NameDatatypeDescription
namestringImmutable. The resource name for the namespace in the format projects/*/locations/*/namespaces/*.
labelsobjectOptional. 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.
uidstringOutput only. The globally unique identifier of the namespace in the UUID4 format.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectprojectsId, locationsId, namespacesIdGets a namespace.
listselectprojectsId, locationsIdpageSize, pageToken, filter, orderByLists all namespaces.
createinsertprojectsId, locationsIdnamespaceIdCreates a namespace, and returns the new namespace.
patchupdateprojectsId, locationsId, namespacesIdupdateMaskUpdates a namespace.
deletedeleteprojectsId, locationsId, namespacesIdDeletes a namespace. This also deletes all services and endpoints in the namespace.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
locationsIdstring
namespacesIdstring
projectsIdstring
filterstring
namespaceIdstring
orderBystring
pageSizeinteger (int32)
pageTokenstring
updateMaskstring (google-fieldmask)

SELECT examples

Gets a namespace.

SELECT
name,
labels,
uid
FROM google.servicedirectory.namespaces
WHERE projectsId = '{{ projectsId }}' -- required
AND locationsId = '{{ locationsId }}' -- required
AND namespacesId = '{{ namespacesId }}' -- required;

INSERT examples

Creates a namespace, and returns the new namespace.

INSERT INTO google.servicedirectory.namespaces (
data__name,
data__labels,
projectsId,
locationsId,
namespaceId
)
SELECT
'{{ name }}',
'{{ labels }}',
'{{ projectsId }}',
'{{ locationsId }}',
'{{ namespaceId }}'
RETURNING
name,
labels,
uid
;

UPDATE examples

Updates a namespace.

UPDATE google.servicedirectory.namespaces
SET
data__name = '{{ name }}',
data__labels = '{{ labels }}'
WHERE
projectsId = '{{ projectsId }}' --required
AND locationsId = '{{ locationsId }}' --required
AND namespacesId = '{{ namespacesId }}' --required
AND updateMask = '{{ updateMask}}'
RETURNING
name,
labels,
uid;

DELETE examples

Deletes a namespace. This also deletes all services and endpoints in the namespace.

DELETE FROM google.servicedirectory.namespaces
WHERE projectsId = '{{ projectsId }}' --required
AND locationsId = '{{ locationsId }}' --required
AND namespacesId = '{{ namespacesId }}' --required;