Class MetadataServiceClient

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

    @Generated("by gapic-generator-java")
    public class MetadataServiceClient
    extends Object
    implements com.google.api.gax.core.BackgroundResource
    Service Description: Metadata service manages metadata resources such as tables, filesets and partitions.

    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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) {
       ZoneName parent = ZoneName.of("[PROJECT]", "[LOCATION]", "[LAKE]", "[ZONE]");
       Entity entity = Entity.newBuilder().build();
       Entity response = metadataServiceClient.createEntity(parent, entity);
     }
     

    Note: close() needs to be called on the MetadataServiceClient 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 MetadataServiceSettings 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
     MetadataServiceSettings metadataServiceSettings =
         MetadataServiceSettings.newBuilder()
             .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
             .build();
     MetadataServiceClient metadataServiceClient =
         MetadataServiceClient.create(metadataServiceSettings);
     

    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
     MetadataServiceSettings metadataServiceSettings =
         MetadataServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
     MetadataServiceClient metadataServiceClient =
         MetadataServiceClient.create(metadataServiceSettings);
     

    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
     MetadataServiceSettings metadataServiceSettings =
         MetadataServiceSettings.newHttpJsonBuilder().build();
     MetadataServiceClient metadataServiceClient =
         MetadataServiceClient.create(metadataServiceSettings);
     

    Please refer to the GitHub repository's samples for more quickstart code snippets.

    • Constructor Detail

      • MetadataServiceClient

        protected MetadataServiceClient​(MetadataServiceSettings settings)
                                 throws IOException
        Constructs an instance of MetadataServiceClient, 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
    • Method Detail

      • create

        public static final MetadataServiceClient create​(MetadataServiceStub stub)
        Constructs an instance of MetadataServiceClient, using the given stub for making calls. This is for advanced usage - prefer using create(MetadataServiceSettings).
      • createEntity

        public final Entity createEntity​(ZoneName parent,
                                         Entity entity)
        Create a metadata entity.

        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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) {
           ZoneName parent = ZoneName.of("[PROJECT]", "[LOCATION]", "[LAKE]", "[ZONE]");
           Entity entity = Entity.newBuilder().build();
           Entity response = metadataServiceClient.createEntity(parent, entity);
         }
         
        Parameters:
        parent - Required. The resource name of the parent zone: `projects/{project_number}/locations/{location_id}/lakes/{lake_id}/zones/{zone_id}`.
        entity - Required. Entity resource.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • createEntity

        public final Entity createEntity​(String parent,
                                         Entity entity)
        Create a metadata entity.

        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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) {
           String parent = ZoneName.of("[PROJECT]", "[LOCATION]", "[LAKE]", "[ZONE]").toString();
           Entity entity = Entity.newBuilder().build();
           Entity response = metadataServiceClient.createEntity(parent, entity);
         }
         
        Parameters:
        parent - Required. The resource name of the parent zone: `projects/{project_number}/locations/{location_id}/lakes/{lake_id}/zones/{zone_id}`.
        entity - Required. Entity resource.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • createEntity

        public final Entity createEntity​(CreateEntityRequest request)
        Create a metadata entity.

        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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) {
           CreateEntityRequest request =
               CreateEntityRequest.newBuilder()
                   .setParent(ZoneName.of("[PROJECT]", "[LOCATION]", "[LAKE]", "[ZONE]").toString())
                   .setEntity(Entity.newBuilder().build())
                   .setValidateOnly(true)
                   .build();
           Entity response = metadataServiceClient.createEntity(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
      • createEntityCallable

        public final com.google.api.gax.rpc.UnaryCallable<CreateEntityRequest,​Entity> createEntityCallable()
        Create a metadata entity.

        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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) {
           CreateEntityRequest request =
               CreateEntityRequest.newBuilder()
                   .setParent(ZoneName.of("[PROJECT]", "[LOCATION]", "[LAKE]", "[ZONE]").toString())
                   .setEntity(Entity.newBuilder().build())
                   .setValidateOnly(true)
                   .build();
           ApiFuture<Entity> future = metadataServiceClient.createEntityCallable().futureCall(request);
           // Do something.
           Entity response = future.get();
         }
         
      • updateEntity

        public final Entity updateEntity​(UpdateEntityRequest request)
        Update a metadata entity. Only supports full resource update.

        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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) {
           UpdateEntityRequest request =
               UpdateEntityRequest.newBuilder()
                   .setEntity(Entity.newBuilder().build())
                   .setValidateOnly(true)
                   .build();
           Entity response = metadataServiceClient.updateEntity(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
      • updateEntityCallable

        public final com.google.api.gax.rpc.UnaryCallable<UpdateEntityRequest,​Entity> updateEntityCallable()
        Update a metadata entity. Only supports full resource update.

        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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) {
           UpdateEntityRequest request =
               UpdateEntityRequest.newBuilder()
                   .setEntity(Entity.newBuilder().build())
                   .setValidateOnly(true)
                   .build();
           ApiFuture<Entity> future = metadataServiceClient.updateEntityCallable().futureCall(request);
           // Do something.
           Entity response = future.get();
         }
         
      • deleteEntity

        public final void deleteEntity​(EntityName name)
        Delete a metadata entity.

        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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) {
           EntityName name = EntityName.of("[PROJECT]", "[LOCATION]", "[LAKE]", "[ZONE]", "[ENTITY]");
           metadataServiceClient.deleteEntity(name);
         }
         
        Parameters:
        name - Required. The resource name of the entity: `projects/{project_number}/locations/{location_id}/lakes/{lake_id}/zones/{zone_id}/entities/{entity_id}`.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • deleteEntity

        public final void deleteEntity​(String name)
        Delete a metadata entity.

        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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) {
           String name =
               EntityName.of("[PROJECT]", "[LOCATION]", "[LAKE]", "[ZONE]", "[ENTITY]").toString();
           metadataServiceClient.deleteEntity(name);
         }
         
        Parameters:
        name - Required. The resource name of the entity: `projects/{project_number}/locations/{location_id}/lakes/{lake_id}/zones/{zone_id}/entities/{entity_id}`.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • deleteEntity

        public final void deleteEntity​(DeleteEntityRequest request)
        Delete a metadata entity.

        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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) {
           DeleteEntityRequest request =
               DeleteEntityRequest.newBuilder()
                   .setName(
                       EntityName.of("[PROJECT]", "[LOCATION]", "[LAKE]", "[ZONE]", "[ENTITY]")
                           .toString())
                   .setEtag("etag3123477")
                   .build();
           metadataServiceClient.deleteEntity(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
      • deleteEntityCallable

        public final com.google.api.gax.rpc.UnaryCallable<DeleteEntityRequest,​com.google.protobuf.Empty> deleteEntityCallable()
        Delete a metadata entity.

        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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) {
           DeleteEntityRequest request =
               DeleteEntityRequest.newBuilder()
                   .setName(
                       EntityName.of("[PROJECT]", "[LOCATION]", "[LAKE]", "[ZONE]", "[ENTITY]")
                           .toString())
                   .setEtag("etag3123477")
                   .build();
           ApiFuture<Empty> future = metadataServiceClient.deleteEntityCallable().futureCall(request);
           // Do something.
           future.get();
         }
         
      • getEntity

        public final Entity getEntity​(EntityName name)
        Get a metadata entity.

        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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) {
           EntityName name = EntityName.of("[PROJECT]", "[LOCATION]", "[LAKE]", "[ZONE]", "[ENTITY]");
           Entity response = metadataServiceClient.getEntity(name);
         }
         
        Parameters:
        name - Required. The resource name of the entity: `projects/{project_number}/locations/{location_id}/lakes/{lake_id}/zones/{zone_id}/entities/{entity_id}.`
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • getEntity

        public final Entity getEntity​(String name)
        Get a metadata entity.

        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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) {
           String name =
               EntityName.of("[PROJECT]", "[LOCATION]", "[LAKE]", "[ZONE]", "[ENTITY]").toString();
           Entity response = metadataServiceClient.getEntity(name);
         }
         
        Parameters:
        name - Required. The resource name of the entity: `projects/{project_number}/locations/{location_id}/lakes/{lake_id}/zones/{zone_id}/entities/{entity_id}.`
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • getEntity

        public final Entity getEntity​(GetEntityRequest request)
        Get a metadata entity.

        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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) {
           GetEntityRequest request =
               GetEntityRequest.newBuilder()
                   .setName(
                       EntityName.of("[PROJECT]", "[LOCATION]", "[LAKE]", "[ZONE]", "[ENTITY]")
                           .toString())
                   .build();
           Entity response = metadataServiceClient.getEntity(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
      • getEntityCallable

        public final com.google.api.gax.rpc.UnaryCallable<GetEntityRequest,​Entity> getEntityCallable()
        Get a metadata entity.

        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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) {
           GetEntityRequest request =
               GetEntityRequest.newBuilder()
                   .setName(
                       EntityName.of("[PROJECT]", "[LOCATION]", "[LAKE]", "[ZONE]", "[ENTITY]")
                           .toString())
                   .build();
           ApiFuture<Entity> future = metadataServiceClient.getEntityCallable().futureCall(request);
           // Do something.
           Entity response = future.get();
         }
         
      • listEntities

        public final MetadataServiceClient.ListEntitiesPagedResponse listEntities​(ZoneName parent)
        List metadata entities in a zone.

        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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) {
           ZoneName parent = ZoneName.of("[PROJECT]", "[LOCATION]", "[LAKE]", "[ZONE]");
           for (Entity element : metadataServiceClient.listEntities(parent).iterateAll()) {
             // doThingsWith(element);
           }
         }
         
        Parameters:
        parent - Required. The resource name of the parent zone: `projects/{project_number}/locations/{location_id}/lakes/{lake_id}/zones/{zone_id}`.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • listEntities

        public final MetadataServiceClient.ListEntitiesPagedResponse listEntities​(String parent)
        List metadata entities in a zone.

        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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) {
           String parent = ZoneName.of("[PROJECT]", "[LOCATION]", "[LAKE]", "[ZONE]").toString();
           for (Entity element : metadataServiceClient.listEntities(parent).iterateAll()) {
             // doThingsWith(element);
           }
         }
         
        Parameters:
        parent - Required. The resource name of the parent zone: `projects/{project_number}/locations/{location_id}/lakes/{lake_id}/zones/{zone_id}`.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • listEntities

        public final MetadataServiceClient.ListEntitiesPagedResponse listEntities​(ListEntitiesRequest request)
        List metadata entities in a zone.

        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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) {
           ListEntitiesRequest request =
               ListEntitiesRequest.newBuilder()
                   .setParent(ZoneName.of("[PROJECT]", "[LOCATION]", "[LAKE]", "[ZONE]").toString())
                   .setPageSize(883849137)
                   .setPageToken("pageToken873572522")
                   .setFilter("filter-1274492040")
                   .build();
           for (Entity element : metadataServiceClient.listEntities(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
      • listEntitiesPagedCallable

        public final com.google.api.gax.rpc.UnaryCallable<ListEntitiesRequest,​MetadataServiceClient.ListEntitiesPagedResponse> listEntitiesPagedCallable()
        List metadata entities in a zone.

        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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) {
           ListEntitiesRequest request =
               ListEntitiesRequest.newBuilder()
                   .setParent(ZoneName.of("[PROJECT]", "[LOCATION]", "[LAKE]", "[ZONE]").toString())
                   .setPageSize(883849137)
                   .setPageToken("pageToken873572522")
                   .setFilter("filter-1274492040")
                   .build();
           ApiFuture<Entity> future =
               metadataServiceClient.listEntitiesPagedCallable().futureCall(request);
           // Do something.
           for (Entity element : future.get().iterateAll()) {
             // doThingsWith(element);
           }
         }
         
      • listEntitiesCallable

        public final com.google.api.gax.rpc.UnaryCallable<ListEntitiesRequest,​ListEntitiesResponse> listEntitiesCallable()
        List metadata entities in a zone.

        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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) {
           ListEntitiesRequest request =
               ListEntitiesRequest.newBuilder()
                   .setParent(ZoneName.of("[PROJECT]", "[LOCATION]", "[LAKE]", "[ZONE]").toString())
                   .setPageSize(883849137)
                   .setPageToken("pageToken873572522")
                   .setFilter("filter-1274492040")
                   .build();
           while (true) {
             ListEntitiesResponse response = metadataServiceClient.listEntitiesCallable().call(request);
             for (Entity element : response.getEntitiesList()) {
               // doThingsWith(element);
             }
             String nextPageToken = response.getNextPageToken();
             if (!Strings.isNullOrEmpty(nextPageToken)) {
               request = request.toBuilder().setPageToken(nextPageToken).build();
             } else {
               break;
             }
           }
         }
         
      • createPartition

        public final Partition createPartition​(EntityName parent,
                                               Partition partition)
        Create a metadata partition.

        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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) {
           EntityName parent = EntityName.of("[PROJECT]", "[LOCATION]", "[LAKE]", "[ZONE]", "[ENTITY]");
           Partition partition = Partition.newBuilder().build();
           Partition response = metadataServiceClient.createPartition(parent, partition);
         }
         
        Parameters:
        parent - Required. The resource name of the parent zone: `projects/{project_number}/locations/{location_id}/lakes/{lake_id}/zones/{zone_id}/entities/{entity_id}`.
        partition - Required. Partition resource.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • createPartition

        public final Partition createPartition​(String parent,
                                               Partition partition)
        Create a metadata partition.

        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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) {
           String parent =
               EntityName.of("[PROJECT]", "[LOCATION]", "[LAKE]", "[ZONE]", "[ENTITY]").toString();
           Partition partition = Partition.newBuilder().build();
           Partition response = metadataServiceClient.createPartition(parent, partition);
         }
         
        Parameters:
        parent - Required. The resource name of the parent zone: `projects/{project_number}/locations/{location_id}/lakes/{lake_id}/zones/{zone_id}/entities/{entity_id}`.
        partition - Required. Partition resource.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • createPartition

        public final Partition createPartition​(CreatePartitionRequest request)
        Create a metadata partition.

        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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) {
           CreatePartitionRequest request =
               CreatePartitionRequest.newBuilder()
                   .setParent(
                       EntityName.of("[PROJECT]", "[LOCATION]", "[LAKE]", "[ZONE]", "[ENTITY]")
                           .toString())
                   .setPartition(Partition.newBuilder().build())
                   .setValidateOnly(true)
                   .build();
           Partition response = metadataServiceClient.createPartition(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
      • createPartitionCallable

        public final com.google.api.gax.rpc.UnaryCallable<CreatePartitionRequest,​Partition> createPartitionCallable()
        Create a metadata partition.

        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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) {
           CreatePartitionRequest request =
               CreatePartitionRequest.newBuilder()
                   .setParent(
                       EntityName.of("[PROJECT]", "[LOCATION]", "[LAKE]", "[ZONE]", "[ENTITY]")
                           .toString())
                   .setPartition(Partition.newBuilder().build())
                   .setValidateOnly(true)
                   .build();
           ApiFuture<Partition> future =
               metadataServiceClient.createPartitionCallable().futureCall(request);
           // Do something.
           Partition response = future.get();
         }
         
      • deletePartition

        public final void deletePartition​(PartitionName name)
        Delete a metadata partition.

        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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) {
           PartitionName name =
               PartitionName.of(
                   "[PROJECT]", "[LOCATION]", "[LAKE]", "[ZONE]", "[ENTITY]", "[PARTITION]");
           metadataServiceClient.deletePartition(name);
         }
         
        Parameters:
        name - Required. The resource name of the partition. format: `projects/{project_number}/locations/{location_id}/lakes/{lake_id}/zones/{zone_id}/entities/{entity_id}/partitions/{partition_value_path}`. The {partition_value_path} segment consists of an ordered sequence of partition values separated by "/". All values must be provided.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • deletePartition

        public final void deletePartition​(String name)
        Delete a metadata partition.

        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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) {
           String name =
               PartitionName.of("[PROJECT]", "[LOCATION]", "[LAKE]", "[ZONE]", "[ENTITY]", "[PARTITION]")
                   .toString();
           metadataServiceClient.deletePartition(name);
         }
         
        Parameters:
        name - Required. The resource name of the partition. format: `projects/{project_number}/locations/{location_id}/lakes/{lake_id}/zones/{zone_id}/entities/{entity_id}/partitions/{partition_value_path}`. The {partition_value_path} segment consists of an ordered sequence of partition values separated by "/". All values must be provided.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • deletePartition

        public final void deletePartition​(DeletePartitionRequest request)
        Delete a metadata partition.

        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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) {
           DeletePartitionRequest request =
               DeletePartitionRequest.newBuilder()
                   .setName(
                       PartitionName.of(
                               "[PROJECT]", "[LOCATION]", "[LAKE]", "[ZONE]", "[ENTITY]", "[PARTITION]")
                           .toString())
                   .setEtag("etag3123477")
                   .build();
           metadataServiceClient.deletePartition(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
      • deletePartitionCallable

        public final com.google.api.gax.rpc.UnaryCallable<DeletePartitionRequest,​com.google.protobuf.Empty> deletePartitionCallable()
        Delete a metadata partition.

        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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) {
           DeletePartitionRequest request =
               DeletePartitionRequest.newBuilder()
                   .setName(
                       PartitionName.of(
                               "[PROJECT]", "[LOCATION]", "[LAKE]", "[ZONE]", "[ENTITY]", "[PARTITION]")
                           .toString())
                   .setEtag("etag3123477")
                   .build();
           ApiFuture<Empty> future = metadataServiceClient.deletePartitionCallable().futureCall(request);
           // Do something.
           future.get();
         }
         
      • getPartition

        public final Partition getPartition​(PartitionName name)
        Get a metadata partition of an entity.

        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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) {
           PartitionName name =
               PartitionName.of(
                   "[PROJECT]", "[LOCATION]", "[LAKE]", "[ZONE]", "[ENTITY]", "[PARTITION]");
           Partition response = metadataServiceClient.getPartition(name);
         }
         
        Parameters:
        name - Required. The resource name of the partition: `projects/{project_number}/locations/{location_id}/lakes/{lake_id}/zones/{zone_id}/entities/{entity_id}/partitions/{partition_value_path}`. The {partition_value_path} segment consists of an ordered sequence of partition values separated by "/". All values must be provided.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • getPartition

        public final Partition getPartition​(String name)
        Get a metadata partition of an entity.

        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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) {
           String name =
               PartitionName.of("[PROJECT]", "[LOCATION]", "[LAKE]", "[ZONE]", "[ENTITY]", "[PARTITION]")
                   .toString();
           Partition response = metadataServiceClient.getPartition(name);
         }
         
        Parameters:
        name - Required. The resource name of the partition: `projects/{project_number}/locations/{location_id}/lakes/{lake_id}/zones/{zone_id}/entities/{entity_id}/partitions/{partition_value_path}`. The {partition_value_path} segment consists of an ordered sequence of partition values separated by "/". All values must be provided.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • getPartition

        public final Partition getPartition​(GetPartitionRequest request)
        Get a metadata partition of an entity.

        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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) {
           GetPartitionRequest request =
               GetPartitionRequest.newBuilder()
                   .setName(
                       PartitionName.of(
                               "[PROJECT]", "[LOCATION]", "[LAKE]", "[ZONE]", "[ENTITY]", "[PARTITION]")
                           .toString())
                   .build();
           Partition response = metadataServiceClient.getPartition(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
      • getPartitionCallable

        public final com.google.api.gax.rpc.UnaryCallable<GetPartitionRequest,​Partition> getPartitionCallable()
        Get a metadata partition of an entity.

        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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) {
           GetPartitionRequest request =
               GetPartitionRequest.newBuilder()
                   .setName(
                       PartitionName.of(
                               "[PROJECT]", "[LOCATION]", "[LAKE]", "[ZONE]", "[ENTITY]", "[PARTITION]")
                           .toString())
                   .build();
           ApiFuture<Partition> future =
               metadataServiceClient.getPartitionCallable().futureCall(request);
           // Do something.
           Partition response = future.get();
         }
         
      • listPartitions

        public final MetadataServiceClient.ListPartitionsPagedResponse listPartitions​(EntityName parent)
        List metadata partitions of an entity.

        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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) {
           EntityName parent = EntityName.of("[PROJECT]", "[LOCATION]", "[LAKE]", "[ZONE]", "[ENTITY]");
           for (Partition element : metadataServiceClient.listPartitions(parent).iterateAll()) {
             // doThingsWith(element);
           }
         }
         
        Parameters:
        parent - Required. The resource name of the parent entity: `projects/{project_number}/locations/{location_id}/lakes/{lake_id}/zones/{zone_id}/entities/{entity_id}`.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • listPartitions

        public final MetadataServiceClient.ListPartitionsPagedResponse listPartitions​(String parent)
        List metadata partitions of an entity.

        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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) {
           String parent =
               EntityName.of("[PROJECT]", "[LOCATION]", "[LAKE]", "[ZONE]", "[ENTITY]").toString();
           for (Partition element : metadataServiceClient.listPartitions(parent).iterateAll()) {
             // doThingsWith(element);
           }
         }
         
        Parameters:
        parent - Required. The resource name of the parent entity: `projects/{project_number}/locations/{location_id}/lakes/{lake_id}/zones/{zone_id}/entities/{entity_id}`.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • listPartitions

        public final MetadataServiceClient.ListPartitionsPagedResponse listPartitions​(ListPartitionsRequest request)
        List metadata partitions of an entity.

        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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) {
           ListPartitionsRequest request =
               ListPartitionsRequest.newBuilder()
                   .setParent(
                       EntityName.of("[PROJECT]", "[LOCATION]", "[LAKE]", "[ZONE]", "[ENTITY]")
                           .toString())
                   .setPageSize(883849137)
                   .setPageToken("pageToken873572522")
                   .setFilter("filter-1274492040")
                   .build();
           for (Partition element : metadataServiceClient.listPartitions(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
      • listPartitionsPagedCallable

        public final com.google.api.gax.rpc.UnaryCallable<ListPartitionsRequest,​MetadataServiceClient.ListPartitionsPagedResponse> listPartitionsPagedCallable()
        List metadata partitions of an entity.

        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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) {
           ListPartitionsRequest request =
               ListPartitionsRequest.newBuilder()
                   .setParent(
                       EntityName.of("[PROJECT]", "[LOCATION]", "[LAKE]", "[ZONE]", "[ENTITY]")
                           .toString())
                   .setPageSize(883849137)
                   .setPageToken("pageToken873572522")
                   .setFilter("filter-1274492040")
                   .build();
           ApiFuture<Partition> future =
               metadataServiceClient.listPartitionsPagedCallable().futureCall(request);
           // Do something.
           for (Partition element : future.get().iterateAll()) {
             // doThingsWith(element);
           }
         }
         
      • listPartitionsCallable

        public final com.google.api.gax.rpc.UnaryCallable<ListPartitionsRequest,​ListPartitionsResponse> listPartitionsCallable()
        List metadata partitions of an entity.

        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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) {
           ListPartitionsRequest request =
               ListPartitionsRequest.newBuilder()
                   .setParent(
                       EntityName.of("[PROJECT]", "[LOCATION]", "[LAKE]", "[ZONE]", "[ENTITY]")
                           .toString())
                   .setPageSize(883849137)
                   .setPageToken("pageToken873572522")
                   .setFilter("filter-1274492040")
                   .build();
           while (true) {
             ListPartitionsResponse response =
                 metadataServiceClient.listPartitionsCallable().call(request);
             for (Partition element : response.getPartitionsList()) {
               // doThingsWith(element);
             }
             String nextPageToken = response.getNextPageToken();
             if (!Strings.isNullOrEmpty(nextPageToken)) {
               request = request.toBuilder().setPageToken(nextPageToken).build();
             } else {
               break;
             }
           }
         }
         
      • listLocations

        public final MetadataServiceClient.ListLocationsPagedResponse listLocations​(com.google.cloud.location.ListLocationsRequest request)
        Lists information about the supported locations for this service.

        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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) {
           ListLocationsRequest request =
               ListLocationsRequest.newBuilder()
                   .setName("name3373707")
                   .setFilter("filter-1274492040")
                   .setPageSize(883849137)
                   .setPageToken("pageToken873572522")
                   .build();
           for (Location element : metadataServiceClient.listLocations(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
      • listLocationsPagedCallable

        public final com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.ListLocationsRequest,​MetadataServiceClient.ListLocationsPagedResponse> listLocationsPagedCallable()
        Lists information about the supported locations for this service.

        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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) {
           ListLocationsRequest request =
               ListLocationsRequest.newBuilder()
                   .setName("name3373707")
                   .setFilter("filter-1274492040")
                   .setPageSize(883849137)
                   .setPageToken("pageToken873572522")
                   .build();
           ApiFuture<Location> future =
               metadataServiceClient.listLocationsPagedCallable().futureCall(request);
           // Do something.
           for (Location element : future.get().iterateAll()) {
             // doThingsWith(element);
           }
         }
         
      • listLocationsCallable

        public final com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.ListLocationsRequest,​com.google.cloud.location.ListLocationsResponse> listLocationsCallable()
        Lists information about the supported locations for this service.

        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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) {
           ListLocationsRequest request =
               ListLocationsRequest.newBuilder()
                   .setName("name3373707")
                   .setFilter("filter-1274492040")
                   .setPageSize(883849137)
                   .setPageToken("pageToken873572522")
                   .build();
           while (true) {
             ListLocationsResponse response =
                 metadataServiceClient.listLocationsCallable().call(request);
             for (Location element : response.getLocationsList()) {
               // doThingsWith(element);
             }
             String nextPageToken = response.getNextPageToken();
             if (!Strings.isNullOrEmpty(nextPageToken)) {
               request = request.toBuilder().setPageToken(nextPageToken).build();
             } else {
               break;
             }
           }
         }
         
      • getLocation

        public final com.google.cloud.location.Location getLocation​(com.google.cloud.location.GetLocationRequest request)
        Gets information about a location.

        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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) {
           GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
           Location response = metadataServiceClient.getLocation(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
      • getLocationCallable

        public final com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.GetLocationRequest,​com.google.cloud.location.Location> getLocationCallable()
        Gets information about a location.

        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 (MetadataServiceClient metadataServiceClient = MetadataServiceClient.create()) {
           GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
           ApiFuture<Location> future = metadataServiceClient.getLocationCallable().futureCall(request);
           // Do something.
           Location 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