Class MetadataServiceClient (1.3.0)

public class MetadataServiceClient implements 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.newBuilder()
         .setTransportChannelProvider(
             MetadataServiceSettings.defaultHttpJsonTransportProviderBuilder().build())
         .build();
 MetadataServiceClient metadataServiceClient =
     MetadataServiceClient.create(metadataServiceSettings);
 

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

Inheritance

java.lang.Object > MetadataServiceClient

Implements

BackgroundResource

Static Methods

create()

public static final MetadataServiceClient create()

Constructs an instance of MetadataServiceClient with default settings.

Returns
TypeDescription
MetadataServiceClient
Exceptions
TypeDescription
IOException

create(MetadataServiceSettings settings)

public static final MetadataServiceClient create(MetadataServiceSettings settings)

Constructs an instance of MetadataServiceClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.

Parameter
NameDescription
settingsMetadataServiceSettings
Returns
TypeDescription
MetadataServiceClient
Exceptions
TypeDescription
IOException

create(MetadataServiceStub stub)

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

Parameter
NameDescription
stubMetadataServiceStub
Returns
TypeDescription
MetadataServiceClient

Constructors

MetadataServiceClient(MetadataServiceSettings settings)

protected MetadataServiceClient(MetadataServiceSettings settings)

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.

Parameter
NameDescription
settingsMetadataServiceSettings

MetadataServiceClient(MetadataServiceStub stub)

protected MetadataServiceClient(MetadataServiceStub stub)
Parameter
NameDescription
stubMetadataServiceStub

Methods

awaitTermination(long duration, TimeUnit unit)

public boolean awaitTermination(long duration, TimeUnit unit)
Parameters
NameDescription
durationlong
unitTimeUnit
Returns
TypeDescription
boolean
Exceptions
TypeDescription
InterruptedException

close()

public final void close()

createEntity(CreateEntityRequest request)

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);
 }
 
Parameter
NameDescription
requestCreateEntityRequest

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

Returns
TypeDescription
Entity

createEntity(ZoneName parent, Entity entity)

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

Required. The resource name of the parent zone: projects/{project_number}/locations/{location_id}/lakes/{lake_id}/zones/{zone_id}.

entityEntity

Required. Entity resource.

Returns
TypeDescription
Entity

createEntity(String parent, Entity entity)

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

Required. The resource name of the parent zone: projects/{project_number}/locations/{location_id}/lakes/{lake_id}/zones/{zone_id}.

entityEntity

Required. Entity resource.

Returns
TypeDescription
Entity

createEntityCallable()

public final 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();
 }
 
Returns
TypeDescription
UnaryCallable<CreateEntityRequest,Entity>

createPartition(CreatePartitionRequest request)

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);
 }
 
Parameter
NameDescription
requestCreatePartitionRequest

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

Returns
TypeDescription
Partition

createPartition(EntityName parent, Partition partition)

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

Required. The resource name of the parent zone: projects/{project_number}/locations/{location_id}/lakes/{lake_id}/zones/{zone_id}/entities/{entity_id}.

partitionPartition

Required. Partition resource.

Returns
TypeDescription
Partition

createPartition(String parent, Partition partition)

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

Required. The resource name of the parent zone: projects/{project_number}/locations/{location_id}/lakes/{lake_id}/zones/{zone_id}/entities/{entity_id}.

partitionPartition

Required. Partition resource.

Returns
TypeDescription
Partition

createPartitionCallable()

public final 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();
 }
 
Returns
TypeDescription
UnaryCallable<CreatePartitionRequest,Partition>

deleteEntity(DeleteEntityRequest request)

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);
 }
 
Parameter
NameDescription
requestDeleteEntityRequest

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

deleteEntity(EntityName name)

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);
 }
 
Parameter
NameDescription
nameEntityName

Required. The resource name of the entity: projects/{project_number}/locations/{location_id}/lakes/{lake_id}/zones/{zone_id}/entities/{entity_id}.

deleteEntity(String name)

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);
 }
 
Parameter
NameDescription
nameString

Required. The resource name of the entity: projects/{project_number}/locations/{location_id}/lakes/{lake_id}/zones/{zone_id}/entities/{entity_id}.

deleteEntityCallable()

public final UnaryCallable<DeleteEntityRequest,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();
 }
 
Returns
TypeDescription
UnaryCallable<DeleteEntityRequest,Empty>

deletePartition(DeletePartitionRequest request)

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);
 }
 
Parameter
NameDescription
requestDeletePartitionRequest

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

deletePartition(PartitionName name)

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);
 }
 
Parameter
NameDescription
namePartitionName

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.

deletePartition(String name)

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);
 }
 
Parameter
NameDescription
nameString

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.

deletePartitionCallable()

public final UnaryCallable<DeletePartitionRequest,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();
 }
 
Returns
TypeDescription
UnaryCallable<DeletePartitionRequest,Empty>

getEntity(EntityName name)

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);
 }
 
Parameter
NameDescription
nameEntityName

Required. The resource name of the entity: projects/{project_number}/locations/{location_id}/lakes/{lake_id}/zones/{zone_id}/entities/{entity_id}.

Returns
TypeDescription
Entity

getEntity(GetEntityRequest request)

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);
 }
 
Parameter
NameDescription
requestGetEntityRequest

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

Returns
TypeDescription
Entity

getEntity(String name)

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);
 }
 
Parameter
NameDescription
nameString

