Manages Google Cloud Projects. v3
Package
@google-cloud/resource-managerConstructors
(constructor)(opts, gaxInstance)
constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback);
Construct an instance of ProjectsClient.
Parameters | |
---|---|
Name | Description |
opts |
ClientOptions
|
gaxInstance |
typeof gax | typeof gax.fallback
: loaded instance of |
Properties
apiEndpoint
static get apiEndpoint(): string;
The DNS address for this API service - same as servicePath(), exists for compatibility reasons.
auth
auth: gax.GoogleAuth;
descriptors
descriptors: Descriptors;
innerApiCalls
innerApiCalls: {
[name: string]: Function;
};
operationsClient
operationsClient: gax.OperationsClient;
pathTemplates
pathTemplates: {
[name: string]: gax.PathTemplate;
};
port
static get port(): number;
The port for this API service.
projectsStub
projectsStub?: Promise<{
[name: string]: Function;
}>;
scopes
static get scopes(): string[];
The scopes needed to make gRPC calls for every method defined in this service.
servicePath
static get servicePath(): string;
The DNS address for this API service.
warn
warn: (code: string, message: string, warnType?: string) => void;
Methods
cancelOperation(request, options, callback)
cancelOperation(request: protos.google.longrunning.CancelOperationRequest, options?: gax.CallOptions | Callback<protos.google.protobuf.Empty, protos.google.longrunning.CancelOperationRequest, {} | undefined | null>, callback?: Callback<protos.google.longrunning.CancelOperationRequest, protos.google.protobuf.Empty, {} | undefined | null>): Promise<protos.google.protobuf.Empty>;
Starts asynchronous cancellation on a long-running operation. The server makes a best effort to cancel the operation, but success is not guaranteed. If the server doesn't support this method, it returns google.rpc.Code.UNIMPLEMENTED
. Clients can use or other methods to check whether the cancellation succeeded or whether the operation completed despite cancellation. On successful cancellation, the operation is not deleted; instead, it becomes an operation with an value with a of 1, corresponding to Code.CANCELLED
.
Parameters | |
---|---|
Name | Description |
request |
protos.google.longrunning.CancelOperationRequest
The request object that will be sent. |
options |
gax.CallOptions | Callback<protos.google.protobuf.Empty, protos.google.longrunning.CancelOperationRequest, {} | undefined | null>
Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details. |
callback |
Callback<protos.google.longrunning.CancelOperationRequest, protos.google.protobuf.Empty, {} | undefined | null>
The function which will be called with the result of the API call. {Promise} - The promise which resolves when API call finishes. The promise has a method named "cancel" which cancels the ongoing API call. |
Returns | |
---|---|
Type | Description |
Promise<protos.google.protobuf.Empty> |
const client = longrunning.operationsClient();
await client.cancelOperation({name: ''});
checkCreateProjectProgress(name)
checkCreateProjectProgress(name: string): Promise<LROperation<protos.google.cloud.resourcemanager.v3.Project, protos.google.cloud.resourcemanager.v3.CreateProjectMetadata>>;
Check the status of the long running operation returned by createProject()
.
Parameter | |
---|---|
Name | Description |
name |
string
The operation name that will be passed. |
Returns | |
---|---|
Type | Description |
Promise<LROperation<protos.google.cloud.resourcemanager.v3.Project, protos.google.cloud.resourcemanager.v3.CreateProjectMetadata>> | {Promise} - The promise which resolves to an object. The decoded operation object has result and metadata field to get information from. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) for more details and examples. |
/**
* This snippet has been automatically generated and should be regarded as a code template only.
* It will require modifications to work.
* It may require correct/in-range values for request initialization.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The Project to create.
* Project ID is required. If the requested ID is unavailable, the request
* fails.
* If the `parent` field is set, the `resourcemanager.projects.create`
* permission is checked on the parent resource. If no parent is set and
* the authorization credentials belong to an Organization, the parent
* will be set to that Organization.
*/
// const project = 'my-project'
// Imports the Resourcemanager library
const {ProjectsClient} = require('@google-cloud/resource-manager').v3;
// Instantiates a client
const resourcemanagerClient = new ProjectsClient();
async function callCreateProject() {
// Construct request
const request = {
project,
};
// Run request
const [operation] = await resourcemanagerClient.createProject(request);
const [response] = await operation.promise();
console.log(response);
}
callCreateProject();
checkDeleteProjectProgress(name)
checkDeleteProjectProgress(name: string): Promise<LROperation<protos.google.cloud.resourcemanager.v3.Project, protos.google.cloud.resourcemanager.v3.DeleteProjectMetadata>>;
Check the status of the long running operation returned by deleteProject()
.
Parameter | |
---|---|
Name | Description |
name |
string
The operation name that will be passed. |
Returns | |
---|---|
Type | Description |
Promise<LROperation<protos.google.cloud.resourcemanager.v3.Project, protos.google.cloud.resourcemanager.v3.DeleteProjectMetadata>> | {Promise} - The promise which resolves to an object. The decoded operation object has result and metadata field to get information from. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) for more details and examples. |
/**
* This snippet has been automatically generated and should be regarded as a code template only.
* It will require modifications to work.
* It may require correct/in-range values for request initialization.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The name of the Project (for example, `projects/415104041262`).
*/
// const name = 'abc123'
// Imports the Resourcemanager library
const {ProjectsClient} = require('@google-cloud/resource-manager').v3;
// Instantiates a client
const resourcemanagerClient = new ProjectsClient();
async function callDeleteProject() {
// Construct request
const request = {
name,
};
// Run request
const [operation] = await resourcemanagerClient.deleteProject(request);
const [response] = await operation.promise();
console.log(response);
}
callDeleteProject();
checkMoveProjectProgress(name)
checkMoveProjectProgress(name: string): Promise<LROperation<protos.google.cloud.resourcemanager.v3.Project, protos.google.cloud.resourcemanager.v3.MoveProjectMetadata>>;
Check the status of the long running operation returned by moveProject()
.
Parameter | |
---|---|
Name | Description |
name |
string
The operation name that will be passed. |
Returns | |
---|---|
Type | Description |
Promise<LROperation<protos.google.cloud.resourcemanager.v3.Project, protos.google.cloud.resourcemanager.v3.MoveProjectMetadata>> | {Promise} - The promise which resolves to an object. The decoded operation object has result and metadata field to get information from. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) for more details and examples. |
/**
* This snippet has been automatically generated and should be regarded as a code template only.
* It will require modifications to work.
* It may require correct/in-range values for request initialization.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The name of the project to move.
*/
// const name = 'abc123'
/**
* Required. The new parent to move the Project under.
*/
// const destinationParent = 'abc123'
// Imports the Resourcemanager library
const {ProjectsClient} = require('@google-cloud/resource-manager').v3;
// Instantiates a client
const resourcemanagerClient = new ProjectsClient();
async function callMoveProject() {
// Construct request
const request = {
name,
destinationParent,
};
// Run request
const [operation] = await resourcemanagerClient.moveProject(request);
const [response] = await operation.promise();
console.log(response);
}
callMoveProject();
checkUndeleteProjectProgress(name)
checkUndeleteProjectProgress(name: string): Promise<LROperation<protos.google.cloud.resourcemanager.v3.Project, protos.google.cloud.resourcemanager.v3.UndeleteProjectMetadata>>;
Check the status of the long running operation returned by undeleteProject()
.
Parameter | |
---|---|
Name | Description |
name |
string
The operation name that will be passed. |
Returns | |
---|---|
Type | Description |
Promise<LROperation<protos.google.cloud.resourcemanager.v3.Project, protos.google.cloud.resourcemanager.v3.UndeleteProjectMetadata>> | {Promise} - The promise which resolves to an object. The decoded operation object has result and metadata field to get information from. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) for more details and examples. |
/**
* This snippet has been automatically generated and should be regarded as a code template only.
* It will require modifications to work.
* It may require correct/in-range values for request initialization.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The name of the project (for example, `projects/415104041262`).
* Required.
*/
// const name = 'abc123'
// Imports the Resourcemanager library
const {ProjectsClient} = require('@google-cloud/resource-manager').v3;
// Instantiates a client
const resourcemanagerClient = new ProjectsClient();
async function callUndeleteProject() {
// Construct request
const request = {
name,
};
// Run request
const [operation] = await resourcemanagerClient.undeleteProject(request);
const [response] = await operation.promise();
console.log(response);
}
callUndeleteProject();
checkUpdateProjectProgress(name)
checkUpdateProjectProgress(name: string): Promise<LROperation<protos.google.cloud.resourcemanager.v3.Project, protos.google.cloud.resourcemanager.v3.UpdateProjectMetadata>>;
Check the status of the long running operation returned by updateProject()
.
Parameter | |
---|---|
Name | Description |
name |
string
The operation name that will be passed. |
Returns | |
---|---|
Type | Description |
Promise<LROperation<protos.google.cloud.resourcemanager.v3.Project, protos.google.cloud.resourcemanager.v3.UpdateProjectMetadata>> | {Promise} - The promise which resolves to an object. The decoded operation object has result and metadata field to get information from. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) for more details and examples. |
/**
* This snippet has been automatically generated and should be regarded as a code template only.
* It will require modifications to work.
* It may require correct/in-range values for request initialization.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The new definition of the project.
*/
// const project = 'my-project'
/**
* Optional. An update mask to selectively update fields.
*/
// const updateMask = {}
// Imports the Resourcemanager library
const {ProjectsClient} = require('@google-cloud/resource-manager').v3;
// Instantiates a client
const resourcemanagerClient = new ProjectsClient();
async function callUpdateProject() {
// Construct request
const request = {
project,
};
// Run request
const [operation] = await resourcemanagerClient.updateProject(request);
const [response] = await operation.promise();
console.log(response);
}
callUpdateProject();
close()
close(): Promise<void>;
Terminate the gRPC channel and close the client.
The client will no longer be usable and all future behavior is undefined.
Returns | |
---|---|
Type | Description |
Promise<void> | {Promise} A promise that resolves when the client is closed. |
createProject(request, options)
createProject(request?: protos.google.cloud.resourcemanager.v3.ICreateProjectRequest, options?: CallOptions): Promise<[
LROperation<protos.google.cloud.resourcemanager.v3.IProject, protos.google.cloud.resourcemanager.v3.ICreateProjectMetadata>,
protos.google.longrunning.IOperation | undefined,
{} | undefined
]>;
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
.
Parameters | |
---|---|
Name | Description |
request |
protos.google.cloud.resourcemanager.v3.ICreateProjectRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Returns | |
---|---|
Type | Description |
Promise<[
LROperation<protos.google.cloud.resourcemanager.v3.IProject, protos.google.cloud.resourcemanager.v3.ICreateProjectMetadata>,
protos.google.longrunning.IOperation | undefined,
{} | undefined
]> | {Promise} - The promise which resolves to an array. The first element of the array is an object representing a long running operation. Its |
/**
* This snippet has been automatically generated and should be regarded as a code template only.
* It will require modifications to work.
* It may require correct/in-range values for request initialization.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The Project to create.
* Project ID is required. If the requested ID is unavailable, the request
* fails.
* If the `parent` field is set, the `resourcemanager.projects.create`
* permission is checked on the parent resource. If no parent is set and
* the authorization credentials belong to an Organization, the parent
* will be set to that Organization.
*/
// const project = 'my-project'
// Imports the Resourcemanager library
const {ProjectsClient} = require('@google-cloud/resource-manager').v3;
// Instantiates a client
const resourcemanagerClient = new ProjectsClient();
async function callCreateProject() {
// Construct request
const request = {
project,
};
// Run request
const [operation] = await resourcemanagerClient.createProject(request);
const [response] = await operation.promise();
console.log(response);
}
callCreateProject();
createProject(request, options, callback)
createProject(request: protos.google.cloud.resourcemanager.v3.ICreateProjectRequest, options: CallOptions, callback: Callback<LROperation<protos.google.cloud.resourcemanager.v3.IProject, protos.google.cloud.resourcemanager.v3.ICreateProjectMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
protos.google.cloud.resourcemanager.v3.ICreateProjectRequest
|
options |
CallOptions
|
callback |
Callback<LROperation<protos.google.cloud.resourcemanager.v3.IProject, protos.google.cloud.resourcemanager.v3.ICreateProjectMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
createProject(request, callback)
createProject(request: protos.google.cloud.resourcemanager.v3.ICreateProjectRequest, callback: Callback<LROperation<protos.google.cloud.resourcemanager.v3.IProject, protos.google.cloud.resourcemanager.v3.ICreateProjectMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
protos.google.cloud.resourcemanager.v3.ICreateProjectRequest
|
callback |
Callback<LROperation<protos.google.cloud.resourcemanager.v3.IProject, protos.google.cloud.resourcemanager.v3.ICreateProjectMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
deleteOperation(request, options, callback)
deleteOperation(request: protos.google.longrunning.DeleteOperationRequest, options?: gax.CallOptions | Callback<protos.google.protobuf.Empty, protos.google.longrunning.DeleteOperationRequest, {} | null | undefined>, callback?: Callback<protos.google.protobuf.Empty, protos.google.longrunning.DeleteOperationRequest, {} | null | undefined>): Promise<protos.google.protobuf.Empty>;
Deletes a long-running operation. This method indicates that the client is no longer interested in the operation result. It does not cancel the operation. If the server doesn't support this method, it returns google.rpc.Code.UNIMPLEMENTED
.
Parameters | |
---|---|
Name | Description |
request |
protos.google.longrunning.DeleteOperationRequest
The request object that will be sent. |
options |
gax.CallOptions | Callback<protos.google.protobuf.Empty, protos.google.longrunning.DeleteOperationRequest, {} | null | undefined>
Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details. |
callback |
Callback<protos.google.protobuf.Empty, protos.google.longrunning.DeleteOperationRequest, {} | null | undefined>
The function which will be called with the result of the API call. {Promise} - The promise which resolves when API call finishes. The promise has a method named "cancel" which cancels the ongoing API call. |
Returns | |
---|---|
Type | Description |
Promise<protos.google.protobuf.Empty> |
const client = longrunning.operationsClient();
await client.deleteOperation({name: ''});
deleteProject(request, options)
deleteProject(request?: protos.google.cloud.resourcemanager.v3.IDeleteProjectRequest, options?: CallOptions): Promise<[
LROperation<protos.google.cloud.resourcemanager.v3.IProject, protos.google.cloud.resourcemanager.v3.IDeleteProjectMetadata>,
protos.google.longrunning.IOperation | undefined,
{} | undefined
]>;
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 .
This method changes the Project's lifecycle state from to . 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] [google.cloud.resourcemanager.v3.Projects.GetProject], and the project remains visible to [ListProjects] [google.cloud.resourcemanager.v3.Projects.ListProjects]. However, you cannot update the project.
After the deletion completes, the project is not retrievable by the [GetProject] [google.cloud.resourcemanager.v3.Projects.GetProject], [ListProjects] [google.cloud.resourcemanager.v3.Projects.ListProjects], and methods.
This method behaves idempotently, such that deleting a DELETE_REQUESTED
project will not cause an error, but also won't do anything.
The caller must have resourcemanager.projects.delete
permissions for this project.
Parameters | |
---|---|
Name | Description |
request |
protos.google.cloud.resourcemanager.v3.IDeleteProjectRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Returns | |
---|---|
Type | Description |
Promise<[
LROperation<protos.google.cloud.resourcemanager.v3.IProject, protos.google.cloud.resourcemanager.v3.IDeleteProjectMetadata>,
protos.google.longrunning.IOperation | undefined,
{} | undefined
]> | {Promise} - The promise which resolves to an array. The first element of the array is an object representing a long running operation. Its |
/**
* This snippet has been automatically generated and should be regarded as a code template only.
* It will require modifications to work.
* It may require correct/in-range values for request initialization.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The name of the Project (for example, `projects/415104041262`).
*/
// const name = 'abc123'
// Imports the Resourcemanager library
const {ProjectsClient} = require('@google-cloud/resource-manager').v3;
// Instantiates a client
const resourcemanagerClient = new ProjectsClient();
async function callDeleteProject() {
// Construct request
const request = {
name,
};
// Run request
const [operation] = await resourcemanagerClient.deleteProject(request);
const [response] = await operation.promise();
console.log(response);
}
callDeleteProject();
deleteProject(request, options, callback)
deleteProject(request: protos.google.cloud.resourcemanager.v3.IDeleteProjectRequest, options: CallOptions, callback: Callback<LROperation<protos.google.cloud.resourcemanager.v3.IProject, protos.google.cloud.resourcemanager.v3.IDeleteProjectMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
protos.google.cloud.resourcemanager.v3.IDeleteProjectRequest
|
options |
CallOptions
|
callback |
Callback<LROperation<protos.google.cloud.resourcemanager.v3.IProject, protos.google.cloud.resourcemanager.v3.IDeleteProjectMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
deleteProject(request, callback)
deleteProject(request: protos.google.cloud.resourcemanager.v3.IDeleteProjectRequest, callback: Callback<LROperation<protos.google.cloud.resourcemanager.v3.IProject, protos.google.cloud.resourcemanager.v3.IDeleteProjectMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
protos.google.cloud.resourcemanager.v3.IDeleteProjectRequest
|
callback |
Callback<LROperation<protos.google.cloud.resourcemanager.v3.IProject, protos.google.cloud.resourcemanager.v3.IDeleteProjectMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
folderPath(folder)
folderPath(folder: string): string;
Return a fully-qualified folder resource name string.
Parameter | |
---|---|
Name | Description |
folder |
string
|
Returns | |
---|---|
Type | Description |
string | {string} Resource name string. |
getIamPolicy(request, options)
getIamPolicy(request?: protos.google.iam.v1.IGetIamPolicyRequest, options?: CallOptions): Promise<[
protos.google.iam.v1.IPolicy,
protos.google.iam.v1.IGetIamPolicyRequest | undefined,
{} | undefined
]>;
Returns the IAM access control policy for the specified project, in the format projects/{ProjectIdOrNumber}
e.g. projects/123. Permission is denied if the policy or the resource do not exist.
Parameters | |
---|---|
Name | Description |
request |
protos.google.iam.v1.IGetIamPolicyRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Returns | |
---|---|
Type | Description |
Promise<[
protos.google.iam.v1.IPolicy,
protos.google.iam.v1.IGetIamPolicyRequest | undefined,
{} | undefined
]> | {Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) for more details and examples. |
/**
* This snippet has been automatically generated and should be regarded as a code template only.
* It will require modifications to work.
* It may require correct/in-range values for request initialization.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* REQUIRED: The resource for which the policy is being requested.
* See the operation documentation for the appropriate value for this field.
*/
// const resource = 'abc123'
/**
* OPTIONAL: A `GetPolicyOptions` object for specifying options to
* `GetIamPolicy`.
*/
// const options = {}
// Imports the Resourcemanager library
const {ProjectsClient} = require('@google-cloud/resource-manager').v3;
// Instantiates a client
const resourcemanagerClient = new ProjectsClient();
async function callGetIamPolicy() {
// Construct request
const request = {
resource,
};
// Run request
const response = await resourcemanagerClient.getIamPolicy(request);
console.log(response);
}
callGetIamPolicy();
getIamPolicy(request, options, callback)
getIamPolicy(request: protos.google.iam.v1.IGetIamPolicyRequest, options: CallOptions, callback: Callback<protos.google.iam.v1.IPolicy, protos.google.iam.v1.IGetIamPolicyRequest | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
protos.google.iam.v1.IGetIamPolicyRequest
|
options |
CallOptions
|
callback |
Callback<protos.google.iam.v1.IPolicy, protos.google.iam.v1.IGetIamPolicyRequest | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
getIamPolicy(request, callback)
getIamPolicy(request: protos.google.iam.v1.IGetIamPolicyRequest, callback: Callback<protos.google.iam.v1.IPolicy, protos.google.iam.v1.IGetIamPolicyRequest | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
protos.google.iam.v1.IGetIamPolicyRequest
|
callback |
Callback<protos.google.iam.v1.IPolicy, protos.google.iam.v1.IGetIamPolicyRequest | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
getOperation(request, options, callback)
getOperation(request: protos.google.longrunning.GetOperationRequest, options?: gax.CallOptions | Callback<protos.google.longrunning.Operation, protos.google.longrunning.GetOperationRequest, {} | null | undefined>, callback?: Callback<protos.google.longrunning.Operation, protos.google.longrunning.GetOperationRequest, {} | null | undefined>): Promise<[protos.google.longrunning.Operation]>;
Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.
Parameters | |
---|---|
Name | Description |
request |
protos.google.longrunning.GetOperationRequest
The request object that will be sent. |
options |
gax.CallOptions | Callback<protos.google.longrunning.Operation, protos.google.longrunning.GetOperationRequest, {} | null | undefined>
Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details. |
callback |
Callback<protos.google.longrunning.Operation, protos.google.longrunning.GetOperationRequest, {} | null | undefined>
The function which will be called with the result of the API call. The second parameter to the callback is an object representing . {Promise} - The promise which resolves to an array. The first element of the array is an object representing . The promise has a method named "cancel" which cancels the ongoing API call. |
Returns | |
---|---|
Type | Description |
Promise<[protos.google.longrunning.Operation]> |
const client = longrunning.operationsClient();
const name = '';
const [response] = await client.getOperation({name});
// doThingsWith(response)
getProject(request, options)
getProject(request?: protos.google.cloud.resourcemanager.v3.IGetProjectRequest, options?: CallOptions): Promise<[
protos.google.cloud.resourcemanager.v3.IProject,
protos.google.cloud.resourcemanager.v3.IGetProjectRequest | undefined,
{} | undefined
]>;
Retrieves the project identified by the specified name
(for example, projects/415104041262
).
The caller must have resourcemanager.projects.get
permission for this project.
Parameters | |
---|---|
Name | Description |
request |
protos.google.cloud.resourcemanager.v3.IGetProjectRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Returns | |
---|---|
Type | Description |
Promise<[
protos.google.cloud.resourcemanager.v3.IProject,
protos.google.cloud.resourcemanager.v3.IGetProjectRequest | undefined,
{} | undefined
]> | {Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) for more details and examples. |
/**
* This snippet has been automatically generated and should be regarded as a code template only.
* It will require modifications to work.
* It may require correct/in-range values for request initialization.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The name of the project (for example, `projects/415104041262`).
*/
// const name = 'abc123'
// Imports the Resourcemanager library
const {ProjectsClient} = require('@google-cloud/resource-manager').v3;
// Instantiates a client
const resourcemanagerClient = new ProjectsClient();
async function callGetProject() {
// Construct request
const request = {
name,
};
// Run request
const response = await resourcemanagerClient.getProject(request);
console.log(response);
}
callGetProject();
getProject(request, options, callback)
getProject(request: protos.google.cloud.resourcemanager.v3.IGetProjectRequest, options: CallOptions, callback: Callback<protos.google.cloud.resourcemanager.v3.IProject, protos.google.cloud.resourcemanager.v3.IGetProjectRequest | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
protos.google.cloud.resourcemanager.v3.IGetProjectRequest
|
options |
CallOptions
|
callback |
Callback<protos.google.cloud.resourcemanager.v3.IProject, protos.google.cloud.resourcemanager.v3.IGetProjectRequest | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
getProject(request, callback)
getProject(request: protos.google.cloud.resourcemanager.v3.IGetProjectRequest, callback: Callback<protos.google.cloud.resourcemanager.v3.IProject, protos.google.cloud.resourcemanager.v3.IGetProjectRequest | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
protos.google.cloud.resourcemanager.v3.IGetProjectRequest
|
callback |
Callback<protos.google.cloud.resourcemanager.v3.IProject, protos.google.cloud.resourcemanager.v3.IGetProjectRequest | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
getProjectId()
getProjectId(): Promise<string>;
Returns | |
---|---|
Type | Description |
Promise<string> |
getProjectId(callback)
getProjectId(callback: Callback<string, undefined, undefined>): void;
Parameter | |
---|---|
Name | Description |
callback |
Callback<string, undefined, undefined>
|
Returns | |
---|---|
Type | Description |
void |
initialize()
initialize(): Promise<{
[name: string]: Function;
}>;
Initialize the client. Performs asynchronous operations (such as authentication) and prepares the client. This function will be called automatically when any class method is called for the first time, but if you need to initialize it before calling an actual method, feel free to call initialize() directly.
You can await on this method if you want to make sure the client is initialized.
Returns | |
---|---|
Type | Description |
Promise<{
[name: string]: Function;
}> | {Promise} A promise that resolves to an authenticated service stub. |
listOperationsAsync(request, options)
listOperationsAsync(request: protos.google.longrunning.ListOperationsRequest, options?: gax.CallOptions): AsyncIterable<protos.google.longrunning.ListOperationsResponse>;
Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns UNIMPLEMENTED
. Returns an iterable object.
For-await-of syntax is used with the iterable to recursively get response element on-demand.
Parameters | |
---|---|
Name | Description |
request |
protos.google.longrunning.ListOperationsRequest
The request object that will be sent. |
options |
gax.CallOptions
Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details. |
Returns | |
---|---|
Type | Description |
AsyncIterable<protos.google.longrunning.ListOperationsResponse> | {Object} An iterable Object that conforms to iteration protocols. |
const client = longrunning.operationsClient();
for await (const response of client.listOperationsAsync(request));
// doThingsWith(response)
listProjects(request, options)
listProjects(request?: protos.google.cloud.resourcemanager.v3.IListProjectsRequest, options?: CallOptions): Promise<[
protos.google.cloud.resourcemanager.v3.IProject[],
protos.google.cloud.resourcemanager.v3.IListProjectsRequest | null,
protos.google.cloud.resourcemanager.v3.IListProjectsResponse
]>;
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.
Parameters | |
---|---|
Name | Description |
request |
protos.google.cloud.resourcemanager.v3.IListProjectsRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Returns | |
---|---|
Type | Description |
Promise<[
protos.google.cloud.resourcemanager.v3.IProject[],
protos.google.cloud.resourcemanager.v3.IListProjectsRequest | null,
protos.google.cloud.resourcemanager.v3.IListProjectsResponse
]> | {Promise} - The promise which resolves to an array. The first element of the array is Array of . The client library will perform auto-pagination by default: it will call the API as many times as needed and will merge results from all the pages into this array. Note that it can affect your quota. We recommend using |
listProjects(request, options, callback)
listProjects(request: protos.google.cloud.resourcemanager.v3.IListProjectsRequest, options: CallOptions, callback: PaginationCallback<protos.google.cloud.resourcemanager.v3.IListProjectsRequest, protos.google.cloud.resourcemanager.v3.IListProjectsResponse | null | undefined, protos.google.cloud.resourcemanager.v3.IProject>): void;
Parameters | |
---|---|
Name | Description |
request |
protos.google.cloud.resourcemanager.v3.IListProjectsRequest
|
options |
CallOptions
|
callback |
PaginationCallback<protos.google.cloud.resourcemanager.v3.IListProjectsRequest, protos.google.cloud.resourcemanager.v3.IListProjectsResponse | null | undefined, protos.google.cloud.resourcemanager.v3.IProject>
|
Returns | |
---|---|
Type | Description |
void |
listProjects(request, callback)
listProjects(request: protos.google.cloud.resourcemanager.v3.IListProjectsRequest, callback: PaginationCallback<protos.google.cloud.resourcemanager.v3.IListProjectsRequest, protos.google.cloud.resourcemanager.v3.IListProjectsResponse | null | undefined, protos.google.cloud.resourcemanager.v3.IProject>): void;
Parameters | |
---|---|
Name | Description |
request |
protos.google.cloud.resourcemanager.v3.IListProjectsRequest
|
callback |
PaginationCallback<protos.google.cloud.resourcemanager.v3.IListProjectsRequest, protos.google.cloud.resourcemanager.v3.IListProjectsResponse | null | undefined, protos.google.cloud.resourcemanager.v3.IProject>
|
Returns | |
---|---|
Type | Description |
void |
listProjectsAsync(request, options)
listProjectsAsync(request?: protos.google.cloud.resourcemanager.v3.IListProjectsRequest, options?: CallOptions): AsyncIterable<protos.google.cloud.resourcemanager.v3.IProject>;
Equivalent to listProjects
, but returns an iterable object.
for
-await
-of
syntax is used with the iterable to get response elements on-demand.
Parameters | |
---|---|
Name | Description |
request |
protos.google.cloud.resourcemanager.v3.IListProjectsRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Returns | |
---|---|
Type | Description |
AsyncIterable<protos.google.cloud.resourcemanager.v3.IProject> | {Object} An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). When you iterate the returned iterable, each element will be an object representing . The API will be called under the hood as needed, once per the page, so you can stop the iteration when you don't need more results. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) for more details and examples. |
/**
* This snippet has been automatically generated and should be regarded as a code template only.
* It will require modifications to work.
* It may require correct/in-range values for request initialization.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The name of the parent resource whose projects are being listed.
* Only children of this parent resource are listed; descendants are not
* listed.
* If the parent is a folder, use the value `folders/{folder_id}`. If the
* parent is an organization, use the value `organizations/{org_id}`.
*/
// const parent = 'abc123'
/**
* Optional. A pagination token returned from a previous call to
* ListProjects google.cloud.resourcemanager.v3.Projects.ListProjects that
* indicates from where listing should continue.
*/
// const pageToken = 'abc123'
/**
* Optional. The maximum number of projects to return in the response.
* The server can return fewer projects than requested.
* If unspecified, server picks an appropriate default.
*/
// const pageSize = 1234
/**
* Optional. Indicate that projects in the `DELETE_REQUESTED` state should
* also be returned. Normally only `ACTIVE` projects are returned.
*/
// const showDeleted = true
// Imports the Resourcemanager library
const {ProjectsClient} = require('@google-cloud/resource-manager').v3;
// Instantiates a client
const resourcemanagerClient = new ProjectsClient();
async function callListProjects() {
// Construct request
const request = {
parent,
};
// Run request
const iterable = await resourcemanagerClient.listProjectsAsync(request);
for await (const response of iterable) {
console.log(response);
}
}
callListProjects();
listProjectsStream(request, options)
listProjectsStream(request?: protos.google.cloud.resourcemanager.v3.IListProjectsRequest, options?: CallOptions): Transform;
Equivalent to method.name.toCamelCase()
, but returns a NodeJS Stream object.
Parameters | |
---|---|
Name | Description |
request |
protos.google.cloud.resourcemanager.v3.IListProjectsRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Returns | |
---|---|
Type | Description |
Transform | {Stream} An object stream which emits an object representing on 'data' event. The client library will perform auto-pagination by default: it will call the API as many times as needed. Note that it can affect your quota. We recommend using |
matchFolderFromFolderName(folderName)
matchFolderFromFolderName(folderName: string): string | number;
Parse the folder from Folder resource.
Parameter | |
---|---|
Name | Description |
folderName |
string
A fully-qualified path representing Folder resource. |
Returns | |
---|---|
Type | Description |
string | number | {string} A string representing the folder. |
matchOrganizationFromOrganizationName(organizationName)
matchOrganizationFromOrganizationName(organizationName: string): string | number;
Parse the organization from Organization resource.
Parameter | |
---|---|
Name | Description |
organizationName |
string
A fully-qualified path representing Organization resource. |
Returns | |
---|---|
Type | Description |
string | number | {string} A string representing the organization. |
matchProjectFromProjectName(projectName)
matchProjectFromProjectName(projectName: string): string | number;
Parse the project from Project resource.
Parameter | |
---|---|
Name | Description |
projectName |
string
A fully-qualified path representing Project resource. |
Returns | |
---|---|
Type | Description |
string | number | {string} A string representing the project. |
matchTagBindingFromTagBindingName(tagBindingName)
matchTagBindingFromTagBindingName(tagBindingName: string): string | number;
Parse the tag_binding from TagBinding resource.
Parameter | |
---|---|
Name | Description |
tagBindingName |
string
A fully-qualified path representing TagBinding resource. |
Returns | |
---|---|
Type | Description |
string | number | {string} A string representing the tag_binding. |
matchTagHoldFromTagHoldName(tagHoldName)
matchTagHoldFromTagHoldName(tagHoldName: string): string | number;
Parse the tag_hold from TagHold resource.
Parameter | |
---|---|
Name | Description |
tagHoldName |
string
A fully-qualified path representing TagHold resource. |
Returns | |
---|---|
Type | Description |
string | number | {string} A string representing the tag_hold. |
matchTagKeyFromTagKeyName(tagKeyName)
matchTagKeyFromTagKeyName(tagKeyName: string): string | number;
Parse the tag_key from TagKey resource.
Parameter | |
---|---|
Name | Description |
tagKeyName |
string
A fully-qualified path representing TagKey resource. |
Returns | |
---|---|
Type | Description |
string | number | {string} A string representing the tag_key. |
matchTagValueFromTagHoldName(tagHoldName)
matchTagValueFromTagHoldName(tagHoldName: string): string | number;
Parse the tag_value from TagHold resource.
Parameter | |
---|---|
Name | Description |
tagHoldName |
string
A fully-qualified path representing TagHold resource. |
Returns | |
---|---|
Type | Description |
string | number | {string} A string representing the tag_value. |
matchTagValueFromTagValueName(tagValueName)
matchTagValueFromTagValueName(tagValueName: string): string | number;
Parse the tag_value from TagValue resource.
Parameter | |
---|---|
Name | Description |
tagValueName |
string
A fully-qualified path representing TagValue resource. |
Returns | |
---|---|
Type | Description |
string | number | {string} A string representing the tag_value. |
moveProject(request, options)
moveProject(request?: protos.google.cloud.resourcemanager.v3.IMoveProjectRequest, options?: CallOptions): Promise<[
LROperation<protos.google.cloud.resourcemanager.v3.IProject, protos.google.cloud.resourcemanager.v3.IMoveProjectMetadata>,
protos.google.longrunning.IOperation | undefined,
{} | undefined
]>;
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.
Parameters | |
---|---|
Name | Description |
request |
protos.google.cloud.resourcemanager.v3.IMoveProjectRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Returns | |
---|---|
Type | Description |
Promise<[
LROperation<protos.google.cloud.resourcemanager.v3.IProject, protos.google.cloud.resourcemanager.v3.IMoveProjectMetadata>,
protos.google.longrunning.IOperation | undefined,
{} | undefined
]> | {Promise} - The promise which resolves to an array. The first element of the array is an object representing a long running operation. Its |
/**
* This snippet has been automatically generated and should be regarded as a code template only.
* It will require modifications to work.
* It may require correct/in-range values for request initialization.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The name of the project to move.
*/
// const name = 'abc123'
/**
* Required. The new parent to move the Project under.
*/
// const destinationParent = 'abc123'
// Imports the Resourcemanager library
const {ProjectsClient} = require('@google-cloud/resource-manager').v3;
// Instantiates a client
const resourcemanagerClient = new ProjectsClient();
async function callMoveProject() {
// Construct request
const request = {
name,
destinationParent,
};
// Run request
const [operation] = await resourcemanagerClient.moveProject(request);
const [response] = await operation.promise();
console.log(response);
}
callMoveProject();
moveProject(request, options, callback)
moveProject(request: protos.google.cloud.resourcemanager.v3.IMoveProjectRequest, options: CallOptions, callback: Callback<LROperation<protos.google.cloud.resourcemanager.v3.IProject, protos.google.cloud.resourcemanager.v3.IMoveProjectMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
protos.google.cloud.resourcemanager.v3.IMoveProjectRequest
|
options |
CallOptions
|
callback |
Callback<LROperation<protos.google.cloud.resourcemanager.v3.IProject, protos.google.cloud.resourcemanager.v3.IMoveProjectMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
moveProject(request, callback)
moveProject(request: protos.google.cloud.resourcemanager.v3.IMoveProjectRequest, callback: Callback<LROperation<protos.google.cloud.resourcemanager.v3.IProject, protos.google.cloud.resourcemanager.v3.IMoveProjectMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
protos.google.cloud.resourcemanager.v3.IMoveProjectRequest
|
callback |
Callback<LROperation<protos.google.cloud.resourcemanager.v3.IProject, protos.google.cloud.resourcemanager.v3.IMoveProjectMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
organizationPath(organization)
organizationPath(organization: string): string;
Return a fully-qualified organization resource name string.
Parameter | |
---|---|
Name | Description |
organization |
string
|
Returns | |
---|---|
Type | Description |
string | {string} Resource name string. |
projectPath(project)
projectPath(project: string): string;
Return a fully-qualified project resource name string.
Parameter | |
---|---|
Name | Description |
project |
string
|
Returns | |
---|---|
Type | Description |
string | {string} Resource name string. |
searchProjects(request, options)
searchProjects(request?: protos.google.cloud.resourcemanager.v3.ISearchProjectsRequest, options?: CallOptions): Promise<[
protos.google.cloud.resourcemanager.v3.IProject[],
protos.google.cloud.resourcemanager.v3.ISearchProjectsRequest | null,
protos.google.cloud.resourcemanager.v3.ISearchProjectsResponse
]>;
Search for projects that the caller has both 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 method.
Parameters | |
---|---|
Name | Description |
request |
protos.google.cloud.resourcemanager.v3.ISearchProjectsRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Returns | |
---|---|
Type | Description |
Promise<[
protos.google.cloud.resourcemanager.v3.IProject[],
protos.google.cloud.resourcemanager.v3.ISearchProjectsRequest | null,
protos.google.cloud.resourcemanager.v3.ISearchProjectsResponse
]> | {Promise} - The promise which resolves to an array. The first element of the array is Array of . The client library will perform auto-pagination by default: it will call the API as many times as needed and will merge results from all the pages into this array. Note that it can affect your quota. We recommend using |
searchProjects(request, options, callback)
searchProjects(request: protos.google.cloud.resourcemanager.v3.ISearchProjectsRequest, options: CallOptions, callback: PaginationCallback<protos.google.cloud.resourcemanager.v3.ISearchProjectsRequest, protos.google.cloud.resourcemanager.v3.ISearchProjectsResponse | null | undefined, protos.google.cloud.resourcemanager.v3.IProject>): void;
Parameters | |
---|---|
Name | Description |
request |
protos.google.cloud.resourcemanager.v3.ISearchProjectsRequest
|
options |
CallOptions
|
callback |
PaginationCallback<protos.google.cloud.resourcemanager.v3.ISearchProjectsRequest, protos.google.cloud.resourcemanager.v3.ISearchProjectsResponse | null | undefined, protos.google.cloud.resourcemanager.v3.IProject>
|
Returns | |
---|---|
Type | Description |
void |
searchProjects(request, callback)
searchProjects(request: protos.google.cloud.resourcemanager.v3.ISearchProjectsRequest, callback: PaginationCallback<protos.google.cloud.resourcemanager.v3.ISearchProjectsRequest, protos.google.cloud.resourcemanager.v3.ISearchProjectsResponse | null | undefined, protos.google.cloud.resourcemanager.v3.IProject>): void;
Parameters | |
---|---|
Name | Description |
request |
protos.google.cloud.resourcemanager.v3.ISearchProjectsRequest
|
callback |
PaginationCallback<protos.google.cloud.resourcemanager.v3.ISearchProjectsRequest, protos.google.cloud.resourcemanager.v3.ISearchProjectsResponse | null | undefined, protos.google.cloud.resourcemanager.v3.IProject>
|
Returns | |
---|---|
Type | Description |
void |
searchProjectsAsync(request, options)
searchProjectsAsync(request?: protos.google.cloud.resourcemanager.v3.ISearchProjectsRequest, options?: CallOptions): AsyncIterable<protos.google.cloud.resourcemanager.v3.IProject>;
Equivalent to searchProjects
, but returns an iterable object.
for
-await
-of
syntax is used with the iterable to get response elements on-demand.
Parameters | |
---|---|
Name | Description |
request |
protos.google.cloud.resourcemanager.v3.ISearchProjectsRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Returns | |
---|---|
Type | Description |
AsyncIterable<protos.google.cloud.resourcemanager.v3.IProject> | {Object} An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). When you iterate the returned iterable, each element will be an object representing . The API will be called under the hood as needed, once per the page, so you can stop the iteration when you don't need more results. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) for more details and examples. |
/** * This snippet has been automatically generated and should be regarded as a code template only. * It will require modifications to work. * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** * Optional. A query string for searching for projects that the caller has * `resourcemanager.projects.get` permission to. If multiple fields are * included in the query, then it will return results that match any of the * fields. Some eligible fields are: *
* | Field | Description | * |-------------------------|----------------------------------------------| * | displayName, name | Filters by displayName. | * | parent | Project's parent (for example: folders/123, * organizations/*). Prefer parent field over parent.type and parent.id.| | * parent.type | Parent's type: `folder` or `organization`. | | * parent.id | Parent's id number (for example: 123) | | * id, projectId | Filters by projectId. | | * state, lifecycleState | Filters by state. | | * labels | Filters by label name or value. | | * labels.\
- Search expressions are case insensitive.
- Some examples queries:
- | Query | Description |
- |------------------|-----------------------------------------------------|
- | name:how* | The project's name starts with "how". |
- | name:Howl | The project's name is
Howl
orhowl
. |- | name:HOWL | Equivalent to above. |
- | NAME:howl | Equivalent to above. |
- | labels.color:* | The project has the label
color
. |- | labels.color:red | The project's label
color
has the valuered
. |- | labels.color:red labels.size:big | The project's label
color
has the- value
red
or its labelsize
has the valuebig
. |- If no query is specified, the call will return projects for which the user
- has the
resourcemanager.projects.get
permission. / // const query = 'abc123' /*- Optional. A pagination token returned from a previous call to
- ListProjects google.cloud.resourcemanager.v3.Projects.ListProjects that
- indicates from where listing should continue. / // const pageToken = 'abc123' /*
- Optional. The maximum number of projects to return in the response.
- The server can return fewer projects than requested.
If unspecified, server picks an appropriate default. */ // const pageSize = 1234
// Imports the Resourcemanager library const {ProjectsClient} = require('@google-cloud/resource-manager').v3;
// Instantiates a client const resourcemanagerClient = new ProjectsClient();
async function callSearchProjects() { // Construct request const request = { };
// Run request const iterable = await resourcemanagerClient.searchProjectsAsync(request); for await (const response of iterable) { console.log(response); } }
callSearchProjects();
searchProjectsStream(request, options)
searchProjectsStream(request?: protos.google.cloud.resourcemanager.v3.ISearchProjectsRequest, options?: CallOptions): Transform;
Equivalent to method.name.toCamelCase()
, but returns a NodeJS Stream object.
Parameters | |
---|---|
Name | Description |
request |
protos.google.cloud.resourcemanager.v3.ISearchProjectsRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Returns | |
---|---|
Type | Description |
Transform | {Stream} An object stream which emits an object representing on 'data' event. The client library will perform auto-pagination by default: it will call the API as many times as needed. Note that it can affect your quota. We recommend using |
setIamPolicy(request, options)
setIamPolicy(request?: protos.google.iam.v1.ISetIamPolicyRequest, options?: CallOptions): Promise<[
protos.google.iam.v1.IPolicy,
protos.google.iam.v1.ISetIamPolicyRequest | undefined,
{} | undefined
]>;
Sets the IAM access control policy for the specified project, in the format projects/{ProjectIdOrNumber}
e.g. projects/123.
CAUTION: This method will replace the existing policy, and cannot be used to append additional IAM settings.
Note: Removing service accounts from policies or changing their roles can render services completely inoperable. It is important to understand how the service account is being used before removing or updating its roles.
The following constraints apply when using setIamPolicy()
:
Project does not support
allUsers
andallAuthenticatedUsers
asmembers
in aBinding
of aPolicy
.The owner role can be granted to a
user
,serviceAccount
, or a group that is part of an organization. For example, group@myownpersonaldomain.com could be added as an owner to a project in the myownpersonaldomain.com organization, but not the examplepetstore.com organization.Service accounts can be made owners of a project directly without any restrictions. However, to be added as an owner, a user must be invited using the Cloud Platform console and must accept the invitation.
A user cannot be granted the owner role using
setIamPolicy()
. The user must be granted the owner role using the Cloud Platform Console and must explicitly accept the invitation.Invitations to grant the owner role cannot be sent using
setIamPolicy()
; they must be sent only using the Cloud Platform Console.If the project is not part of an organization, there must be at least one owner who has accepted the Terms of Service (ToS) agreement in the policy. Calling
setIamPolicy()
to remove the last ToS-accepted owner from the policy will fail. This restriction also applies to legacy projects that no longer have owners who have accepted the ToS. Edits to IAM policies will be rejected until the lack of a ToS-accepting owner is rectified. If the project is part of an organization, you can remove all owners, potentially making the organization inaccessible.
Parameters | |
---|---|
Name | Description |
request |
protos.google.iam.v1.ISetIamPolicyRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Returns | |
---|---|
Type | Description |
Promise<[
protos.google.iam.v1.IPolicy,
protos.google.iam.v1.ISetIamPolicyRequest | undefined,
{} | undefined
]> | {Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) for more details and examples. |
/**
* This snippet has been automatically generated and should be regarded as a code template only.
* It will require modifications to work.
* It may require correct/in-range values for request initialization.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* REQUIRED: The resource for which the policy is being specified.
* See the operation documentation for the appropriate value for this field.
*/
// const resource = 'abc123'
/**
* REQUIRED: The complete policy to be applied to the `resource`. The size of
* the policy is limited to a few 10s of KB. An empty policy is a
* valid policy but certain Cloud Platform services (such as Projects)
* might reject them.
*/
// const policy = {}
/**
* OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only
* the fields in the mask will be modified. If no mask is provided, the
* following default mask is used:
* `paths: "bindings, etag"`
*/
// const updateMask = {}
// Imports the Resourcemanager library
const {ProjectsClient} = require('@google-cloud/resource-manager').v3;
// Instantiates a client
const resourcemanagerClient = new ProjectsClient();
async function callSetIamPolicy() {
// Construct request
const request = {
resource,
policy,
};
// Run request
const response = await resourcemanagerClient.setIamPolicy(request);
console.log(response);
}
callSetIamPolicy();
setIamPolicy(request, options, callback)
setIamPolicy(request: protos.google.iam.v1.ISetIamPolicyRequest, options: CallOptions, callback: Callback<protos.google.iam.v1.IPolicy, protos.google.iam.v1.ISetIamPolicyRequest | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
protos.google.iam.v1.ISetIamPolicyRequest
|
options |
CallOptions
|
callback |
Callback<protos.google.iam.v1.IPolicy, protos.google.iam.v1.ISetIamPolicyRequest | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
setIamPolicy(request, callback)
setIamPolicy(request: protos.google.iam.v1.ISetIamPolicyRequest, callback: Callback<protos.google.iam.v1.IPolicy, protos.google.iam.v1.ISetIamPolicyRequest | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
protos.google.iam.v1.ISetIamPolicyRequest
|
callback |
Callback<protos.google.iam.v1.IPolicy, protos.google.iam.v1.ISetIamPolicyRequest | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
tagBindingPath(tagBinding)
tagBindingPath(tagBinding: string): string;
Return a fully-qualified tagBinding resource name string.
Parameter | |
---|---|
Name | Description |
tagBinding |
string
|
Returns | |
---|---|
Type | Description |
string | {string} Resource name string. |
tagHoldPath(tagValue, tagHold)
tagHoldPath(tagValue: string, tagHold: string): string;
Return a fully-qualified tagHold resource name string.
Parameters | |
---|---|
Name | Description |
tagValue |
string
|
tagHold |
string
|
Returns | |
---|---|
Type | Description |
string | {string} Resource name string. |
tagKeyPath(tagKey)
tagKeyPath(tagKey: string): string;
Return a fully-qualified tagKey resource name string.
Parameter | |
---|---|
Name | Description |
tagKey |
string
|
Returns | |
---|---|
Type | Description |
string | {string} Resource name string. |
tagValuePath(tagValue)
tagValuePath(tagValue: string): string;
Return a fully-qualified tagValue resource name string.
Parameter | |
---|---|
Name | Description |
tagValue |
string
|
Returns | |
---|---|
Type | Description |
string | {string} Resource name string. |
testIamPermissions(request, options)
testIamPermissions(request?: protos.google.iam.v1.ITestIamPermissionsRequest, options?: CallOptions): Promise<[
protos.google.iam.v1.ITestIamPermissionsResponse,
protos.google.iam.v1.ITestIamPermissionsRequest | undefined,
{} | undefined
]>;
Returns permissions that a caller has on the specified project, in the format projects/{ProjectIdOrNumber}
e.g. projects/123..
Parameters | |
---|---|
Name | Description |
request |
protos.google.iam.v1.ITestIamPermissionsRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Returns | |
---|---|
Type | Description |
Promise<[
protos.google.iam.v1.ITestIamPermissionsResponse,
protos.google.iam.v1.ITestIamPermissionsRequest | undefined,
{} | undefined
]> | {Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) for more details and examples. |
/**
* This snippet has been automatically generated and should be regarded as a code template only.
* It will require modifications to work.
* It may require correct/in-range values for request initialization.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* REQUIRED: The resource for which the policy detail is being requested.
* See the operation documentation for the appropriate value for this field.
*/
// const resource = 'abc123'
/**
* The set of permissions to check for the `resource`. Permissions with
* wildcards (such as '*' or 'storage.*') are not allowed. For more
* information see
* IAM Overview (https://cloud.google.com/iam/docs/overview#permissions).
*/
// const permissions = 'abc123'
// Imports the Resourcemanager library
const {ProjectsClient} = require('@google-cloud/resource-manager').v3;
// Instantiates a client
const resourcemanagerClient = new ProjectsClient();
async function callTestIamPermissions() {
// Construct request
const request = {
resource,
permissions,
};
// Run request
const response = await resourcemanagerClient.testIamPermissions(request);
console.log(response);
}
callTestIamPermissions();
testIamPermissions(request, options, callback)
testIamPermissions(request: protos.google.iam.v1.ITestIamPermissionsRequest, options: CallOptions, callback: Callback<protos.google.iam.v1.ITestIamPermissionsResponse, protos.google.iam.v1.ITestIamPermissionsRequest | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
protos.google.iam.v1.ITestIamPermissionsRequest
|
options |
CallOptions
|
callback |
Callback<protos.google.iam.v1.ITestIamPermissionsResponse, protos.google.iam.v1.ITestIamPermissionsRequest | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
testIamPermissions(request, callback)
testIamPermissions(request: protos.google.iam.v1.ITestIamPermissionsRequest, callback: Callback<protos.google.iam.v1.ITestIamPermissionsResponse, protos.google.iam.v1.ITestIamPermissionsRequest | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
protos.google.iam.v1.ITestIamPermissionsRequest
|
callback |
Callback<protos.google.iam.v1.ITestIamPermissionsResponse, protos.google.iam.v1.ITestIamPermissionsRequest | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
undeleteProject(request, options)
undeleteProject(request?: protos.google.cloud.resourcemanager.v3.IUndeleteProjectRequest, options?: CallOptions): Promise<[
LROperation<protos.google.cloud.resourcemanager.v3.IProject, protos.google.cloud.resourcemanager.v3.IUndeleteProjectMetadata>,
protos.google.longrunning.IOperation | undefined,
{} | undefined
]>;
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] [Projects.State.DELETE_REQUESTED]. After deletion starts, the project cannot be restored.
The caller must have resourcemanager.projects.undelete
permission for this project.
Parameters | |
---|---|
Name | Description |
request |
protos.google.cloud.resourcemanager.v3.IUndeleteProjectRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Returns | |
---|---|
Type | Description |
Promise<[
LROperation<protos.google.cloud.resourcemanager.v3.IProject, protos.google.cloud.resourcemanager.v3.IUndeleteProjectMetadata>,
protos.google.longrunning.IOperation | undefined,
{} | undefined
]> | {Promise} - The promise which resolves to an array. The first element of the array is an object representing a long running operation. Its |
/**
* This snippet has been automatically generated and should be regarded as a code template only.
* It will require modifications to work.
* It may require correct/in-range values for request initialization.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The name of the project (for example, `projects/415104041262`).
* Required.
*/
// const name = 'abc123'
// Imports the Resourcemanager library
const {ProjectsClient} = require('@google-cloud/resource-manager').v3;
// Instantiates a client
const resourcemanagerClient = new ProjectsClient();
async function callUndeleteProject() {
// Construct request
const request = {
name,
};
// Run request
const [operation] = await resourcemanagerClient.undeleteProject(request);
const [response] = await operation.promise();
console.log(response);
}
callUndeleteProject();
undeleteProject(request, options, callback)
undeleteProject(request: protos.google.cloud.resourcemanager.v3.IUndeleteProjectRequest, options: CallOptions, callback: Callback<LROperation<protos.google.cloud.resourcemanager.v3.IProject, protos.google.cloud.resourcemanager.v3.IUndeleteProjectMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
protos.google.cloud.resourcemanager.v3.IUndeleteProjectRequest
|
options |
CallOptions
|
callback |
Callback<LROperation<protos.google.cloud.resourcemanager.v3.IProject, protos.google.cloud.resourcemanager.v3.IUndeleteProjectMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
undeleteProject(request, callback)
undeleteProject(request: protos.google.cloud.resourcemanager.v3.IUndeleteProjectRequest, callback: Callback<LROperation<protos.google.cloud.resourcemanager.v3.IProject, protos.google.cloud.resourcemanager.v3.IUndeleteProjectMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
protos.google.cloud.resourcemanager.v3.IUndeleteProjectRequest
|
callback |
Callback<LROperation<protos.google.cloud.resourcemanager.v3.IProject, protos.google.cloud.resourcemanager.v3.IUndeleteProjectMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
updateProject(request, options)
updateProject(request?: protos.google.cloud.resourcemanager.v3.IUpdateProjectRequest, options?: CallOptions): Promise<[
LROperation<protos.google.cloud.resourcemanager.v3.IProject, protos.google.cloud.resourcemanager.v3.IUpdateProjectMetadata>,
protos.google.longrunning.IOperation | undefined,
{} | undefined
]>;
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.
Parameters | |
---|---|
Name | Description |
request |
protos.google.cloud.resourcemanager.v3.IUpdateProjectRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Returns | |
---|---|
Type | Description |
Promise<[
LROperation<protos.google.cloud.resourcemanager.v3.IProject, protos.google.cloud.resourcemanager.v3.IUpdateProjectMetadata>,
protos.google.longrunning.IOperation | undefined,
{} | undefined
]> | {Promise} - The promise which resolves to an array. The first element of the array is an object representing a long running operation. Its |
/**
* This snippet has been automatically generated and should be regarded as a code template only.
* It will require modifications to work.
* It may require correct/in-range values for request initialization.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The new definition of the project.
*/
// const project = 'my-project'
/**
* Optional. An update mask to selectively update fields.
*/
// const updateMask = {}
// Imports the Resourcemanager library
const {ProjectsClient} = require('@google-cloud/resource-manager').v3;
// Instantiates a client
const resourcemanagerClient = new ProjectsClient();
async function callUpdateProject() {
// Construct request
const request = {
project,
};
// Run request
const [operation] = await resourcemanagerClient.updateProject(request);
const [response] = await operation.promise();
console.log(response);
}
callUpdateProject();
updateProject(request, options, callback)
updateProject(request: protos.google.cloud.resourcemanager.v3.IUpdateProjectRequest, options: CallOptions, callback: Callback<LROperation<protos.google.cloud.resourcemanager.v3.IProject, protos.google.cloud.resourcemanager.v3.IUpdateProjectMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
protos.google.cloud.resourcemanager.v3.IUpdateProjectRequest
|
options |
CallOptions
|
callback |
Callback<LROperation<protos.google.cloud.resourcemanager.v3.IProject, protos.google.cloud.resourcemanager.v3.IUpdateProjectMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
updateProject(request, callback)
updateProject(request: protos.google.cloud.resourcemanager.v3.IUpdateProjectRequest, callback: Callback<LROperation<protos.google.cloud.resourcemanager.v3.IProject, protos.google.cloud.resourcemanager.v3.IUpdateProjectMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
protos.google.cloud.resourcemanager.v3.IUpdateProjectRequest
|
callback |
Callback<LROperation<protos.google.cloud.resourcemanager.v3.IProject, protos.google.cloud.resourcemanager.v3.IUpdateProjectMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |