Class ProjectsClient (2.32.0-rc)

Manages Google Cloud Projects.

Equality

Instances of this class created via copy-construction or copy-assignment always compare equal. Instances created with equal std::shared_ptr<*Connection> objects compare equal. Objects that compare equal share the same underlying resources.

Performance

Creating a new instance of this class is a relatively expensive operation, new objects establish new connections to the service. In contrast, copy-construction, move-construction, and the corresponding assignment operations are relatively efficient as the copies share all underlying resources.

Thread Safety

Concurrent access to different instances of this class, even if they compare equal, is guaranteed to work. Two or more threads operating on the same instance of this class is not guaranteed to work. Since copy-construction and move-construction is a relatively efficient operation, consider using such a copy when using this class from multiple threads.

Constructors

ProjectsClient(ProjectsClient const &)

Copy and move support

Parameter
Name Description
ProjectsClient const &

ProjectsClient(ProjectsClient &&)

Copy and move support

Parameter
Name Description
ProjectsClient &&

ProjectsClient(std::shared_ptr< ProjectsConnection >, Options)

Parameters
Name Description
connection std::shared_ptr< ProjectsConnection >
opts Options

Operators

operator=(ProjectsClient const &)

Copy and move support

Parameter
Name Description
ProjectsClient const &
Returns
Type Description
ProjectsClient &

operator=(ProjectsClient &&)

Copy and move support

Parameter
Name Description
ProjectsClient &&
Returns
Type Description
ProjectsClient &

Functions

GetProject(std::string const &, Options)

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
name std::string const &

Required. The name of the project (for example, projects/415104041262).

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::cloud::resourcemanager::v3::Project >

the result of the RPC. The response message type (google.cloud.resourcemanager.v3.Project) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

GetProject(google::cloud::resourcemanager::v3::GetProjectRequest const &, Options)

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 google::cloud::resourcemanager::v3::GetProjectRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.resourcemanager.v3.GetProjectRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::cloud::resourcemanager::v3::Project >

the result of the RPC. The response message type (google.cloud.resourcemanager.v3.Project) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

ListProjects(std::string const &, Options)

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
parent std::string const &

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}.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StreamRange< google::cloud::resourcemanager::v3::Project >

a StreamRange to iterate of the results. See the documentation of this type for details. In brief, this class has begin() and end() member functions returning a iterator class meeting the input iterator requirements. The value type for this iterator is a StatusOr as the iteration may fail even after some values are retrieved successfully, for example, if there is a network disconnect. An empty set of results does not indicate an error, it indicates that there are no resources meeting the request criteria. On a successful iteration the StatusOr<T> contains elements of type google.cloud.resourcemanager.v3.Project, or rather, the C++ class generated by Protobuf from that type. Please consult the Protobuf documentation for details on the Protobuf mapping rules.

ListProjects(google::cloud::resourcemanager::v3::ListProjectsRequest, Options)

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 google::cloud::resourcemanager::v3::ListProjectsRequest

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.resourcemanager.v3.ListProjectsRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StreamRange< google::cloud::resourcemanager::v3::Project >

a StreamRange to iterate of the results. See the documentation of this type for details. In brief, this class has begin() and end() member functions returning a iterator class meeting the input iterator requirements. The value type for this iterator is a StatusOr as the iteration may fail even after some values are retrieved successfully, for example, if there is a network disconnect. An empty set of results does not indicate an error, it indicates that there are no resources meeting the request criteria. On a successful iteration the StatusOr<T> contains elements of type google.cloud.resourcemanager.v3.Project, or rather, the C++ class generated by Protobuf from that type. Please consult the Protobuf documentation for details on the Protobuf mapping rules.

SearchProjects(std::string const &, Options)

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 GetProject method.

Parameters
Name Description
query std::string const &

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.
For more information, see SearchProjectsRequest.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StreamRange< google::cloud::resourcemanager::v3::Project >

a StreamRange to iterate of the results. See the documentation of this type for details. In brief, this class has begin() and end() member functions returning a iterator class meeting the input iterator requirements. The value type for this iterator is a StatusOr as the iteration may fail even after some values are retrieved successfully, for example, if there is a network disconnect. An empty set of results does not indicate an error, it indicates that there are no resources meeting the request criteria. On a successful iteration the StatusOr<T> contains elements of type google.cloud.resourcemanager.v3.Project, or rather, the C++ class generated by Protobuf from that type. Please consult the Protobuf documentation for details on the Protobuf mapping rules.

SearchProjects(google::cloud::resourcemanager::v3::SearchProjectsRequest, Options)

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 GetProject method.

Parameters
Name Description
request google::cloud::resourcemanager::v3::SearchProjectsRequest

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.resourcemanager.v3.SearchProjectsRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StreamRange< google::cloud::resourcemanager::v3::Project >

