Class DataprocMetastoreClient (2.33.0)

GitHub RepositoryProduct ReferenceREST DocumentationRPC Documentation

Service Description: Configures and manages metastore services. Metastore services are fully managed, highly available, autoscaled, autohealing, OSS-native deployments of technical metadata management software. Each metastore service exposes a network endpoint through which metadata queries are served. Metadata queries can originate from a variety of sources, including Apache Hive, Apache Presto, and Apache Spark.

The Dataproc Metastore API defines the following resource model:

  • The service works with a collection of Google Cloud projects, named: /projects/*
  • Each project has a collection of available locations, named: /locations/* (a location must refer to a Google Cloud region)
  • Each location has a collection of services, named: /services/*
  • Dataproc Metastore services are resources with names of the form:

/projects/{project_number}/locations/{location_id}/services/{service_id}.

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 (DataprocMetastoreClient dataprocMetastoreClient = DataprocMetastoreClient.create()) {
   ServiceName name = ServiceName.of("[PROJECT]", "[LOCATION]", "[SERVICE]");
   Service response = dataprocMetastoreClient.getService(name);
 }
 

Note: close() needs to be called on the DataprocMetastoreClient 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 DataprocMetastoreSettings 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
 DataprocMetastoreSettings dataprocMetastoreSettings =
     DataprocMetastoreSettings.newBuilder()
         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
         .build();
 DataprocMetastoreClient dataprocMetastoreClient =
     DataprocMetastoreClient.create(dataprocMetastoreSettings);
 

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
 DataprocMetastoreSettings dataprocMetastoreSettings =
     DataprocMetastoreSettings.newBuilder().setEndpoint(myEndpoint).build();
 DataprocMetastoreClient dataprocMetastoreClient =
     DataprocMetastoreClient.create(dataprocMetastoreSettings);
 

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
 DataprocMetastoreSettings dataprocMetastoreSettings =
     DataprocMetastoreSettings.newHttpJsonBuilder().build();
 DataprocMetastoreClient dataprocMetastoreClient =
     DataprocMetastoreClient.create(dataprocMetastoreSettings);
 

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

Inheritance

java.lang.Object > DataprocMetastoreClient

Static Methods

create()

public static final DataprocMetastoreClient create()

Constructs an instance of DataprocMetastoreClient with default settings.

Returns
TypeDescription
DataprocMetastoreClient
Exceptions
TypeDescription
IOException

create(DataprocMetastoreSettings settings)

public static final DataprocMetastoreClient create(DataprocMetastoreSettings settings)

Constructs an instance of DataprocMetastoreClient, 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
settingsDataprocMetastoreSettings
Returns
TypeDescription
DataprocMetastoreClient
Exceptions
TypeDescription
IOException

create(DataprocMetastoreStub stub)

public static final DataprocMetastoreClient create(DataprocMetastoreStub stub)

Constructs an instance of DataprocMetastoreClient, using the given stub for making calls. This is for advanced usage - prefer using create(DataprocMetastoreSettings).

Parameter
NameDescription
stubDataprocMetastoreStub
Returns
TypeDescription
DataprocMetastoreClient

Constructors

DataprocMetastoreClient(DataprocMetastoreSettings settings)

protected DataprocMetastoreClient(DataprocMetastoreSettings settings)

Constructs an instance of DataprocMetastoreClient, 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
settingsDataprocMetastoreSettings

DataprocMetastoreClient(DataprocMetastoreStub stub)

protected DataprocMetastoreClient(DataprocMetastoreStub stub)
Parameter
NameDescription
stubDataprocMetastoreStub

Methods

alterMetadataResourceLocationAsync(AlterMetadataResourceLocationRequest request)

public final OperationFuture<AlterMetadataResourceLocationResponse,OperationMetadata> alterMetadataResourceLocationAsync(AlterMetadataResourceLocationRequest request)

Alter metadata resource location. The metadata resource can be a database, table, or partition. This functionality only updates the parent directory for the respective metadata resource and does not transfer any existing data to the new 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 (DataprocMetastoreClient dataprocMetastoreClient = DataprocMetastoreClient.create()) {
   AlterMetadataResourceLocationRequest request =
       AlterMetadataResourceLocationRequest.newBuilder()
           .setService(ServiceName.of("[PROJECT]", "[LOCATION]", "[SERVICE]").toString())
           .setResourceName("resourceName-384566343")
           .setLocationUri("locationUri552310135")
           .build();
   AlterMetadataResourceLocationResponse response =
       dataprocMetastoreClient.alterMetadataResourceLocationAsync(request).get();
 }
 
Parameter
NameDescription
requestAlterMetadataResourceLocationRequest

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

Returns
TypeDescription
OperationFuture<AlterMetadataResourceLocationResponse,OperationMetadata>

alterMetadataResourceLocationCallable()

public final UnaryCallable<AlterMetadataResourceLocationRequest,Operation> alterMetadataResourceLocationCallable()

Alter metadata resource location. The metadata resource can be a database, table, or partition. This functionality only updates the parent directory for the respective metadata resource and does not transfer any existing data to the new 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 (DataprocMetastoreClient dataprocMetastoreClient = DataprocMetastoreClient.create()) {
   AlterMetadataResourceLocationRequest request =
       AlterMetadataResourceLocationRequest.newBuilder()
           .setService(ServiceName.of("[PROJECT]", "[LOCATION]", "[SERVICE]").toString())
           .setResourceName("resourceName-384566343")
           .setLocationUri("locationUri552310135")
           .build();
   ApiFuture<Operation> future =
       dataprocMetastoreClient.alterMetadataResourceLocationCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<AlterMetadataResourceLocationRequest,Operation>

alterMetadataResourceLocationOperationCallable()

public final OperationCallable<AlterMetadataResourceLocationRequest,AlterMetadataResourceLocationResponse,OperationMetadata> alterMetadataResourceLocationOperationCallable()

Alter metadata resource location. The metadata resource can be a database, table, or partition. This functionality only updates the parent directory for the respective metadata resource and does not transfer any existing data to the new 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 (DataprocMetastoreClient dataprocMetastoreClient = DataprocMetastoreClient.create()) {
   AlterMetadataResourceLocationRequest request =
       AlterMetadataResourceLocationRequest.newBuilder()
           .setService(ServiceName.of("[PROJECT]", "[LOCATION]", "[SERVICE]").toString())
           .setResourceName("resourceName-384566343")
           .setLocationUri("locationUri552310135")
           .build();
   OperationFuture<AlterMetadataResourceLocationResponse, OperationMetadata> future =
       dataprocMetastoreClient
           .alterMetadataResourceLocationOperationCallable()
           .futureCall(request);
   // Do something.
   AlterMetadataResourceLocationResponse response = future.get();
 }
 
Returns
TypeDescription
OperationCallable<AlterMetadataResourceLocationRequest,AlterMetadataResourceLocationResponse,OperationMetadata>

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

createBackupAsync(CreateBackupRequest request)

public final OperationFuture<Backup,OperationMetadata> createBackupAsync(CreateBackupRequest request)

Creates a new backup in a given project and 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 (DataprocMetastoreClient dataprocMetastoreClient = DataprocMetastoreClient.create()) {
   CreateBackupRequest request =
       CreateBackupRequest.newBuilder()
           .setParent(ServiceName.of("[PROJECT]", "[LOCATION]", "[SERVICE]").toString())
           .setBackupId("backupId2121930365")
           .setBackup(Backup.newBuilder().build())
           .setRequestId("requestId693933066")
           .build();
   Backup response = dataprocMetastoreClient.createBackupAsync(request).get();
 }
 
Parameter
NameDescription
requestCreateBackupRequest

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

Returns
TypeDescription
OperationFuture<Backup,OperationMetadata>

createBackupAsync(ServiceName parent, Backup backup, String backupId)

public final OperationFuture<Backup,OperationMetadata> createBackupAsync(ServiceName parent, Backup backup, String backupId)

Creates a new backup in a given project and 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 (DataprocMetastoreClient dataprocMetastoreClient = DataprocMetastoreClient.create()) {
   ServiceName parent = ServiceName.of("[PROJECT]", "[LOCATION]", "[SERVICE]");
   Backup backup = Backup.newBuilder().build();
   String backupId = "backupId2121930365";
   Backup response = dataprocMetastoreClient.createBackupAsync(parent, backup, backupId).get();
 }
 
Parameters
NameDescription
parentServiceName

Required. The relative resource name of the service in which to create a backup of the following form:

projects/{project_number}/locations/{location_id}/services/{service_id}.

backupBackup

Required. The backup to create. The name field is ignored. The ID of the created backup must be provided in the request's backup_id field.

backupIdString

Required. The ID of the backup, which is used as the final component of the backup's name.

This value must be between 1 and 64 characters long, begin with a letter, end with a letter or number, and consist of alpha-numeric ASCII characters or hyphens.

Returns
TypeDescription
OperationFuture<Backup,OperationMetadata>

createBackupAsync(String parent, Backup backup, String backupId)

public final OperationFuture<Backup,OperationMetadata> createBackupAsync(String parent, Backup backup, String backupId)

Creates a new backup in a given project and 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 (DataprocMetastoreClient dataprocMetastoreClient = DataprocMetastoreClient.create()) {
   String parent = ServiceName.of("[PROJECT]", "[LOCATION]", "[SERVICE]").toString();
   Backup backup = Backup.newBuilder().build();
   String backupId = "backupId2121930365";
   Backup response = dataprocMetastoreClient.createBackupAsync(parent, backup, backupId).get();
 }
 
Parameters
NameDescription
parentString

Required. The relative resource name of the service in which to create a backup of the following form:

projects/{project_number}/locations/{location_id}/services/{service_id}.

backupBackup

Required. The backup to create. The name field is ignored. The ID of the created backup must be provided in the request's backup_id field.

backupIdString

Required. The ID of the backup, which is used as the final component of the backup's name.

This value must be between 1 and 64 characters long, begin with a letter, end with a letter or number, and consist of alpha-numeric ASCII characters or hyphens.

Returns
TypeDescription
OperationFuture<Backup,OperationMetadata>

createBackupCallable()

public final UnaryCallable<CreateBackupRequest,Operation> createBackupCallable()

Creates a new backup in a given project and 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 (DataprocMetastoreClient dataprocMetastoreClient = DataprocMetastoreClient.create()) {
   CreateBackupRequest request =
       CreateBackupRequest.newBuilder()
           .setParent(ServiceName.of("[PROJECT]", "[LOCATION]", "[SERVICE]").toString())
           .setBackupId("backupId2121930365")
           .setBackup(Backup.newBuilder().build())
           .setRequestId("requestId693933066")
           .build();
   ApiFuture<Operation> future =
       dataprocMetastoreClient.createBackupCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<CreateBackupRequest,Operation>

createBackupOperationCallable()

public final OperationCallable<CreateBackupRequest,Backup,OperationMetadata> createBackupOperationCallable()

Creates a new backup in a given project and 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 (DataprocMetastoreClient dataprocMetastoreClient = DataprocMetastoreClient.create()) {
   CreateBackupRequest request =
       CreateBackupRequest.newBuilder()
           .setParent(ServiceName.of("[PROJECT]", "[LOCATION]", "[SERVICE]").toString())
           .setBackupId("backupId2121930365")
           .setBackup(Backup.newBuilder().build())
           .setRequestId("requestId693933066")
           .build();
   OperationFuture<Backup, OperationMetadata> future =
       dataprocMetastoreClient.createBackupOperationCallable().futureCall(request);
   // Do something.
   Backup response = future.get();
 }
 
Returns
TypeDescription
OperationCallable<CreateBackupRequest,Backup,OperationMetadata>

createMetadataImportAsync(CreateMetadataImportRequest request)

public final OperationFuture<MetadataImport,OperationMetadata> createMetadataImportAsync(CreateMetadataImportRequest request)

Creates a new MetadataImport in a given project and 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 (DataprocMetastoreClient dataprocMetastoreClient = DataprocMetastoreClient.create()) {
   CreateMetadataImportRequest request =
       CreateMetadataImportRequest.newBuilder()
           .setParent(ServiceName.of("[PROJECT]", "[LOCATION]", "[SERVICE]").toString())
           .setMetadataImportId("metadataImportId1824548847")
           .setMetadataImport(MetadataImport.newBuilder().build())
           .setRequestId("requestId693933066")
           .build();
   MetadataImport response = dataprocMetastoreClient.createMetadataImportAsync(request).get();
 }
 
Parameter
NameDescription
requestCreateMetadataImportRequest

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

Returns
TypeDescription
OperationFuture<MetadataImport,OperationMetadata>

createMetadataImportAsync(ServiceName parent, MetadataImport metadataImport, String metadataImportId)

public final OperationFuture<MetadataImport,OperationMetadata> createMetadataImportAsync(ServiceName parent, MetadataImport metadataImport, String metadataImportId)

Creates a new MetadataImport in a given project and 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 (DataprocMetastoreClient dataprocMetastoreClient = DataprocMetastoreClient.create()) {
   ServiceName parent = ServiceName.of("[PROJECT]", "[LOCATION]", "[SERVICE]");
   MetadataImport metadataImport = MetadataImport.newBuilder().build();
   String metadataImportId = "metadataImportId1824548847";
   MetadataImport response =
       dataprocMetastoreClient
           .createMetadataImportAsync(parent, metadataImport, metadataImportId)
           .get();
 }
 
Parameters
NameDescription
parentServiceName

Required. The relative resource name of the service in which to create a metastore import, in the following form:

projects/{project_number}/locations/{location_id}/services/{service_id}.

metadataImportMetadataImport

Required. The metadata import to create. The name field is ignored. The ID of the created metadata import must be provided in the request's metadata_import_id field.

metadataImportIdString

Required. The ID of the metadata import, which is used as the final component of the metadata import's name.

This value must be between 1 and 64 characters long, begin with a letter, end with a letter or number, and consist of alpha-numeric ASCII characters or hyphens.

Returns
TypeDescription
OperationFuture<MetadataImport,OperationMetadata>

createMetadataImportAsync(String parent, MetadataImport metadataImport, String metadataImportId)

public final OperationFuture<MetadataImport,OperationMetadata> createMetadataImportAsync(String parent, MetadataImport metadataImport, String metadataImportId)

Creates a new MetadataImport in a given project and 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 (DataprocMetastoreClient dataprocMetastoreClient = DataprocMetastoreClient.create()) {
   String parent = ServiceName.of("[PROJECT]", "[LOCATION]", "[SERVICE]").toString();
   MetadataImport metadataImport = MetadataImport.newBuilder().build();
   String metadataImportId = "metadataImportId1824548847";
   MetadataImport response =
       dataprocMetastoreClient
           .createMetadataImportAsync(parent, metadataImport, metadataImportId)
           .get();
 }
 
Parameters
NameDescription
parentString

Required. The relative resource name of the service in which to create a metastore import, in the following form:

projects/{project_number}/locations/{location_id}/services/{service_id}.

metadataImportMetadataImport

Required. The metadata import to create. The name field is ignored. The ID of the created metadata import must be provided in the request's metadata_import_id field.

metadataImportIdString

Required. The ID of the metadata import, which is used as the final component of the metadata import's name.

This value must be between 1 and 64 characters long, begin with a letter, end with a letter or number, and consist of alpha-numeric ASCII characters or hyphens.

Returns
TypeDescription
OperationFuture<MetadataImport,OperationMetadata>

createMetadataImportCallable()

public final UnaryCallable<CreateMetadataImportRequest,Operation> createMetadataImportCallable()

Creates a new MetadataImport in a given project and 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 (DataprocMetastoreClient dataprocMetastoreClient = DataprocMetastoreClient.create()) {
   CreateMetadataImportRequest request =
       CreateMetadataImportRequest.newBuilder()
           .setParent(ServiceName.of("[PROJECT]", "[LOCATION]", "[SERVICE]").toString())
           .setMetadataImportId("metadataImportId1824548847")
           .setMetadataImport(MetadataImport.newBuilder().build())
           .setRequestId("requestId693933066")
           .build();
   ApiFuture<Operation> future =
       dataprocMetastoreClient.createMetadataImportCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<CreateMetadataImportRequest,Operation>

createMetadataImportOperationCallable()

public final OperationCallable<CreateMetadataImportRequest,MetadataImport,OperationMetadata> createMetadataImportOperationCallable()

Creates a new MetadataImport in a given project and 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 (DataprocMetastoreClient dataprocMetastoreClient = DataprocMetastoreClient.create()) {
   CreateMetadataImportRequest request =
       CreateMetadataImportRequest.newBuilder()
           .setParent(ServiceName.of("[PROJECT]", "[LOCATION]", "[SERVICE]").toString())
           .setMetadataImportId("metadataImportId1824548847")
           .setMetadataImport(MetadataImport.newBuilder().build())
           .setRequestId("requestId693933066")
           .build();
   OperationFuture<MetadataImport, OperationMetadata> future =
       dataprocMetastoreClient.createMetadataImportOperationCallable().futureCall(request);
   // Do something.
   MetadataImport response = future.get();
 }
 
Returns
TypeDescription
OperationCallable<CreateMetadataImportRequest,MetadataImport,OperationMetadata>

createServiceAsync(CreateServiceRequest request)

public final OperationFuture<Service,OperationMetadata> createServiceAsync(CreateServiceRequest request)

Creates a metastore service in a project and 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 (DataprocMetastoreClient dataprocMetastoreClient = DataprocMetastoreClient.create()) {
   CreateServiceRequest request =
       CreateServiceRequest.newBuilder()
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .setServiceId("serviceId-194185552")
           .setService(Service.newBuilder().build())
           .setRequestId("requestId693933066")
           .build();
   Service response = dataprocMetastoreClient.createServiceAsync(request).get();
 }
 
Parameter
NameDescription
requestCreateServiceRequest

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

Returns
TypeDescription
OperationFuture<Service,OperationMetadata>

createServiceAsync(LocationName parent, Service service, String serviceId)

public final OperationFuture<Service,OperationMetadata> createServiceAsync(LocationName parent, Service service, String serviceId)

Creates a metastore service in a project and 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 (DataprocMetastoreClient dataprocMetastoreClient = DataprocMetastoreClient.create()) {
   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
   Service service = Service.newBuilder().build();
   String serviceId = "serviceId-194185552";
   Service response =
       dataprocMetastoreClient.createServiceAsync(parent, service, serviceId).get();
 }
 
Parameters
NameDescription
parentLocationName

Required. The relative resource name of the location in which to create a metastore service, in the following form:

projects/{project_number}/locations/{location_id}.

serviceService

Required. The Metastore service to create. The name field is ignored. The ID of the created metastore service must be provided in the request's service_id field.

serviceIdString

Required. The ID of the metastore service, which is used as the final component of the metastore service's name.

This value must be between 2 and 63 characters long inclusive, begin with a letter, end with a letter or number, and consist of alpha-numeric ASCII characters or hyphens.

Returns
TypeDescription
OperationFuture<Service,OperationMetadata>

createServiceAsync(String parent, Service service, String serviceId)

public final OperationFuture<Service,OperationMetadata> createServiceAsync(String parent, Service service, String serviceId)

Creates a metastore service in a project and 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 (DataprocMetastoreClient dataprocMetastoreClient = DataprocMetastoreClient.create()) {
   String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
   Service service = Service.newBuilder().build();
   String serviceId = "serviceId-194185552";
   Service response =
       dataprocMetastoreClient.createServiceAsync(parent, service, serviceId).get();
 }
 
Parameters
NameDescription
parentString

Required. The relative resource name of the location in which to create a metastore service, in the following form:

projects/{project_number}/locations/{location_id}.

serviceService

Required. The Metastore service to create. The name field is ignored. The ID of the created metastore service must be provided in the request's service_id field.

serviceIdString

Required. The ID of the metastore service, which is used as the final component of the metastore service's name.

This value must be between 2 and 63 characters long inclusive, begin with a letter, end with a letter or number, and consist of alpha-numeric ASCII characters or hyphens.

Returns
TypeDescription
OperationFuture<Service,OperationMetadata>

createServiceCallable()

public final UnaryCallable<CreateServiceRequest,Operation> createServiceCallable()

Creates a metastore service in a project and 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 (DataprocMetastoreClient dataprocMetastoreClient = DataprocMetastoreClient.create()) {
   CreateServiceRequest request =
       CreateServiceRequest.newBuilder()
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .setServiceId("serviceId-194185552")
           .setService(Service.newBuilder().build())
           .setRequestId("requestId693933066")
           .build();
   ApiFuture<Operation> future =
       dataprocMetastoreClient.createServiceCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<CreateServiceRequest,Operation>

createServiceOperationCallable()

public final OperationCallable<CreateServiceRequest,Service,OperationMetadata> createServiceOperationCallable()

Creates a metastore service in a project and 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 (DataprocMetastoreClient dataprocMetastoreClient = DataprocMetastoreClient.create()) {
   CreateServiceRequest request =
       CreateServiceRequest.newBuilder()
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .setServiceId("serviceId-194185552")
           .setService(Service.newBuilder().build())
           .setRequestId("requestId693933066")
           .build();
   OperationFuture<Service, OperationMetadata> future =
       dataprocMetastoreClient.createServiceOperationCallable().futureCall(request);
   // Do something.
   Service response = future.get();
 }
 
Returns
TypeDescription
OperationCallable<CreateServiceRequest,Service,OperationMetadata>

deleteBackupAsync(BackupName name)

public final OperationFuture<Empty,OperationMetadata> deleteBackupAsync(BackupName name)

Deletes a single backup.

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 (DataprocMetastoreClient dataprocMetastoreClient = DataprocMetastoreClient.create()) {
   BackupName name = BackupName.of("[PROJECT]", "[LOCATION]", "[SERVICE]", "[BACKUP]");
   dataprocMetastoreClient.deleteBackupAsync(name).get();
 }
 
Parameter
NameDescription
nameBackupName

Required. The relative resource name of the backup to delete, in the following form:

projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}.

Returns
TypeDescription
OperationFuture<Empty,OperationMetadata>

deleteBackupAsync(DeleteBackupRequest request)

public final OperationFuture<Empty,OperationMetadata> deleteBackupAsync(DeleteBackupRequest request)

Deletes a single backup.

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 (DataprocMetastoreClient dataprocMetastoreClient = DataprocMetastoreClient.create()) {
   DeleteBackupRequest request =
       DeleteBackupRequest.newBuilder()
           .setName(BackupName.of("[PROJECT]", "[LOCATION]", "[SERVICE]", "[BACKUP]").toString())
           .setRequestId("requestId693933066")
           .build();
   dataprocMetastoreClient.deleteBackupAsync(request).get();
 }
 
Parameter
NameDescription
requestDeleteBackupRequest

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

Returns
TypeDescription
OperationFuture<Empty,OperationMetadata>

deleteBackupAsync(String name)

public final OperationFuture<Empty,OperationMetadata> deleteBackupAsync(String name)

Deletes a single backup.

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 (DataprocMetastoreClient dataprocMetastoreClient = DataprocMetastoreClient.create()) {
   String name = BackupName.of("[PROJECT]", "[LOCATION]", "[SERVICE]", "[BACKUP]").toString();
   dataprocMetastoreClient.deleteBackupAsync(name).get();
 }
 
Parameter
NameDescription
nameString

Required. The relative resource name of the backup to delete, in the following form:

projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}.

Returns
TypeDescription
OperationFuture<Empty,OperationMetadata>

deleteBackupCallable()

public final UnaryCallable<DeleteBackupRequest,Operation> deleteBackupCallable()

Deletes a single backup.

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 (DataprocMetastoreClient dataprocMetastoreClient = DataprocMetastoreClient.create()) {
   DeleteBackupRequest request =
       DeleteBackupRequest.newBuilder()
           .setName(BackupName.of("[PROJECT]", "[LOCATION]", "[SERVICE]", "[BACKUP]").toString())
           .setRequestId("requestId693933066")
           .build();
   ApiFuture<Operation> future =
       dataprocMetastoreClient.deleteBackupCallable().futureCall(request);
   // Do something.
   future.get();
 }
 
Returns
TypeDescription
UnaryCallable<DeleteBackupRequest,Operation>

deleteBackupOperationCallable()

public final OperationCallable<DeleteBackupRequest,Empty,OperationMetadata> deleteBackupOperationCallable()

Deletes a single backup.

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 (DataprocMetastoreClient dataprocMetastoreClient = DataprocMetastoreClient.create()) {
   DeleteBackupRequest request =
       DeleteBackupRequest.newBuilder()
           .setName(BackupName.of("[PROJECT]", "[LOCATION]", "[SERVICE]", "[BACKUP]").toString())
           .setRequestId("requestId693933066")
           .build();
   OperationFuture<Empty, OperationMetadata> future =
       dataprocMetastoreClient.deleteBackupOperationCallable().futureCall(request);
   // Do something.
   future.get();
 }
 
Returns
TypeDescription
OperationCallable<DeleteBackupRequest,Empty,OperationMetadata>

deleteServiceAsync(DeleteServiceRequest request)

public final OperationFuture<Empty,OperationMetadata> deleteServiceAsync(DeleteServiceRequest request)

Deletes a single 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 (DataprocMetastoreClient dataprocMetastoreClient = DataprocMetastoreClient.create()) {
   DeleteServiceRequest request =
       DeleteServiceRequest.newBuilder()
           .setName(ServiceName.of("[PROJECT]", "[LOCATION]", "[SERVICE]").toString())
           .setRequestId("requestId693933066")
           .build();
   dataprocMetastoreClient.deleteServiceAsync(request).get();
 }
 
Parameter
NameDescription
requestDeleteServiceRequest

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

Returns
TypeDescription
OperationFuture<Empty,OperationMetadata>

deleteServiceAsync(ServiceName name)

public final OperationFuture<Empty,OperationMetadata> deleteServiceAsync(ServiceName name)

Deletes a single 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 (DataprocMetastoreClient dataprocMetastoreClient = DataprocMetastoreClient.create()) {
   ServiceName name = ServiceName.of("[PROJECT]", "[LOCATION]", "[SERVICE]");
   dataprocMetastoreClient.deleteServiceAsync(name).get();
 }
 
Parameter
NameDescription
nameServiceName

Required. The relative resource name of the metastore service to delete, in the following form:

projects/{project_number}/locations/{location_id}/services/{service_id}.

Returns
TypeDescription
OperationFuture<Empty,OperationMetadata>

deleteServiceAsync(String name)

public final OperationFuture<Empty,OperationMetadata> deleteServiceAsync(String name)

Deletes a single 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 (DataprocMetastoreClient dataprocMetastoreClient = DataprocMetastoreClient.create()) {
   String name = ServiceName.of("[PROJECT]", "[LOCATION]", "[SERVICE]").toString();
   dataprocMetastoreClient.deleteServiceAsync(name).get();
 }