Required. The resource name of the entity: projects/{project_number}/locations/{location_id}/lakes/{lake_id}/zones/{zone_id}/entities/{entity_id}.

Returns
TypeDescription
Entity

getEntityCallable()

public final 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();
 }
 
Returns
TypeDescription
UnaryCallable<GetEntityRequest,Entity>

getLocation(GetLocationRequest request)

public final Location getLocation(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);
 }
 
Parameter
NameDescription
requestcom.google.cloud.location.GetLocationRequest

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

Returns
TypeDescription
com.google.cloud.location.Location

getLocationCallable()

public final UnaryCallable<GetLocationRequest,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();
 }
 
Returns
TypeDescription
UnaryCallable<com.google.cloud.location.GetLocationRequest,com.google.cloud.location.Location>

getPartition(GetPartitionRequest request)

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);
 }
 
Parameter
NameDescription
requestGetPartitionRequest

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

Returns
TypeDescription
Partition

getPartition(PartitionName name)

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);
 }
 
Parameter
NameDescription
namePartitionName

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.

Returns
TypeDescription
Partition

getPartition(String name)

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);
 }
 
Parameter
NameDescription
nameString

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.

Returns
TypeDescription
Partition

getPartitionCallable()

public final 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();
 }
 
Returns
TypeDescription
UnaryCallable<GetPartitionRequest,Partition>

getSettings()

public final MetadataServiceSettings getSettings()
Returns
TypeDescription
MetadataServiceSettings

getStub()

public MetadataServiceStub getStub()
Returns
TypeDescription
MetadataServiceStub

isShutdown()

public boolean isShutdown()
Returns
TypeDescription
boolean

isTerminated()

public boolean isTerminated()
Returns
TypeDescription
boolean

listEntities(ListEntitiesRequest request)

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);
   }
 }
 
Parameter
NameDescription
requestListEntitiesRequest

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

Returns
TypeDescription
MetadataServiceClient.ListEntitiesPagedResponse

listEntities(ZoneName parent)

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);
   }
 }
 
Parameter
NameDescription
parentZoneName

Required. The resource name of the parent zone: projects/{project_number}/locations/{location_id}/lakes/{lake_id}/zones/{zone_id}.

Returns
TypeDescription
MetadataServiceClient.ListEntitiesPagedResponse

listEntities(String parent)

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);
   }
 }
 
Parameter
NameDescription
parentString

Required. The resource name of the parent zone: projects/{project_number}/locations/{location_id}/lakes/{lake_id}/zones/{zone_id}.

Returns
TypeDescription
MetadataServiceClient.ListEntitiesPagedResponse

listEntitiesCallable()

public final 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;
     }
   }
 }
 
Returns
TypeDescription
UnaryCallable<ListEntitiesRequest,ListEntitiesResponse>

listEntitiesPagedCallable()

public final 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);
   }
 }
 
Returns
TypeDescription
UnaryCallable<ListEntitiesRequest,ListEntitiesPagedResponse>

listLocations(ListLocationsRequest request)

public final MetadataServiceClient.ListLocationsPagedResponse listLocations(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);
   }
 }
 
Parameter
NameDescription
requestcom.google.cloud.location.ListLocationsRequest

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

Returns
TypeDescription
MetadataServiceClient.ListLocationsPagedResponse

listLocationsCallable()

public final UnaryCallable<ListLocationsRequest,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;
     }
   }
 }
 
Returns
TypeDescription
UnaryCallable<com.google.cloud.location.ListLocationsRequest,com.google.cloud.location.ListLocationsResponse>

listLocationsPagedCallable()

public final UnaryCallable<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);
   }
 }
 
Returns
TypeDescription
UnaryCallable<com.google.cloud.location.ListLocationsRequest,ListLocationsPagedResponse>

listPartitions(EntityName parent)

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);
   }
 }
 
Parameter
NameDescription
parentEntityName

Required. The resource name of the parent entity: projects/{project_number}/locations/{location_id}/lakes/{lake_id}/zones/{zone_id}/entities/{entity_id}.

Returns
TypeDescription
MetadataServiceClient.ListPartitionsPagedResponse

listPartitions(ListPartitionsRequest request)

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);
   }
 }
 
Parameter
NameDescription
requestListPartitionsRequest

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

Returns
TypeDescription
MetadataServiceClient.ListPartitionsPagedResponse

listPartitions(String parent)

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);
   }
 }
 
Parameter
NameDescription
parentString

Required. The resource name of the parent entity: projects/{project_number}/locations/{location_id}/lakes/{lake_id}/zones/{zone_id}/entities/{entity_id}.

Returns
TypeDescription
MetadataServiceClient.ListPartitionsPagedResponse

listPartitionsCallable()

public final 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;
     }
   }
 }
 
Returns
TypeDescription
UnaryCallable<ListPartitionsRequest,ListPartitionsResponse>

listPartitionsPagedCallable()

public final 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);
   }
 }
 
Returns
TypeDescription
UnaryCallable<ListPartitionsRequest,ListPartitionsPagedResponse>

shutdown()

public void shutdown()

shutdownNow()

public void shutdownNow()

updateEntity(UpdateEntityRequest request)

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);
 }
 
Parameter
NameDescription
requestUpdateEntityRequest

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

Returns
TypeDescription
Entity

updateEntityCallable()

public final 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();
 }
 
Returns
TypeDescription
UnaryCallable<UpdateEntityRequest,Entity>