a StreamRange to iterate of the results. See the documentation of this type for details. In brief, this class has begin() and end() member functions returning a iterator class meeting the input iterator requirements. The value type for this iterator is a StatusOr as the iteration may fail even after some values are retrieved successfully, for example, if there is a network disconnect. An empty set of results does not indicate an error, it indicates that there are no resources meeting the request criteria. On a successful iteration the StatusOr<T> contains elements of type google.cloud.resourcemanager.v3.Project, or rather, the C++ class generated by Protobuf from that type. Please consult the Protobuf documentation for details on the Protobuf mapping rules.

CreateProject(google::cloud::resourcemanager::v3::Project const &, Options)

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
project google::cloud::resourcemanager::v3::Project const &

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.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
future< StatusOr< google::cloud::resourcemanager::v3::Project > >

A future that becomes satisfied when the LRO (Long Running Operation) completes or the polling policy in effect for this call is exhausted. The future is satisfied with an error if the LRO completes with an error or the polling policy is exhausted. In this case the StatusOr returned by the future contains the error. If the LRO completes successfully the value of the future contains the LRO's result. For this RPC the result is a google.cloud.resourcemanager.v3.Project proto message. The C++ class representing this message is created by Protobuf, using the Protobuf mapping rules.

CreateProject(NoAwaitTag, google::cloud::resourcemanager::v3::Project const &, Options)

Request that a new project be created.

Specifying the NoAwaitTag immediately returns the [google::longrunning::Operation] that corresponds to the Long Running Operation that has been started. No polling for operation status occurs.

Parameters
Name Description
NoAwaitTag
project google::cloud::resourcemanager::v3::Project const &
opts Options
Returns
Type Description
StatusOr< google::longrunning::Operation >

CreateProject(google::cloud::resourcemanager::v3::CreateProjectRequest const &, Options)

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 google::cloud::resourcemanager::v3::CreateProjectRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.resourcemanager.v3.CreateProjectRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
future< StatusOr< google::cloud::resourcemanager::v3::Project > >

A future that becomes satisfied when the LRO (Long Running Operation) completes or the polling policy in effect for this call is exhausted. The future is satisfied with an error if the LRO completes with an error or the polling policy is exhausted. In this case the StatusOr returned by the future contains the error. If the LRO completes successfully the value of the future contains the LRO's result. For this RPC the result is a google.cloud.resourcemanager.v3.Project proto message. The C++ class representing this message is created by Protobuf, using the Protobuf mapping rules.

CreateProject(NoAwaitTag, google::cloud::resourcemanager::v3::CreateProjectRequest const &, Options)

Request that a new project be created.

Specifying the NoAwaitTag immediately returns the [google::longrunning::Operation] that corresponds to the Long Running Operation that has been started. No polling for operation status occurs.

Parameters
Name Description
NoAwaitTag
request google::cloud::resourcemanager::v3::CreateProjectRequest const &
opts Options
Returns
Type Description
StatusOr< google::longrunning::Operation >

CreateProject(google::longrunning::Operation const &, Options)

Request that a new project be created.

This method accepts a google::longrunning::Operation that corresponds to a previously started Long Running Operation (LRO) and polls the status of the LRO in the background.

Parameters
Name Description
operation google::longrunning::Operation const &
opts Options
Returns
Type Description
future< StatusOr< google::cloud::resourcemanager::v3::Project > >

UpdateProject(google::cloud::resourcemanager::v3::Project const &, google::protobuf::FieldMask const &, Options)

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
project google::cloud::resourcemanager::v3::Project const &

Required. The new definition of the project.

update_mask google::protobuf::FieldMask const &

Optional. An update mask to selectively update fields.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
future< StatusOr< google::cloud::resourcemanager::v3::Project > >

A future that becomes satisfied when the LRO (Long Running Operation) completes or the polling policy in effect for this call is exhausted. The future is satisfied with an error if the LRO completes with an error or the polling policy is exhausted. In this case the StatusOr returned by the future contains the error. If the LRO completes successfully the value of the future contains the LRO's result. For this RPC the result is a google.cloud.resourcemanager.v3.Project proto message. The C++ class representing this message is created by Protobuf, using the Protobuf mapping rules.

UpdateProject(NoAwaitTag, google::cloud::resourcemanager::v3::Project const &, google::protobuf::FieldMask const &, Options)

Updates the display_name and labels of the project identified by the specified name (for example, projects/415104041262).

Specifying the NoAwaitTag immediately returns the [google::longrunning::Operation] that corresponds to the Long Running Operation that has been started. No polling for operation status occurs.

Parameters
Name Description
NoAwaitTag
project google::cloud::resourcemanager::v3::Project const &
update_mask google::protobuf::FieldMask const &
opts Options
Returns
Type Description
StatusOr< google::longrunning::Operation >

UpdateProject(google::cloud::resourcemanager::v3::UpdateProjectRequest const &, Options)

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 google::cloud::resourcemanager::v3::UpdateProjectRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.resourcemanager.v3.UpdateProjectRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
future< StatusOr