Cloud Resource Manager v3 API - Class ProjectsClientImpl (2.4.0)

public sealed class ProjectsClientImpl : ProjectsClient

Reference documentation and code samples for the Cloud Resource Manager v3 API class ProjectsClientImpl.

Projects client wrapper implementation, for convenient use.

Inheritance

object > ProjectsClient > ProjectsClientImpl

Namespace

Google.Cloud.ResourceManager.V3

Assembly

Google.Cloud.ResourceManager.V3.dll

Remarks

Manages Google Cloud Projects.

Constructors

ProjectsClientImpl(ProjectsClient, ProjectsSettings, ILogger)

public ProjectsClientImpl(Projects.ProjectsClient grpcClient, ProjectsSettings settings, ILogger logger)

Constructs a client wrapper for the Projects service, with the specified gRPC client and settings.

Parameters
NameDescription
grpcClientProjectsProjectsClient

The underlying gRPC client.

settingsProjectsSettings

The base ProjectsSettings used within this client.

loggerILogger

Optional ILogger to use within this client.

Properties

CreateProjectOperationsClient

public override OperationsClient CreateProjectOperationsClient { get; }

The long-running operations client for CreateProject.

Property Value
TypeDescription
OperationsClient
Overrides

DeleteProjectOperationsClient

public override OperationsClient DeleteProjectOperationsClient { get; }

The long-running operations client for DeleteProject.

Property Value
TypeDescription
OperationsClient
Overrides

GrpcClient

public override Projects.ProjectsClient GrpcClient { get; }

The underlying gRPC Projects client

Property Value
TypeDescription
ProjectsProjectsClient
Overrides

MoveProjectOperationsClient

public override OperationsClient MoveProjectOperationsClient { get; }

The long-running operations client for MoveProject.

Property Value
TypeDescription
OperationsClient
Overrides

UndeleteProjectOperationsClient

public override OperationsClient UndeleteProjectOperationsClient { get; }

The long-running operations client for UndeleteProject.

Property Value
TypeDescription
OperationsClient
Overrides

UpdateProjectOperationsClient

public override OperationsClient UpdateProjectOperationsClient { get; }

The long-running operations client for UpdateProject.

Property Value
TypeDescription
OperationsClient
Overrides

Methods

CreateProject(CreateProjectRequest, CallSettings)

public override Operation<Project, CreateProjectMetadata> CreateProject(CreateProjectRequest request, CallSettings callSettings = null)

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
NameDescription
requestCreateProjectRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
OperationProjectCreateProjectMetadata

The RPC response.

Overrides

CreateProjectAsync(CreateProjectRequest, CallSettings)

public override Task<Operation<Project, CreateProjectMetadata>> CreateProjectAsync(CreateProjectRequest request, CallSettings callSettings = null)

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
NameDescription
requestCreateProjectRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskOperationProjectCreateProjectMetadata

A Task containing the RPC response.

Overrides

DeleteProject(DeleteProjectRequest, CallSettings)

public override Operation<Project, DeleteProjectMetadata> DeleteProject(DeleteProjectRequest request, CallSettings callSettings = null)

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][google.cloud.resourcemanager.v3.Project.State.ACTIVE].

This method changes the Project's lifecycle state from [ACTIVE][google.cloud.resourcemanager.v3.Project.State.ACTIVE] to [DELETE_REQUESTED][google.cloud.resourcemanager.v3.Project.State.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] [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 [SearchProjects][google.cloud.resourcemanager.v3.Projects.SearchProjects] 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
NameDescription
requestDeleteProjectRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
OperationProjectDeleteProjectMetadata

The RPC response.

Overrides

DeleteProjectAsync(DeleteProjectRequest, CallSettings)

public override Task<Operation<Project, DeleteProjectMetadata>> DeleteProjectAsync(DeleteProjectRequest request, CallSettings callSettings = null)

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][google.cloud.resourcemanager.v3.Project.State.ACTIVE].

This method changes the Project's lifecycle state from [ACTIVE][google.cloud.resourcemanager.v3.Project.State.ACTIVE] to [DELETE_REQUESTED][google.cloud.resourcemanager.v3.Project.State.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] [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 [SearchProjects][google.cloud.resourcemanager.v3.Projects.SearchProjects] 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
NameDescription
requestDeleteProjectRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskOperationProjectDeleteProjectMetadata

A Task containing the RPC response.

Overrides

GetIamPolicy(GetIamPolicyRequest, CallSettings)

public override Policy GetIamPolicy(GetIamPolicyRequest request, CallSettings callSettings = null)

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
NameDescription
requestGetIamPolicyRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Policy

The RPC response.

Overrides

GetIamPolicyAsync(GetIamPolicyRequest, CallSettings)

public override Task<Policy> GetIamPolicyAsync(GetIamPolicyRequest request, CallSettings callSettings = null)

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
NameDescription
requestGetIamPolicyRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskPolicy

A Task containing the RPC response.

Overrides

GetProject(GetProjectRequest, CallSettings)

public override Project GetProject(GetProjectRequest request, CallSettings callSettings = null)

Retrieves the project identified by the specified name (for example, projects/415104041262).

The caller must have resourcemanager.projects.get permission for this project.

Parameters
NameDescription
requestGetProjectRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Project

The RPC response.

Overrides

GetProjectAsync(GetProjectRequest, CallSettings)

public override Task<Project> GetProjectAsync(GetProjectRequest request, CallSettings callSettings = null)

Retrieves the project identified by the specified name (for example, projects/415104041262).

