Class ProjectsClient

  • All Implemented Interfaces:
    com.google.api.gax.core.BackgroundResource, AutoCloseable

    @Generated("by gapic-generator-java")
    public class ProjectsClient
    extends Object
    implements com.google.api.gax.core.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:

    1. 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.
    2. 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.
    3. 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.

    • Constructor Detail

      • ProjectsClient

        protected ProjectsClient​(ProjectsSettings settings)
                          throws IOException
        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.
        Throws:
        IOException
      • ProjectsClient

        protected ProjectsClient​(ProjectsStub stub)
    • Method Detail

      • create

        public static final ProjectsClient create​(ProjectsSettings settings)
                                           throws IOException
        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.
        Throws:
        IOException
      • create

        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).
      • getOperationsClient

        public final com.google.longrunning.OperationsClient getOperationsClient()
        Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.
      • getHttpJsonOperationsClient

        @BetaApi
        public final com.google.api.gax.httpjson.longrunning.OperationsClient getHttpJsonOperationsClient()
        Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.
      • getProject

        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);
         }
         
        Parameters:
        name - Required. The name of the project (for example, `projects/415104041262`).
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • getProject

        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);
         }
         
        Parameters:
        name - Required. The name of the project (for example, `projects/415104041262`).
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • getProject

        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);
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • getProjectCallable

        public final com.google.api.gax.rpc.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();
         }
         
      • listProjects

        public final ProjectsClient.ListProjectsPagedResponse listProjects​(com.google.api.resourcenames.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);
           }
         }
         
        Parameters:
        parent - Required. The name of the parent resource whose projects are being listed. Only children of this parent resource are listed; descendants are not listed.

        If the parent is a folder, use the value `folders/{folder_id}`. If the parent is an organization, use the value `organizations/{org_id}`.

        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • listProjects

        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);
           }
         }
         
        Parameters:
        parent - Required. The name of the parent resource whose projects are being listed. Only children of this parent resource are listed; descendants are not listed.

        If the parent is a folder, use the value `folders/{folder_id}`. If the parent is an organization, use the value `organizations/{org_id}`.

        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • listProjects

        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);
           }
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • listProjectsPagedCallable

        public final com.google.api.gax.rpc.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);
           }
         }
         
      • listProjectsCallable

        public final com.google.api.gax.rpc.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;
             }
           }
         }
         
      • searchProjects

        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][google.cloud.resourcemanager.v3.Projects.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);
           }
         }
         
        Parameters:
        query - Optional. A query string for searching for projects that the caller has `resourcemanager.projects.get` permission to. If multiple fields are included in the query, then it will return results that match any of the fields. Some eligible fields are:

        - **`displayName`, `name`**: Filters by displayName. - **`parent`**: Project's parent (for example: `folders/123`, `organizations/*`). Prefer `parent` field over `parent.type` and `parent.id`. - **`parent.type`**: Parent's type: `folder` or `organization`. - **`parent.id`**: Parent's id number (for example: `123`). - **`id`, `projectId`**: Filters by projectId. - **`state`, `lifecycleState`**: Filters by state. - **`labels`**: Filters by label name or value. - **`labels.<key>` (where `<key>` is the name of a label)**: Filters by label name.

        Search expressions are case insensitive.

        Some examples queries:

        - **`name:how*`**: The project's name starts with "how". - **`name:Howl`**: The project's name is `Howl` or `howl`. - **`name:HOWL`**: Equivalent to above. - **`NAME:howl`**: Equivalent to above. - **`labels.color:*`**: The project has the label `color`. - **`labels.color:red`**: The project's label `color` has the value `red`. - **`labels.color:red labels.size:big`**: The project's label `color` has the value `red` or its label `size` has the value `big`.

        If no query is specified, the call will return projects for which the user has the `resourcemanager.projects.get` permission.

        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • searchProjects

        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][google.cloud.resourcemanager.v3.Projects.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);
           }
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • searchProjectsPagedCallable

        public final com.google.api.gax.rpc.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][google.cloud.resourcemanager.v3.Projects.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);
           }
         }
         
      • searchProjectsCallable

        public final com.google.api.gax.rpc.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][google.cloud.resourcemanager.v3.Projects.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;
             }
           }
         }
         
      • createProjectAsync

        public final com.google.api.gax.longrunning.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();
         }
         
        Parameters:
        project - Required. The Project to create.

        Project ID is required. If the requested ID is unavailable, the request fails.

        If the `parent` field is set, the `resourcemanager.projects.create` permission is checked on the parent resource. If no parent is set and the authorization credentials belong to an Organization, the parent will be set to that Organization.

        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • createProjectAsync

        public final com.google.api.gax.longrunning.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();
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • createProjectOperationCallable

        public final com.google.api.gax.rpc.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();
         }
         
      • createProjectCallable

        public final com.google.api.gax.rpc.UnaryCallable<CreateProjectRequest,​com.google.longrunning.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();
         }
         
      • updateProjectAsync

        public final com.google.api.gax.longrunning.OperationFuture<Project,​UpdateProjectMetadata> updateProjectAsync​(Project project,
                                                                                                                            com.google.protobuf.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:
        project - Required. The new definition of the project.
        updateMask - Optional. An update mask to selectively update fields.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • updateProjectAsync

        public final com.google.api.gax.longrunning.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();
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • updateProjectOperationCallable

        public final com.google.api.gax.rpc.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();
         }
         
      • updateProjectCallable

        public final com.google.api.gax.rpc.UnaryCallable<UpdateProjectRequest,​com.google.longrunning.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();
         }
         
      • moveProjectAsync

        public final com.google.api.gax.longrunning.OperationFuture<Project,​MoveProjectMetadata> moveProjectAsync​(ProjectName name,
                                                                                                                        com.google.api.resourcenames.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 - Required. The name of the project to move.
        destinationParent - Required. The new parent to move the Project under.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • moveProjectAsync

        public final com.google.api.gax.longrunning.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 - Required. The name of the project to move.
        destinationParent - Required. The new parent to move the Project under.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • moveProjectAsync

        public final com.google.api.gax.longrunning.OperationFuture<Project,​MoveProjectMetadata> moveProjectAsync​(String name,
                                                                                                                        com.google.api.resourcenames.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 - Required. The name of the project to move.
        destinationParent - Required. The new parent to move the Project under.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • moveProjectAsync

        public final com.google.api.gax.longrunning.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 - Required. The name of the project to move.
        destinationParent - Required. The new parent to move the Project under.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • moveProjectAsync

        public final com.google.api.gax.longrunning.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();
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • moveProjectOperationCallable

        public final com.google.api.gax.rpc.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();
         }
         
      • moveProjectCallable

        public final com.google.api.gax.rpc.UnaryCallable<MoveProjectRequest,​com.google.longrunning.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();
         }
         
      • deleteProjectAsync

        public final com.google.api.gax.longrunning.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][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.

        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();
         }
         
        Parameters:
        name - Required. The name of the Project (for example, `projects/415104041262`).
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • deleteProjectAsync

        public final com.google.api.gax.longrunning.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][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.

        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();
         }
         
        Parameters:
        name - Required. The name of the Project (for example, `projects/415104041262`).
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • deleteProjectAsync

        public final com.google.api.gax.longrunning.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][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.

        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();
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • deleteProjectOperationCallable

        public final com.google.api.gax.rpc.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][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.

        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();
         }
         
      • deleteProjectCallable

        public final com.google.api.gax.rpc.UnaryCallable<DeleteProjectRequest,​com.google.longrunning.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][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.

        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();
         }
         
      • undeleteProjectAsync

        public final com.google.api.gax.longrunning.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();
         }
         
        Parameters:
        name - Required. The name of the project (for example, `projects/415104041262`).

        Required.

        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • undeleteProjectAsync

        public final com.google.api.gax.longrunning.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();
         }
         
        Parameters:
        name - Required. The name of the project (for example, `projects/415104041262`).

        Required.

        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • undeleteProjectAsync

        public final com.google.api.gax.longrunning.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();
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • undeleteProjectOperationCallable

        public final com.google.api.gax.rpc.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();
         }
         
      • undeleteProjectCallable

        public final com.google.api.gax.rpc.UnaryCallable<UndeleteProjectRequest,​com.google.longrunning.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();
         }
         
      • getIamPolicy

        public final com.google.iam.v1.Policy getIamPolicy​(com.google.api.resourcenames.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);
         }
         
        Parameters:
        resource - REQUIRED: The resource for which the policy is being requested. See the operation documentation for the appropriate value for this field.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • getIamPolicy

        public final com.google.iam.v1.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);
         }
         
        Parameters:
        resource - REQUIRED: The resource for which the policy is being requested. See the operation documentation for the appropriate value for this field.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • getIamPolicy

        public final com.google.iam.v1.Policy getIamPolicy​(com.google.iam.v1.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);
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • getIamPolicyCallable

        public final com.google.api.gax.rpc.UnaryCallable<com.google.iam.v1.GetIamPolicyRequest,​com.google.iam.v1.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();
         }
         
      • setIamPolicy

        public final com.google.iam.v1.Policy setIamPolicy​(com.google.api.resourcenames.ResourceName resource,
                                                           com.google.iam.v1.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:
        resource - REQUIRED: The resource for which the policy is being specified. See the operation documentation for the appropriate value for this field.
        policy - REQUIRED: The complete policy to be applied to the `resource`. The size of the policy is limited to a few 10s of KB. An empty policy is a valid policy but certain Cloud Platform services (such as Projects) might reject them.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • setIamPolicy

        public final com.google.iam.v1.Policy setIamPolicy​(String resource,
                                                           com.google.iam.v1.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:
        resource - REQUIRED: The resource for which the policy is being specified. See the operation documentation for the appropriate value for this field.
        policy - REQUIRED: The complete policy to be applied to the `resource`. The size of the policy is limited to a few 10s of KB. An empty policy is a valid policy but certain Cloud Platform services (such as Projects) might reject them.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • setIamPolicy

        public final com.google.iam.v1.Policy setIamPolicy​(com.google.iam.v1.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);
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • setIamPolicyCallable

        public final com.google.api.gax.rpc.UnaryCallable<com.google.iam.v1.SetIamPolicyRequest,​com.google.iam.v1.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();
         }
         
      • testIamPermissions

        public final com.google.iam.v1.TestIamPermissionsResponse testIamPermissions​(com.google.api.resourcenames.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:
        resource - REQUIRED: The resource for which the policy detail is being requested. See the operation documentation for the appropriate value for this field.
        permissions - The set of permissions to check for the `resource`. Permissions with wildcards (such as '*' or 'storage.*') are not allowed. For more information see [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions).
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • testIamPermissions

        public final com.google.iam.v1.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:
        resource - REQUIRED: The resource for which the policy detail is being requested. See the operation documentation for the appropriate value for this field.
        permissions - The set of permissions to check for the `resource`. Permissions with wildcards (such as '*' or 'storage.*') are not allowed. For more information see [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions).
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • testIamPermissions

        public final com.google.iam.v1.TestIamPermissionsResponse testIamPermissions​(com.google.iam.v1.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);
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • testIamPermissionsCallable

        public final com.google.api.gax.rpc.UnaryCallable<com.google.iam.v1.TestIamPermissionsRequest,​com.google.iam.v1.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();
         }
         
      • shutdown

        public void shutdown()
        Specified by:
        shutdown in interface com.google.api.gax.core.BackgroundResource
      • isShutdown

        public boolean isShutdown()
        Specified by:
        isShutdown in interface com.google.api.gax.core.BackgroundResource
      • isTerminated

        public boolean isTerminated()
        Specified by:
        isTerminated in interface com.google.api.gax.core.BackgroundResource
      • shutdownNow

        public void shutdownNow()
        Specified by:
        shutdownNow in interface com.google.api.gax.core.BackgroundResource