- 1.57.0 (latest)
- 1.56.0
- 1.55.0
- 1.54.0
- 1.53.0
- 1.51.0
- 1.50.0
- 1.49.0
- 1.48.0
- 1.47.0
- 1.46.0
- 1.45.0
- 1.44.0
- 1.43.0
- 1.42.0
- 1.41.0
- 1.39.0
- 1.38.0
- 1.37.0
- 1.36.0
- 1.35.0
- 1.34.0
- 1.33.0
- 1.32.0
- 1.31.0
- 1.30.0
- 1.29.0
- 1.26.0
- 1.25.0
- 1.24.0
- 1.23.0
- 1.22.0
- 1.21.0
- 1.20.0
- 1.19.0
- 1.18.0
- 1.17.0
- 1.16.0
- 1.15.0
- 1.14.0
- 1.13.0
- 1.11.0
- 1.10.0
- 1.9.0
- 1.8.0
- 1.7.0
- 1.6.0
- 1.5.6
- 1.4.0
- 1.3.2
- 1.2.12
public class ProjectsClient implements BackgroundResource
Service Description: Manages Google Cloud Projects.
This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started:
// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ProjectsClient projectsClient = ProjectsClient.create()) {
ProjectName name = ProjectName.of("[PROJECT]");
Project response = projectsClient.getProject(name);
}
Note: close() needs to be called on the ProjectsClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().
The surface of this class includes several types of Java methods for each of the API's methods:
- A "flattened" method. With this type of method, the fields of the request type have been converted into function parameters. It may be the case that not all fields are available as parameters, and not every API method will have a flattened method entry point.
- A "request object" method. This type of method only takes one parameter, a request object, which must be constructed before the call. Not every API method will have a request object method.
- A "callable" method. This type of method takes no parameters and returns an immutable API callable object, which can be used to initiate calls to the service.
See the individual methods for example code.
Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.
This class can be customized by passing in a custom instance of ProjectsSettings to create(). For example:
To customize credentials:
// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
ProjectsSettings projectsSettings =
ProjectsSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
ProjectsClient projectsClient = ProjectsClient.create(projectsSettings);
To customize the endpoint:
// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
ProjectsSettings projectsSettings =
ProjectsSettings.newBuilder().setEndpoint(myEndpoint).build();
ProjectsClient projectsClient = ProjectsClient.create(projectsSettings);
To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over the wire:
// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
ProjectsSettings projectsSettings = ProjectsSettings.newHttpJsonBuilder().build();
ProjectsClient projectsClient = ProjectsClient.create(projectsSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
Implements
BackgroundResourceStatic Methods
create()
public static final ProjectsClient create()
Constructs an instance of ProjectsClient with default settings.
Returns | |
---|---|
Type | Description |
ProjectsClient |
Exceptions | |
---|---|
Type | Description |
IOException |
create(ProjectsSettings settings)
public static final ProjectsClient create(ProjectsSettings settings)
Constructs an instance of ProjectsClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.
Parameter | |
---|---|
Name | Description |
settings | ProjectsSettings |
Returns | |
---|---|
Type | Description |
ProjectsClient |
Exceptions | |
---|---|
Type | Description |
IOException |
create(ProjectsStub stub)
public static final ProjectsClient create(ProjectsStub stub)
Constructs an instance of ProjectsClient, using the given stub for making calls. This is for advanced usage - prefer using create(ProjectsSettings).
Parameter | |
---|---|
Name | Description |
stub | ProjectsStub |
Returns | |
---|---|
Type | Description |
ProjectsClient |
Constructors
ProjectsClient(ProjectsSettings settings)
protected ProjectsClient(ProjectsSettings settings)
Constructs an instance of ProjectsClient, using the given settings. This is protected so that it is easy to make a subclass, but otherwise, the static factory methods should be preferred.
Parameter | |
---|---|
Name | Description |
settings | ProjectsSettings |
ProjectsClient(ProjectsStub stub)
protected ProjectsClient(ProjectsStub stub)
Parameter | |
---|---|
Name | Description |
stub | ProjectsStub |
Methods
awaitTermination(long duration, TimeUnit unit)
public boolean awaitTermination(long duration, TimeUnit unit)
Parameters | |
---|---|
Name | Description |
duration | long |
unit | TimeUnit |
Returns | |
---|---|
Type | Description |
boolean |
Exceptions | |
---|---|
Type | Description |
InterruptedException |
close()
public final void close()
createProjectAsync(CreateProjectRequest request)
public final OperationFuture<Project,CreateProjectMetadata> createProjectAsync(CreateProjectRequest request)
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
.
Sample code:
// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ProjectsClient projectsClient = ProjectsClient.create()) {
CreateProjectRequest request =
CreateProjectRequest.newBuilder().setProject(Project.newBuilder().build()).build();
Project response = projectsClient.createProjectAsync(request).get();
}
Parameter | |
---|---|
Name | Description |
request | CreateProjectRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
OperationFuture<Project,CreateProjectMetadata> |
createProjectAsync(Project project)
public final OperationFuture<Project,CreateProjectMetadata> createProjectAsync(Project project)
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
.
Sample code:
// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ProjectsClient projectsClient = ProjectsClient.create()) {
Project project = Project.newBuilder().build();
Project response = projectsClient.createProjectAsync(project).get();
}
Parameter | |
---|---|
Name | Description |
project | Project Required. The Project to create. Project ID is required. If the requested ID is unavailable, the request fails. If the |
Returns | |
---|---|
Type | Description |
OperationFuture<Project,CreateProjectMetadata> |
createProjectCallable()
public final UnaryCallable<CreateProjectRequest,Operation> createProjectCallable()
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
.
Sample code:
// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ProjectsClient projectsClient = ProjectsClient.create()) {
CreateProjectRequest request =
CreateProjectRequest.newBuilder().setProject(Project.newBuilder().build()).build();
ApiFuture<Operation> future = projectsClient.createProjectCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<CreateProjectRequest,Operation> |
createProjectOperationCallable()
public final OperationCallable<CreateProjectRequest,Project,CreateProjectMetadata> createProjectOperationCallable()
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
.
Sample code:
// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ProjectsClient projectsClient = ProjectsClient.create()) {
CreateProjectRequest request =
CreateProjectRequest.newBuilder().setProject(Project.newBuilder().build()).build();
OperationFuture<Project, CreateProjectMetadata> future =
projectsClient.createProjectOperationCallable().futureCall(request);
// Do something.
Project response = future.get();
}
Returns | |
---|---|
Type | Description |
OperationCallable<CreateProjectRequest,Project,CreateProjectMetadata> |
deleteProjectAsync(DeleteProjectRequest request)
public final OperationFuture<Project,DeleteProjectMetadata> deleteProjectAsync(DeleteProjectRequest request)
Marks the project identified by the specified name
(for example, projects/415104041262
) for
deletion.
This method will only affect the project if it has a lifecycle state of ACTIVE.
This method changes the Project's lifecycle state from ACTIVE to DELETE_REQUESTED. The deletion starts at an unspecified time, at which point the Project is no longer accessible.
Until the deletion completes, you can check the lifecycle state checked by retrieving the project with [GetProject] [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 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.
Sample code:
// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ProjectsClient projectsClient = ProjectsClient.create()) {
DeleteProjectRequest request =
DeleteProjectRequest.newBuilder().setName(ProjectName.of("[PROJECT]").toString()).build();
Project response = projectsClient.deleteProjectAsync(request).get();
}
Parameter | |
---|---|
Name | Description |
request | DeleteProjectRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
OperationFuture<Project,DeleteProjectMetadata> |
deleteProjectAsync(ProjectName name)
public final OperationFuture<Project,DeleteProjectMetadata> deleteProjectAsync(ProjectName name)
Marks the project identified by the specified name
(for example, projects/415104041262
) for
deletion.
This method will only affect the project if it has a lifecycle state of ACTIVE.
This method changes the Project's lifecycle state from ACTIVE to DELETE_REQUESTED. The deletion starts at an unspecified time, at which point the Project is no longer accessible.
Until the deletion completes, you can check the lifecycle state checked by retrieving the project with [GetProject] [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 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.
Sample code:
// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ProjectsClient projectsClient = ProjectsClient.create()) {
ProjectName name = ProjectName.of("[PROJECT]");
Project response = projectsClient.deleteProjectAsync(name).get();
}
Parameter | |
---|---|
Name | Description |
name | ProjectName Required. The name of the Project (for example, |
Returns | |
---|---|
Type | Description |
OperationFuture<Project,DeleteProjectMetadata> |
deleteProjectAsync(String name)
public final OperationFuture<Project,DeleteProjectMetadata> deleteProjectAsync(String name)
Marks the project identified by the specified name
(for example, projects/415104041262
) for
deletion.
This method will only affect the project if it has a lifecycle state of ACTIVE.
This method changes the Project's lifecycle state from ACTIVE to DELETE_REQUESTED. The deletion starts at an unspecified time, at which point the Project is no longer accessible.
Until the deletion completes, you can check the lifecycle state checked by retrieving the project with [GetProject] [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 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.
Sample code:
// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ProjectsClient projectsClient = ProjectsClient.create()) {
String name = ProjectName.of("[PROJECT]").toString();
Project response = projectsClient.deleteProjectAsync(name).get();
}
Parameter | |
---|---|
Name | Description |
name | String Required. The name of the Project (for example, |
Returns | |
---|---|
Type | Description |
OperationFuture<Project,DeleteProjectMetadata> |
deleteProjectCallable()
public final UnaryCallable<DeleteProjectRequest,Operation> deleteProjectCallable()
Marks the project identified by the specified name
(for example, projects/415104041262
) for
deletion.
This method will only affect the project if it has a lifecycle state of ACTIVE.
This method changes the Project's lifecycle state from ACTIVE to DELETE_REQUESTED. The deletion starts at an unspecified time, at which point the Project is no longer accessible.
Until the deletion completes, you can check the lifecycle state checked by retrieving the project with [GetProject] [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 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.
Sample code:
// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ProjectsClient projectsClient = ProjectsClient.create()) {
DeleteProjectRequest request =
DeleteProjectRequest.newBuilder().setName(ProjectName.of("[PROJECT]").toString()).build();
ApiFuture<Operation> future = projectsClient.deleteProjectCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<DeleteProjectRequest,Operation> |
deleteProjectOperationCallable()
public final OperationCallable<DeleteProjectRequest,Project,DeleteProjectMetadata> deleteProjectOperationCallable()
Marks the project identified by the specified name
(for example, projects/415104041262
) for
deletion.
This method will only affect the project if it has a lifecycle state of ACTIVE.
This method changes the Project's lifecycle state from ACTIVE to DELETE_REQUESTED. The deletion starts at an unspecified time, at which point the Project is no longer accessible.
Until the deletion completes, you can check the lifecycle state checked by retrieving the project with [GetProject] [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 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.
Sample code:
// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ProjectsClient projectsClient = ProjectsClient.create()) {
DeleteProjectRequest request =
DeleteProjectRequest.newBuilder().setName(ProjectName.of("[PROJECT]").toString()).build();
OperationFuture<Project, DeleteProjectMetadata> future =
projectsClient.deleteProjectOperationCallable().futureCall(request);
// Do something.
Project response = future.get();
}
Returns | |
---|---|
Type | Description |
OperationCallable<DeleteProjectRequest,Project,DeleteProjectMetadata> |
getHttpJsonOperationsClient()
public final OperationsClient getHttpJsonOperationsClient()
Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.
Returns | |
---|---|
Type | Description |
OperationsClient |
getIamPolicy(ResourceName resource)
public final Policy getIamPolicy(ResourceName resource)
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.
Sample code:
// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ProjectsClient projectsClient = ProjectsClient.create()) {
ResourceName resource = ProjectName.of("[PROJECT]");
Policy response = projectsClient.getIamPolicy(resource);
}
Parameter | |
---|---|
Name | Description |
resource | com.google.api.resourcenames.ResourceName REQUIRED: The resource for which the policy is being requested. See the operation documentation for the appropriate value for this field. |
Returns | |
---|---|
Type | Description |
com.google.iam.v1.Policy |
getIamPolicy(GetIamPolicyRequest request)
public final Policy getIamPolicy(GetIamPolicyRequest request)
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.
Sample code:
// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ProjectsClient projectsClient = ProjectsClient.create()) {
GetIamPolicyRequest request =
GetIamPolicyRequest.newBuilder()
.setResource(ProjectName.of("[PROJECT]").toString())
.setOptions(GetPolicyOptions.newBuilder().build())
.build();
Policy response = projectsClient.getIamPolicy(request);
}
Parameter | |
---|---|
Name | Description |
request | com.google.iam.v1.GetIamPolicyRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
com.google.iam.v1.Policy |
getIamPolicy(String resource)
public final Policy getIamPolicy(String resource)
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.
Sample code:
// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ProjectsClient projectsClient = ProjectsClient.create()) {
String resource = FolderName.of("[FOLDER]").toString();
Policy response = projectsClient.getIamPolicy(resource);
}
Parameter | |
---|---|
Name | Description |
resource | String REQUIRED: The resource for which the policy is being requested. See the operation documentation for the appropriate value for this field. |
Returns | |
---|---|
Type | Description |
com.google.iam.v1.Policy |
getIamPolicyCallable()
public final UnaryCallable<GetIamPolicyRequest,Policy> getIamPolicyCallable()
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.
Sample code:
// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ProjectsClient projectsClient = ProjectsClient.create()) {
GetIamPolicyRequest request =
GetIamPolicyRequest.newBuilder()
.setResource(ProjectName.of("[PROJECT]").toString())
.setOptions(GetPolicyOptions.newBuilder().build())
.build();
ApiFuture<Policy> future = projectsClient.getIamPolicyCallable().futureCall(request);
// Do something.
Policy response = future.get();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<com.google.iam.v1.GetIamPolicyRequest,com.google.iam.v1.Policy> |
getOperationsClient()
public final OperationsClient getOperationsClient()
Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.
Returns | |
---|---|
Type | Description |
OperationsClient |
getProject(GetProjectRequest request)
public final Project getProject(GetProjectRequest request)
Retrieves the project identified by the specified name
(for example,
projects/415104041262
).
The caller must have resourcemanager.projects.get
permission for this project.
Sample code:
// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ProjectsClient projectsClient = ProjectsClient.create()) {
GetProjectRequest request =
GetProjectRequest.newBuilder().setName(ProjectName.of("[PROJECT]").toString()).build();
Project response = projectsClient.getProject(request);
}
Parameter | |
---|---|
Name | Description |
request | GetProjectRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
Project |
getProject(ProjectName name)
public final Project getProject(ProjectName name)
Retrieves the project identified by the specified name
(for example,
projects/415104041262
).
The caller must have resourcemanager.projects.get
permission for this project.
Sample code:
// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ProjectsClient projectsClient = ProjectsClient.create()) {
ProjectName name = ProjectName.of("[PROJECT]");
Project response = projectsClient.getProject(name);
}
Parameter | |
---|---|
Name | Description |
name | ProjectName Required. The name of the project (for example, |
Returns | |
---|---|
Type | Description |
Project |
getProject(String name)
public final Project getProject(String name)
Retrieves the project identified by the specified name
(for example,
projects/415104041262
).
The caller must have resourcemanager.projects.get
permission for this project.
Sample code:
// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ProjectsClient projectsClient = ProjectsClient.create()) {
String name = ProjectName.of("[PROJECT]").toString();
Project response = projectsClient.getProject(name);
}
Parameter | |
---|---|
Name | Description |
name | String Required. The name of the project (for example, |
Returns | |
---|---|
Type | Description |
Project |
getProjectCallable()
public final UnaryCallable<GetProjectRequest,Project> getProjectCallable()
Retrieves the project identified by the specified name
(for example,
projects/415104041262
).
The caller must have resourcemanager.projects.get
permission for this project.
Sample code:
// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ProjectsClient projectsClient = ProjectsClient.create()) {
GetProjectRequest request =
GetProjectRequest.newBuilder().setName(ProjectName.of("[PROJECT]").toString()).build();
ApiFuture<Project> future = projectsClient.getProjectCallable().futureCall(request);
// Do something.
Project response = future.get();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<GetProjectRequest,Project> |
getSettings()
public final ProjectsSettings getSettings()
Returns | |
---|---|
Type | Description |
ProjectsSettings |
getStub()
public ProjectsStub getStub()
Returns | |
---|---|
Type | Description |
ProjectsStub |
isShutdown()
public boolean isShutdown()
Returns | |
---|---|
Type | Description |
boolean |
isTerminated()
public boolean isTerminated()
Returns | |
---|---|
Type | Description |
boolean |
listProjects(ResourceName parent)
public final ProjectsClient.ListProjectsPagedResponse listProjects(ResourceName parent)
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.
Sample code:
// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ProjectsClient projectsClient = ProjectsClient.create()) {
ResourceName parent = FolderName.of("[FOLDER]");
for (Project element : projectsClient.listProjects(parent).iterateAll()) {
// doThingsWith(element);
}
}
Parameter | |
---|---|
Name | Description |
parent | com.google.api.resourcenames.ResourceName 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 |
Returns | |
---|---|
Type | Description |
ProjectsClient.ListProjectsPagedResponse |
listProjects(ListProjectsRequest request)
public final ProjectsClient.ListProjectsPagedResponse listProjects(ListProjectsRequest request)
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.
Sample code:
// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ProjectsClient projectsClient = ProjectsClient.create()) {
ListProjectsRequest request =
ListProjectsRequest.newBuilder()
.setParent(FolderName.of("[FOLDER]").toString())
.setPageToken("pageToken873572522")
.setPageSize(883849137)
.setShowDeleted(true)
.build();
for (Project element : projectsClient.listProjects(request).iterateAll()) {
// doThingsWith(element);
}
}
Parameter | |
---|---|
Name | Description |
request | ListProjectsRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
ProjectsClient.ListProjectsPagedResponse |
listProjects(String parent)
public final ProjectsClient.ListProjectsPagedResponse listProjects(String parent)
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.
Sample code:
// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ProjectsClient projectsClient = ProjectsClient.create()) {
String parent = FolderName.of("[FOLDER]").toString();
for (Project element : projectsClient.listProjects(parent).iterateAll()) {
// doThingsWith(element);
}
}
Parameter | |
---|---|
Name | Description |
parent | String 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 |
Returns | |
---|---|
Type | Description |
ProjectsClient.ListProjectsPagedResponse |
listProjectsCallable()
public final UnaryCallable<ListProjectsRequest,ListProjectsResponse> listProjectsCallable()
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.
Sample code:
// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ProjectsClient projectsClient = ProjectsClient.create()) {
ListProjectsRequest request =
ListProjectsRequest.newBuilder()
.setParent(FolderName.of("[FOLDER]").toString())
.setPageToken("pageToken873572522")
.setPageSize(883849137)
.setShowDeleted(true)
.build();
while (true) {
ListProjectsResponse response = projectsClient.listProjectsCallable().call(request);
for (Project element : response.getProjectsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
Returns | |
---|---|
Type | Description |
UnaryCallable<ListProjectsRequest,ListProjectsResponse> |
listProjectsPagedCallable()
public final UnaryCallable<ListProjectsRequest,ProjectsClient.ListProjectsPagedResponse> listProjectsPagedCallable()
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.
Sample code:
// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ProjectsClient projectsClient = ProjectsClient.create()) {
ListProjectsRequest request =
ListProjectsRequest.newBuilder()
.setParent(FolderName.of("[FOLDER]").toString())
.setPageToken("pageToken873572522")
.setPageSize(883849137)
.setShowDeleted(true)
.build();
ApiFuture<Project> future = projectsClient.listProjectsPagedCallable().futureCall(request);
// Do something.
for (Project element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
Returns | |
---|---|
Type | Description |
UnaryCallable<ListProjectsRequest,ListProjectsPagedResponse> |
moveProjectAsync(MoveProjectRequest request)
public final OperationFuture<Project,MoveProjectMetadata> moveProjectAsync(MoveProjectRequest request)
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.
Sample code:
// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ProjectsClient projectsClient = ProjectsClient.create()) {
MoveProjectRequest request =
MoveProjectRequest.newBuilder()
.setName(ProjectName.of("[PROJECT]").toString())
.setDestinationParent(ProjectName.of("[PROJECT]").toString())
.build();
Project response = projectsClient.moveProjectAsync(request).get();
}
Parameter | |
---|---|
Name | Description |
request | MoveProjectRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
OperationFuture<Project,MoveProjectMetadata> |
moveProjectAsync(ProjectName name, ResourceName destinationParent)
public final OperationFuture<Project,MoveProjectMetadata> moveProjectAsync(ProjectName name, ResourceName destinationParent)
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.
Sample code:
// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ProjectsClient projectsClient = ProjectsClient.create()) {
ProjectName name = ProjectName.of("[PROJECT]");
ResourceName destinationParent = ProjectName.of("[PROJECT]");
Project response = projectsClient.moveProjectAsync(name, destinationParent).get();
}
Parameters | |
---|---|
Name | Description |
name | ProjectName Required. The name of the project to move. |
destinationParent | com.google.api.resourcenames.ResourceName Required. The new parent to move the Project under. |
Returns | |
---|---|
Type | Description |
OperationFuture<Project,MoveProjectMetadata> |
moveProjectAsync(ProjectName name, String destinationParent)
public final OperationFuture<Project,MoveProjectMetadata> moveProjectAsync(ProjectName name, String destinationParent)
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.
Sample code:
// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ProjectsClient projectsClient = ProjectsClient.create()) {
ProjectName name = ProjectName.of("[PROJECT]");
String destinationParent = FolderName.of("[FOLDER]").toString();
Project response = projectsClient.moveProjectAsync(name, destinationParent).get();
}
Parameters | |
---|---|
Name | Description |
name | ProjectName Required. The name of the project to move. |
destinationParent | String Required. The new parent to move the Project under. |
Returns | |
---|---|
Type | Description |
OperationFuture<Project,MoveProjectMetadata> |
moveProjectAsync(String name, ResourceName destinationParent)
public final OperationFuture<Project,MoveProjectMetadata> moveProjectAsync(String name, ResourceName destinationParent)
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.
Sample code:
// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ProjectsClient projectsClient = ProjectsClient.create()) {
String name = ProjectName.of("[PROJECT]").toString();
ResourceName destinationParent = ProjectName.of("[PROJECT]");
Project response = projectsClient.moveProjectAsync(name, destinationParent).get();
}
Parameters | |
---|---|
Name | Description |
name | String Required. The name of the project to move. |
destinationParent | com.google.api.resourcenames.ResourceName Required. The new parent to move the Project under. |
Returns | |
---|---|
Type | Description |
OperationFuture<Project,MoveProjectMetadata> |
moveProjectAsync(String name, String destinationParent)
public final OperationFuture<Project,MoveProjectMetadata> moveProjectAsync(String name, String destinationParent)
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.
Sample code:
// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ProjectsClient projectsClient = ProjectsClient.create()) {
String name = ProjectName.of("[PROJECT]").toString();
String destinationParent = FolderName.of("[FOLDER]").toString();
Project response = projectsClient.moveProjectAsync(name, destinationParent).get();
}
Parameters | |
---|---|
Name | Description |
name | String Required. The name of the project to move. |
destinationParent | String Required. The new parent to move the Project under. |
Returns | |
---|---|
Type | Description |
OperationFuture<Project,MoveProjectMetadata> |
moveProjectCallable()
public final UnaryCallable<MoveProjectRequest,Operation> moveProjectCallable()
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.
Sample code:
// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ProjectsClient projectsClient = ProjectsClient.create()) {
MoveProjectRequest request =
MoveProjectRequest.newBuilder()
.setName(ProjectName.of("[PROJECT]").toString())
.setDestinationParent(ProjectName.of("[PROJECT]").toString())
.build();
ApiFuture<Operation> future = projectsClient.moveProjectCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<MoveProjectRequest,Operation> |
moveProjectOperationCallable()
public final OperationCallable<MoveProjectRequest,Project,MoveProjectMetadata> moveProjectOperationCallable()
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.
Sample code:
// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ProjectsClient projectsClient = ProjectsClient.create()) {
MoveProjectRequest request =
MoveProjectRequest.newBuilder()
.setName(ProjectName.of("[PROJECT]").toString())
.setDestinationParent(ProjectName.of("[PROJECT]").toString())
.build();
OperationFuture<Project, MoveProjectMetadata> future =
projectsClient.moveProjectOperationCallable().futureCall(request);
// Do something.
Project response = future.get();
}
Returns | |
---|---|
Type | Description |
OperationCallable<MoveProjectRequest,Project,MoveProjectMetadata> |
searchProjects(SearchProjectsRequest request)
public final ProjectsClient.SearchProjectsPagedResponse searchProjects(SearchProjectsRequest request)
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.
Sample code:
// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ProjectsClient projectsClient = ProjectsClient.create()) {
SearchProjectsRequest request =
SearchProjectsRequest.newBuilder()
.setQuery("query107944136")
.setPageToken("pageToken873572522")
.setPageSize(883849137)
.build();
for (Project element : projectsClient.searchProjects(request).iterateAll()) {
// doThingsWith(element);
}
}
Parameter | |
---|---|
Name | Description |
request | SearchProjectsRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
ProjectsClient.SearchProjectsPagedResponse |
searchProjects(String query)
public final ProjectsClient.SearchProjectsPagedResponse searchProjects(String query)
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.
Sample code:
// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ProjectsClient projectsClient = ProjectsClient.create()) {
String query = "query107944136";
for (Project element : projectsClient.searchProjects(query).iterateAll()) {
// doThingsWith(element);
}
}
Parameter | |
---|---|
Name | Description |
query | String Optional. A query string for searching for projects that the caller has
|
Returns | |
---|---|
Type | Description |
ProjectsClient.SearchProjectsPagedResponse |
searchProjectsCallable()
public final UnaryCallable<SearchProjectsRequest,SearchProjectsResponse> searchProjectsCallable()
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.
Sample code:
// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ProjectsClient projectsClient = ProjectsClient.create()) {
SearchProjectsRequest request =
SearchProjectsRequest.newBuilder()
.setQuery("query107944136")
.setPageToken("pageToken873572522")
.setPageSize(883849137)
.build();
while (true) {
SearchProjectsResponse response = projectsClient.searchProjectsCallable().call(request);
for (Project element : response.getProjectsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
Returns | |
---|---|
Type | Description |
UnaryCallable<SearchProjectsRequest,SearchProjectsResponse> |
searchProjectsPagedCallable()
public final UnaryCallable<SearchProjectsRequest,ProjectsClient.SearchProjectsPagedResponse> searchProjectsPagedCallable()
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.
Sample code:
// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ProjectsClient projectsClient = ProjectsClient.create()) {
SearchProjectsRequest request =
SearchProjectsRequest.newBuilder()
.setQuery("query107944136")
.setPageToken("pageToken873572522")
.setPageSize(883849137)
.build();
ApiFuture<Project> future = projectsClient.searchProjectsPagedCallable().futureCall(request);
// Do something.
for (Project element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
Returns | |
---|---|
Type | Description |
UnaryCallable<SearchProjectsRequest,SearchProjectsPagedResponse> |
setIamPolicy(ResourceName resource, Policy policy)
public final Policy setIamPolicy(ResourceName resource, Policy policy)
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.
Sample code:
// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ProjectsClient projectsClient = ProjectsClient.create()) {
ResourceName resource = ProjectName.of("[PROJECT]");
Policy policy = Policy.newBuilder().build();
Policy response = projectsClient.setIamPolicy(resource, policy);
}
Parameters | |
---|---|
Name | Description |
resource | com.google.api.resourcenames.ResourceName REQUIRED: The resource for which the policy is being specified. See the operation documentation for the appropriate value for this field. |
policy | com.google.iam.v1.Policy REQUIRED: The complete policy to be applied to the |
Returns | |
---|---|
Type | Description |
com.google.iam.v1.Policy |
setIamPolicy(SetIamPolicyRequest request)
public final Policy setIamPolicy(SetIamPolicyRequest request)
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.
Sample code:
// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ProjectsClient projectsClient = ProjectsClient.create()) {
SetIamPolicyRequest request =
SetIamPolicyRequest.newBuilder()
.setResource(ProjectName.of("[PROJECT]").toString())
.setPolicy(Policy.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
Policy response = projectsClient.setIamPolicy(request);
}
Parameter | |
---|---|
Name | Description |
request | com.google.iam.v1.SetIamPolicyRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
com.google.iam.v1.Policy |
setIamPolicy(String resource, Policy policy)
public final Policy setIamPolicy(String resource, Policy policy)
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.
Sample code:
// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ProjectsClient projectsClient = ProjectsClient.create()) {
String resource = FolderName.of("[FOLDER]").toString();
Policy policy = Policy.newBuilder().build();
Policy response = projectsClient.setIamPolicy(resource, policy);
}
Parameters | |
---|---|
Name | Description |
resource | String REQUIRED: The resource for which the policy is being specified. See the operation documentation for the appropriate value for this field. |
policy | com.google.iam.v1.Policy REQUIRED: The complete policy to be applied to the |
Returns | |
---|---|
Type | Description |
com.google.iam.v1.Policy |
setIamPolicyCallable()
public final UnaryCallable<SetIamPolicyRequest,Policy> setIamPolicyCallable()
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.
Sample code:
// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ProjectsClient projectsClient = ProjectsClient.create()) {
SetIamPolicyRequest request =
SetIamPolicyRequest.newBuilder()
.setResource(ProjectName.of("[PROJECT]").toString())
.setPolicy(Policy.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
ApiFuture<Policy> future = projectsClient.setIamPolicyCallable().futureCall(request);
// Do something.
Policy response = future.get();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<com.google.iam.v1.SetIamPolicyRequest,com.google.iam.v1.Policy> |
shutdown()
public void shutdown()
shutdownNow()
public void shutdownNow()
testIamPermissions(ResourceName resource, List<String> permissions)
public final TestIamPermissionsResponse testIamPermissions(ResourceName resource, List<String> permissions)
Returns permissions that a caller has on the specified project, in the format
projects/{ProjectIdOrNumber}
e.g. projects/123..
Sample code:
// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ProjectsClient projectsClient = ProjectsClient.create()) {
ResourceName resource = ProjectName.of("[PROJECT]");
List<String> permissions = new ArrayList<>();
TestIamPermissionsResponse response =
projectsClient.testIamPermissions(resource, permissions);
}
Parameters | |
---|---|
Name | Description |
resource | com.google.api.resourcenames.ResourceName REQUIRED: The resource for which the policy detail is being requested. See the operation documentation for the appropriate value for this field. |
permissions | List<String> The set of permissions to check for the |
Returns | |
---|---|
Type | Description |
com.google.iam.v1.TestIamPermissionsResponse |
testIamPermissions(TestIamPermissionsRequest request)
public final TestIamPermissionsResponse testIamPermissions(TestIamPermissionsRequest request)
Returns permissions that a caller has on the specified project, in the format
projects/{ProjectIdOrNumber}
e.g. projects/123..
Sample code:
// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ProjectsClient projectsClient = ProjectsClient.create()) {
TestIamPermissionsRequest request =
TestIamPermissionsRequest.newBuilder()
.setResource(ProjectName.of("[PROJECT]").toString())
.addAllPermissions(new ArrayList<String>())
.build();
TestIamPermissionsResponse response = projectsClient.testIamPermissions(request);
}
Parameter | |
---|---|
Name | Description |
request | com.google.iam.v1.TestIamPermissionsRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
com.google.iam.v1.TestIamPermissionsResponse |
testIamPermissions(String resource, List<String> permissions)
public final TestIamPermissionsResponse testIamPermissions(String resource, List<String> permissions)
Returns permissions that a caller has on the specified project, in the format
projects/{ProjectIdOrNumber}
e.g. projects/123..
Sample code:
// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ProjectsClient projectsClient = ProjectsClient.create()) {
String resource = FolderName.of("[FOLDER]").toString();
List<String> permissions = new ArrayList<>();
TestIamPermissionsResponse response =
projectsClient.testIamPermissions(resource, permissions);
}
Parameters | |
---|---|
Name | Description |
resource | String REQUIRED: The resource for which the policy detail is being requested. See the operation documentation for the appropriate value for this field. |
permissions | List<String> The set of permissions to check for the |
Returns | |
---|---|
Type | Description |
com.google.iam.v1.TestIamPermissionsResponse |
testIamPermissionsCallable()
public final UnaryCallable<TestIamPermissionsRequest,TestIamPermissionsResponse> testIamPermissionsCallable()
Returns permissions that a caller has on the specified project, in the format
projects/{ProjectIdOrNumber}
e.g. projects/123..
Sample code:
// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ProjectsClient projectsClient = ProjectsClient.create()) {
TestIamPermissionsRequest request =
TestIamPermissionsRequest.newBuilder()
.setResource(ProjectName.of("[PROJECT]").toString())
.addAllPermissions(new ArrayList<String>())
.build();
ApiFuture<TestIamPermissionsResponse> future =
projectsClient.testIamPermissionsCallable().futureCall(request);
// Do something.
TestIamPermissionsResponse response = future.get();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<com.google.iam.v1.TestIamPermissionsRequest,com.google.iam.v1.TestIamPermissionsResponse> |
undeleteProjectAsync(ProjectName name)
public final OperationFuture<Project,UndeleteProjectMetadata> undeleteProjectAsync(ProjectName name)
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.
Sample code:
// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ProjectsClient projectsClient = ProjectsClient.create()) {
ProjectName name = ProjectName.of("[PROJECT]");
Project response = projectsClient.undeleteProjectAsync(name).get();
}
Parameter | |
---|---|
Name | Description |
name | ProjectName Required. The name of the project (for example, Required. |
Returns | |
---|---|
Type | Description |
OperationFuture<Project,UndeleteProjectMetadata> |
undeleteProjectAsync(UndeleteProjectRequest request)
public final OperationFuture<Project,UndeleteProjectMetadata> undeleteProjectAsync(UndeleteProjectRequest request)
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.
Sample code:
// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ProjectsClient projectsClient = ProjectsClient.create()) {
UndeleteProjectRequest request =
UndeleteProjectRequest.newBuilder()
.setName(ProjectName.of("[PROJECT]").toString())
.build();
Project response = projectsClient.undeleteProjectAsync(request).get();
}
Parameter | |
---|---|
Name | Description |
request | UndeleteProjectRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
OperationFuture<Project,UndeleteProjectMetadata> |
undeleteProjectAsync(String name)
public final OperationFuture<Project,UndeleteProjectMetadata> undeleteProjectAsync(String name)
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.
Sample code:
// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ProjectsClient projectsClient = ProjectsClient.create()) {
String name = ProjectName.of("[PROJECT]").toString();
Project response = projectsClient.undeleteProjectAsync(name).get();
}
Parameter | |
---|---|
Name | Description |
name | String Required. The name of the project (for example, Required. |
Returns | |
---|---|
Type | Description |
OperationFuture<Project,UndeleteProjectMetadata> |
undeleteProjectCallable()
public final UnaryCallable<UndeleteProjectRequest,Operation> undeleteProjectCallable()
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.
Sample code:
// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ProjectsClient projectsClient = ProjectsClient.create()) {
UndeleteProjectRequest request =
UndeleteProjectRequest.newBuilder()
.setName(ProjectName.of("[PROJECT]").toString())
.build();
ApiFuture<Operation> future = projectsClient.undeleteProjectCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<UndeleteProjectRequest,Operation> |
undeleteProjectOperationCallable()
public final OperationCallable<UndeleteProjectRequest,Project,UndeleteProjectMetadata> undeleteProjectOperationCallable()
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.
Sample code:
// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ProjectsClient projectsClient = ProjectsClient.create()) {
UndeleteProjectRequest request =
UndeleteProjectRequest.newBuilder()
.setName(ProjectName.of("[PROJECT]").toString())
.build();
OperationFuture<Project, UndeleteProjectMetadata> future =
projectsClient.undeleteProjectOperationCallable().futureCall(request);
// Do something.
Project response = future.get();
}
Returns | |
---|---|
Type | Description |
OperationCallable<UndeleteProjectRequest,Project,UndeleteProjectMetadata> |
updateProjectAsync(Project project, FieldMask updateMask)
public final OperationFuture<Project,UpdateProjectMetadata> updateProjectAsync(Project project, FieldMask updateMask)
Updates the display_name
and labels of the project identified by the specified name
(for
example, projects/415104041262
). Deleting all labels requires an update mask for labels
field.
The caller must have resourcemanager.projects.update
permission for this project.
Sample code:
// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ProjectsClient projectsClient = ProjectsClient.create()) {
Project project = Project.newBuilder().build();
FieldMask updateMask = FieldMask.newBuilder().build();
Project response = projectsClient.updateProjectAsync(project, updateMask).get();
}
Parameters | |
---|---|
Name | Description |
project | Project Required. The new definition of the project. |
updateMask | FieldMask Optional. An update mask to selectively update fields. |
Returns | |
---|---|
Type | Description |
OperationFuture<Project,UpdateProjectMetadata> |
updateProjectAsync(UpdateProjectRequest request)
public final OperationFuture<Project,UpdateProjectMetadata> updateProjectAsync(UpdateProjectRequest request)
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.
Sample code:
// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ProjectsClient projectsClient = ProjectsClient.create()) {
UpdateProjectRequest request =
UpdateProjectRequest.newBuilder()
.setProject(Project.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
Project response = projectsClient.updateProjectAsync(request).get();
}
Parameter | |
---|---|
Name | Description |
request | UpdateProjectRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
OperationFuture<Project,UpdateProjectMetadata> |
updateProjectCallable()
public final UnaryCallable<UpdateProjectRequest,Operation> updateProjectCallable()
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.
Sample code:
// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ProjectsClient projectsClient = ProjectsClient.create()) {
UpdateProjectRequest request =
UpdateProjectRequest.newBuilder()
.setProject(Project.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
ApiFuture<Operation> future = projectsClient.updateProjectCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<UpdateProjectRequest,Operation> |
updateProjectOperationCallable()
public final OperationCallable<UpdateProjectRequest,Project,UpdateProjectMetadata> updateProjectOperationCallable()
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.
Sample code:
// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ProjectsClient projectsClient = ProjectsClient.create()) {
UpdateProjectRequest request =
UpdateProjectRequest.newBuilder()
.setProject(Project.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
OperationFuture<Project, UpdateProjectMetadata> future =
projectsClient.updateProjectOperationCallable().futureCall(request);
// Do something.
Project response = future.get();
}
Returns | |
---|---|
Type | Description |
OperationCallable<UpdateProjectRequest,Project,UpdateProjectMetadata> |