The caller must have resourcemanager.projects.get permission for this project.

Parameters
NameDescription
requestGetProjectRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskProject

A Task containing the RPC response.

Overrides

ListProjects(ListProjectsRequest, CallSettings)

public override PagedEnumerable<ListProjectsResponse, Project> ListProjects(ListProjectsRequest request, CallSettings callSettings = null)

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
NameDescription
requestListProjectsRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedEnumerableListProjectsResponseProject

A pageable sequence of Project resources.

Overrides

ListProjectsAsync(ListProjectsRequest, CallSettings)

public override PagedAsyncEnumerable<ListProjectsResponse, Project> ListProjectsAsync(ListProjectsRequest request, CallSettings callSettings = null)

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
NameDescription
requestListProjectsRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedAsyncEnumerableListProjectsResponseProject

A pageable asynchronous sequence of Project resources.

Overrides

MoveProject(MoveProjectRequest, CallSettings)

public override Operation<Project, MoveProjectMetadata> MoveProject(MoveProjectRequest request, CallSettings callSettings = null)

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
NameDescription
requestMoveProjectRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
OperationProjectMoveProjectMetadata

The RPC response.

Overrides

MoveProjectAsync(MoveProjectRequest, CallSettings)

public override Task<Operation<Project, MoveProjectMetadata>> MoveProjectAsync(MoveProjectRequest request, CallSettings callSettings = null)

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
NameDescription
requestMoveProjectRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskOperationProjectMoveProjectMetadata

A Task containing the RPC response.

Overrides

SearchProjects(SearchProjectsRequest, CallSettings)

public override PagedEnumerable<SearchProjectsResponse, Project> SearchProjects(SearchProjectsRequest request, CallSettings callSettings = null)

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][google.cloud.resourcemanager.v3.Projects.GetProject] method.

Parameters
NameDescription
requestSearchProjectsRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedEnumerableSearchProjectsResponseProject

A pageable sequence of Project resources.

Overrides

SearchProjectsAsync(SearchProjectsRequest, CallSettings)

public override PagedAsyncEnumerable<SearchProjectsResponse, Project> SearchProjectsAsync(SearchProjectsRequest request, CallSettings callSettings = null)

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][google.cloud.resourcemanager.v3.Projects.GetProject] method.

Parameters
NameDescription
requestSearchProjectsRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedAsyncEnumerableSearchProjectsResponseProject

A pageable asynchronous sequence of Project resources.

Overrides

SetIamPolicy(SetIamPolicyRequest, CallSettings)

public override Policy SetIamPolicy(SetIamPolicyRequest request, CallSettings callSettings = null)

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 and allAuthenticatedUsers as members in a Binding of a Policy.

  • 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
NameDescription
requestSetIamPolicyRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Policy

The RPC response.

Overrides

SetIamPolicyAsync(SetIamPolicyRequest, CallSettings)

public override Task<Policy> SetIamPolicyAsync(SetIamPolicyRequest request, CallSettings callSettings = null)

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 and allAuthenticatedUsers as members in a Binding of a Policy.

  • 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
NameDescription
requestSetIamPolicyRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskPolicy

A Task containing the RPC response.

Overrides

TestIamPermissions(TestIamPermissionsRequest, CallSettings)

public override TestIamPermissionsResponse TestIamPermissions(TestIamPermissionsRequest request, CallSettings callSettings = null)

Returns permissions that a caller has on the specified project, in the format projects/{ProjectIdOrNumber} e.g. projects/123..

Parameters
NameDescription
requestTestIamPermissionsRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TestIamPermissionsResponse

The RPC response.

Overrides

TestIamPermissionsAsync(TestIamPermissionsRequest, CallSettings)

public override Task<TestIamPermissionsResponse> TestIamPermissionsAsync(TestIamPermissionsRequest request, CallSettings callSettings = null)

Returns permissions that a caller has on the specified project, in the format projects/{ProjectIdOrNumber} e.g. projects/123..

Parameters
NameDescription
requestTestIamPermissionsRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskTestIamPermissionsResponse

A Task containing the RPC response.

Overrides

UndeleteProject(UndeleteProjectRequest, CallSettings)

public override Operation<Project, UndeleteProjectMetadata> UndeleteProject(UndeleteProjectRequest request, CallSettings callSettings = null)

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
NameDescription
requestUndeleteProjectRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
OperationProjectUndeleteProjectMetadata

The RPC response.

Overrides

UndeleteProjectAsync(UndeleteProjectRequest, CallSettings)

public override Task<Operation<Project, UndeleteProjectMetadata>> UndeleteProjectAsync(UndeleteProjectRequest request, CallSettings callSettings = null)

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
NameDescription
requestUndeleteProjectRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskOperationProjectUndeleteProjectMetadata

A Task containing the RPC response.

Overrides

UpdateProject(UpdateProjectRequest, CallSettings)

public override Operation<Project, UpdateProjectMetadata> UpdateProject(UpdateProjectRequest request, CallSettings callSettings = null)

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
NameDescription
requestUpdateProjectRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
OperationProjectUpdateProjectMetadata

The RPC response.

Overrides

UpdateProjectAsync(UpdateProjectRequest, CallSettings)

public override Task<Operation<Project, UpdateProjectMetadata>> UpdateProjectAsync(UpdateProjectRequest request, CallSettings callSettings = null)

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
NameDescription
requestUpdateProjectRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskOperationProjectUpdateProjectMetadata

A Task containing the RPC response.

Overrides