projects
Creates, updates, deletes, gets or lists a projects
resource.
Overview
Name | projects |
Type | Resource |
Id | google.cloudresourcemanager.projects |
Fields
The following fields are returned by SELECT
queries:
- get
- list
Successful response
Name | Datatype | Description |
---|---|---|
name | string | Output only. The unique resource name of the project. It is an int64 generated number prefixed by "projects/". Example: projects/415104041262 |
configuredCapabilities | array | Output only. If this project is a Management Project, list of capabilities configured on the parent folder. Note, presence of any capability implies that this is a Management Project. Example: folders/123/capabilities/app-management . OUTPUT ONLY. |
createTime | string (google-datetime) | Output only. Creation time. |
deleteTime | string (google-datetime) | Output only. The time at which this resource was requested for deletion. |
displayName | string | Optional. A user-assigned display name of the project. When present it must be between 4 to 30 characters. Allowed characters are: lowercase and uppercase letters, numbers, hyphen, single-quote, double-quote, space, and exclamation point. Example: My Project |
etag | string | Output only. A checksum computed by the server based on the current value of the Project resource. This may be sent on update and delete requests to ensure the client has an up-to-date value before proceeding. |
labels | object | Optional. The labels associated with this project. Label keys must be between 1 and 63 characters long and must conform to the following regular expression: [a-z]([-a-z0-9][a-z0-9])?. Label values must be between 0 and 63 characters long and must conform to the regular expression ([a-z]([-a-z0-9][a-z0-9])?)?. No more than 64 labels can be associated with a given resource. Clients should store labels in a representation such as JSON that does not depend on specific characters being disallowed. Example: "myBusinessDimension" : "businessValue" |
parent | string | Optional. A reference to a parent Resource. eg., organizations/123 or folders/876 . |
projectId | string | Immutable. The unique, user-assigned id of the project. It must be 6 to 30 lowercase ASCII letters, digits, or hyphens. It must start with a letter. Trailing hyphens are prohibited. Example: tokyo-rain-123 |
state | string | Output only. The project lifecycle state. |
tags | object | Optional. Input only. Immutable. Tag keys/values directly bound to this project. Each item in the map must be expressed as " : ". For example: "123/environment" : "production", "123/costCenter" : "marketing" Note: Currently this field is in Preview. |
updateTime | string (google-datetime) | Output only. The most recent time this resource was modified. |
Successful response
Name | Datatype | Description |
---|---|---|
name | string | Output only. The unique resource name of the project. It is an int64 generated number prefixed by "projects/". Example: projects/415104041262 |
configuredCapabilities | array | Output only. If this project is a Management Project, list of capabilities configured on the parent folder. Note, presence of any capability implies that this is a Management Project. Example: folders/123/capabilities/app-management . OUTPUT ONLY. |
createTime | string (google-datetime) | Output only. Creation time. |
deleteTime | string (google-datetime) | Output only. The time at which this resource was requested for deletion. |
displayName | string | Optional. A user-assigned display name of the project. When present it must be between 4 to 30 characters. Allowed characters are: lowercase and uppercase letters, numbers, hyphen, single-quote, double-quote, space, and exclamation point. Example: My Project |
etag | string | Output only. A checksum computed by the server based on the current value of the Project resource. This may be sent on update and delete requests to ensure the client has an up-to-date value before proceeding. |
labels | object | Optional. The labels associated with this project. Label keys must be between 1 and 63 characters long and must conform to the following regular expression: [a-z]([-a-z0-9][a-z0-9])?. Label values must be between 0 and 63 characters long and must conform to the regular expression ([a-z]([-a-z0-9][a-z0-9])?)?. No more than 64 labels can be associated with a given resource. Clients should store labels in a representation such as JSON that does not depend on specific characters being disallowed. Example: "myBusinessDimension" : "businessValue" |
parent | string | Optional. A reference to a parent Resource. eg., organizations/123 or folders/876 . |
projectId | string | Immutable. The unique, user-assigned id of the project. It must be 6 to 30 lowercase ASCII letters, digits, or hyphens. It must start with a letter. Trailing hyphens are prohibited. Example: tokyo-rain-123 |
state | string | Output only. The project lifecycle state. |
tags | object | Optional. Input only. Immutable. Tag keys/values directly bound to this project. Each item in the map must be expressed as " : ". For example: "123/environment" : "production", "123/costCenter" : "marketing" Note: Currently this field is in Preview. |
updateTime | string (google-datetime) | Output only. The most recent time this resource was modified. |
Methods
The following methods are available for this resource:
Name | Accessible by | Required Params | Optional Params | Description |
---|---|---|---|---|
get | select | projectsId | Retrieves the project identified by the specified name (for example, projects/415104041262 ). The caller must have resourcemanager.projects.get permission for this project. | |
list | select | parent , pageToken , pageSize , showDeleted | Lists projects that are direct children of the specified folder or organization resource. list() provides a strongly consistent view of the projects underneath the specified parent resource. list() returns projects sorted based upon the (ascending) lexical ordering of their display_name . The caller must have resourcemanager.projects.list permission on the identified parent. | |
create | insert | Request that a new project be created. The result is an Operation which can be used to track the creation process. This process usually takes a few seconds, but can sometimes take much longer. The tracking Operation is automatically deleted after a few hours, so there is no need to call DeleteOperation . | ||
patch | update | projectsId | updateMask | Updates the display_name and labels of the project identified by the specified name (for example, projects/415104041262 ). Deleting all labels requires an update mask for labels field. The caller must have resourcemanager.projects.update permission for this project. |
delete | delete | projectsId | Marks the project identified by the specified name (for example, projects/415104041262 ) for deletion. This method will only affect the project if it has a lifecycle state of ACTIVE. This method changes the Project's lifecycle state from ACTIVE to DELETE_REQUESTED. The deletion starts at an unspecified time, at which point the Project is no longer accessible. Until the deletion completes, you can check the lifecycle state checked by retrieving the project with GetProject, and the project remains visible to ListProjects. However, you cannot update the project. After the deletion completes, the project is not retrievable by the GetProject, ListProjects, and SearchProjects methods. The caller must have resourcemanager.projects.delete permissions for this project. | |
search | exec | query , pageToken , pageSize | Search for projects that the caller has the resourcemanager.projects.get permission on, and also satisfy the specified query. This method returns projects in an unspecified order. This method is eventually consistent with project mutations; this means that a newly created project may not appear in the results or recent updates to an existing project may not be reflected in the results. To retrieve the latest state of a project, use the GetProject method. | |
move | exec | projectsId | Move a project to another place in your resource hierarchy, under a new resource parent. Returns an operation which can be used to track the process of the project move workflow. Upon success, the Operation.response field will be populated with the moved project. The caller must have resourcemanager.projects.move permission on the project, on the project's current and proposed new parent. If project has no current parent, or it currently does not have an associated organization resource, you will also need the resourcemanager.projects.setIamPolicy permission in the project. | |
undelete | exec | projectsId | Restores the project identified by the specified name (for example, projects/415104041262 ). You can only use this method for a project that has a lifecycle state of DELETE_REQUESTED. After deletion starts, the project cannot be restored. The caller must have resourcemanager.projects.undelete permission for this project. |
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.
Name | Datatype | Description |
---|---|---|
projectsId | string | |
pageSize | integer (int32) | |
pageToken | string | |
parent | string | |
query | string | |
showDeleted | boolean | |
updateMask | string (google-fieldmask) |
SELECT
examples
- get
- list
Retrieves the project identified by the specified name
(for example, projects/415104041262
). The caller must have resourcemanager.projects.get
permission for this project.
SELECT
name,
configuredCapabilities,
createTime,
deleteTime,
displayName,
etag,
labels,
parent,
projectId,
state,
tags,
updateTime
FROM google.cloudresourcemanager.projects
WHERE projectsId = '{{ projectsId }}' -- required;
Lists projects that are direct children of the specified folder or organization resource. list()
provides a strongly consistent view of the projects underneath the specified parent resource. list()
returns projects sorted based upon the (ascending) lexical ordering of their display_name
. The caller must have resourcemanager.projects.list
permission on the identified parent.
SELECT
name,
configuredCapabilities,
createTime,
deleteTime,
displayName,
etag,
labels,
parent,
projectId,
state,
tags,
updateTime
FROM google.cloudresourcemanager.projects
WHERE parent = '{{ parent }}'
AND pageToken = '{{ pageToken }}'
AND pageSize = '{{ pageSize }}'
AND showDeleted = '{{ showDeleted }}';
INSERT
examples
- create
- Manifest
Request that a new project be created. The result is an Operation
which can be used to track the creation process. This process usually takes a few seconds, but can sometimes take much longer. The tracking Operation
is automatically deleted after a few hours, so there is no need to call DeleteOperation
.
INSERT INTO google.cloudresourcemanager.projects (
data__parent,
data__projectId,
data__displayName,
data__labels,
data__tags
)
SELECT
'{{ parent }}',
'{{ projectId }}',
'{{ displayName }}',
'{{ labels }}',
'{{ tags }}'
RETURNING
name,
done,
error,
metadata,
response
;
# Description fields are for documentation purposes
- name: projects
props:
- name: parent
value: string
description: >
Optional. A reference to a parent Resource. eg., `organizations/123` or `folders/876`.
- name: projectId
value: string
description: >
Immutable. The unique, user-assigned id of the project. It must be 6 to 30 lowercase ASCII letters, digits, or hyphens. It must start with a letter. Trailing hyphens are prohibited. Example: `tokyo-rain-123`
- name: displayName
value: string
description: >
Optional. A user-assigned display name of the project. When present it must be between 4 to 30 characters. Allowed characters are: lowercase and uppercase letters, numbers, hyphen, single-quote, double-quote, space, and exclamation point. Example: `My Project`
- name: labels
value: object
description: >
Optional. The labels associated with this project. Label keys must be between 1 and 63 characters long and must conform to the following regular expression: \[a-z\](\[-a-z0-9\]*\[a-z0-9\])?. Label values must be between 0 and 63 characters long and must conform to the regular expression (\[a-z\](\[-a-z0-9\]*\[a-z0-9\])?)?. No more than 64 labels can be associated with a given resource. Clients should store labels in a representation such as JSON that does not depend on specific characters being disallowed. Example: `"myBusinessDimension" : "businessValue"`
- name: tags
value: object
description: >
Optional. Input only. Immutable. Tag keys/values directly bound to this project. Each item in the map must be expressed as " : ". For example: "123/environment" : "production", "123/costCenter" : "marketing" Note: Currently this field is in Preview.
UPDATE
examples
- patch
Updates the display_name
and labels of the project identified by the specified name
(for example, projects/415104041262
). Deleting all labels requires an update mask for labels field. The caller must have resourcemanager.projects.update
permission for this project.
UPDATE google.cloudresourcemanager.projects
SET
data__parent = '{{ parent }}',
data__projectId = '{{ projectId }}',
data__displayName = '{{ displayName }}',
data__labels = '{{ labels }}',
data__tags = '{{ tags }}'
WHERE
projectsId = '{{ projectsId }}' --required
AND updateMask = '{{ updateMask}}'
RETURNING
name,
done,
error,
metadata,
response;
DELETE
examples
- delete
Marks the project identified by the specified name
(for example, projects/415104041262
) for deletion. This method will only affect the project if it has a lifecycle state of ACTIVE. This method changes the Project's lifecycle state from ACTIVE to DELETE_REQUESTED. The deletion starts at an unspecified time, at which point the Project is no longer accessible. Until the deletion completes, you can check the lifecycle state checked by retrieving the project with GetProject, and the project remains visible to ListProjects. However, you cannot update the project. After the deletion completes, the project is not retrievable by the GetProject, ListProjects, and SearchProjects methods. The caller must have resourcemanager.projects.delete
permissions for this project.
DELETE FROM google.cloudresourcemanager.projects
WHERE projectsId = '{{ projectsId }}' --required;
Lifecycle Methods
- search
- move
- undelete
Search for projects that the caller has the resourcemanager.projects.get
permission on, and also satisfy the specified query. This method returns projects in an unspecified order. This method is eventually consistent with project mutations; this means that a newly created project may not appear in the results or recent updates to an existing project may not be reflected in the results. To retrieve the latest state of a project, use the GetProject method.
EXEC google.cloudresourcemanager.projects.search
@query='{{ query }}',
@pageToken='{{ pageToken }}',
@pageSize='{{ pageSize }}';
Move a project to another place in your resource hierarchy, under a new resource parent. Returns an operation which can be used to track the process of the project move workflow. Upon success, the Operation.response
field will be populated with the moved project. The caller must have resourcemanager.projects.move
permission on the project, on the project's current and proposed new parent. If project has no current parent, or it currently does not have an associated organization resource, you will also need the resourcemanager.projects.setIamPolicy
permission in the project.
EXEC google.cloudresourcemanager.projects.move
@projectsId='{{ projectsId }}' --required
@@json=
'{
"destinationParent": "{{ destinationParent }}"
}';
Restores the project identified by the specified name
(for example, projects/415104041262
). You can only use this method for a project that has a lifecycle state of DELETE_REQUESTED. After deletion starts, the project cannot be restored. The caller must have resourcemanager.projects.undelete
permission for this project.
EXEC google.cloudresourcemanager.projects.undelete
@projectsId='{{ projectsId }}' --required;