Class MetastoreServiceClient
- All Implemented Interfaces:
BackgroundResource,AutoCloseable
The BigLake Metastore API defines the following resource model:
- A collection of Google Cloud projects: `/projects/*`
- Each project has a collection of available locations: `/locations/*`
- Each location has a collection of catalogs: `/catalogs/*`
- Each catalog has a collection of databases: `/databases/*`
- Each database has a collection of tables: `/tables/*`
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 (MetastoreServiceClient metastoreServiceClient = MetastoreServiceClient.create()) {
LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
Catalog catalog = Catalog.newBuilder().build();
String catalogId = "catalogId1455933204";
Catalog response = metastoreServiceClient.createCatalog(parent, catalog, catalogId);
}
Note: close() needs to be called on the MetastoreServiceClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().
| Method | Description | Method Variants |
|---|---|---|
CreateCatalog |
Creates a new catalog. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
DeleteCatalog |
Deletes an existing catalog specified by the catalog ID. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
GetCatalog |
Gets the catalog specified by the resource name. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
ListCatalogs |
List all catalogs in a specified project. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
CreateDatabase |
Creates a new database. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
DeleteDatabase |
Deletes an existing database specified by the database ID. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
UpdateDatabase |
Updates an existing database specified by the database ID. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
GetDatabase |
Gets the database specified by the resource name. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
ListDatabases |
List all databases in a specified catalog. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
CreateTable |
Creates a new table. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
DeleteTable |
Deletes an existing table specified by the table ID. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
UpdateTable |
Updates an existing table specified by the table ID. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
RenameTable |
Renames an existing table specified by the table ID. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
GetTable |
Gets the table specified by the resource name. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
ListTables |
List all tables in a specified database. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return 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 MetastoreServiceSettings 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
MetastoreServiceSettings metastoreServiceSettings =
MetastoreServiceSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
MetastoreServiceClient metastoreServiceClient =
MetastoreServiceClient.create(metastoreServiceSettings);
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
MetastoreServiceSettings metastoreServiceSettings =
MetastoreServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
MetastoreServiceClient metastoreServiceClient =
MetastoreServiceClient.create(metastoreServiceSettings);
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
MetastoreServiceSettings metastoreServiceSettings =
MetastoreServiceSettings.newHttpJsonBuilder().build();
MetastoreServiceClient metastoreServiceClient =
MetastoreServiceClient.create(metastoreServiceSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic class -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedConstructs an instance of MetastoreServiceClient, using the given settings.protected -
Method Summary
Modifier and TypeMethodDescriptionbooleanawaitTermination(long duration, TimeUnit unit) final voidclose()static final MetastoreServiceClientcreate()Constructs an instance of MetastoreServiceClient with default settings.static final MetastoreServiceClientcreate(MetastoreServiceSettings settings) Constructs an instance of MetastoreServiceClient, using the given settings.static final MetastoreServiceClientcreate(MetastoreServiceStub stub) Constructs an instance of MetastoreServiceClient, using the given stub for making calls.final CatalogcreateCatalog(CreateCatalogRequest request) Creates a new catalog.final CatalogcreateCatalog(LocationName parent, Catalog catalog, String catalogId) Creates a new catalog.final CatalogcreateCatalog(String parent, Catalog catalog, String catalogId) Creates a new catalog.Creates a new catalog.final DatabasecreateDatabase(CatalogName parent, Database database, String databaseId) Creates a new database.final DatabasecreateDatabase(CreateDatabaseRequest request) Creates a new database.final DatabasecreateDatabase(String parent, Database database, String databaseId) Creates a new database.Creates a new database.final TablecreateTable(CreateTableRequest request) Creates a new table.final TablecreateTable(DatabaseName parent, Table table, String tableId) Creates a new table.final TablecreateTable(String parent, Table table, String tableId) Creates a new table.final UnaryCallable<CreateTableRequest,Table> Creates a new table.final CatalogdeleteCatalog(CatalogName name) Deletes an existing catalog specified by the catalog ID.final CatalogdeleteCatalog(DeleteCatalogRequest request) Deletes an existing catalog specified by the catalog ID.final CatalogdeleteCatalog(String name) Deletes an existing catalog specified by the catalog ID.Deletes an existing catalog specified by the catalog ID.final DatabasedeleteDatabase(DatabaseName name) Deletes an existing database specified by the database ID.final DatabasedeleteDatabase(DeleteDatabaseRequest request) Deletes an existing database specified by the database ID.final DatabasedeleteDatabase(String name) Deletes an existing database specified by the database ID.Deletes an existing database specified by the database ID.final TabledeleteTable(DeleteTableRequest request) Deletes an existing table specified by the table ID.final TabledeleteTable(TableName name) Deletes an existing table specified by the table ID.final TabledeleteTable(String name) Deletes an existing table specified by the table ID.final UnaryCallable<DeleteTableRequest,Table> Deletes an existing table specified by the table ID.final CataloggetCatalog(CatalogName name) Gets the catalog specified by the resource name.final CataloggetCatalog(GetCatalogRequest request) Gets the catalog specified by the resource name.final CataloggetCatalog(String name) Gets the catalog specified by the resource name.Gets the catalog specified by the resource name.final DatabasegetDatabase(DatabaseName name) Gets the database specified by the resource name.final DatabasegetDatabase(GetDatabaseRequest request) Gets the database specified by the resource name.final DatabasegetDatabase(String name) Gets the database specified by the resource name.Gets the database specified by the resource name.final MetastoreServiceSettingsgetStub()final TablegetTable(GetTableRequest request) Gets the table specified by the resource name.final TableGets the table specified by the resource name.final TableGets the table specified by the resource name.final UnaryCallable<GetTableRequest,Table> Gets the table specified by the resource name.booleanbooleanlistCatalogs(ListCatalogsRequest request) List all catalogs in a specified project.listCatalogs(LocationName parent) List all catalogs in a specified project.listCatalogs(String parent) List all catalogs in a specified project.List all catalogs in a specified project.List all catalogs in a specified project.listDatabases(CatalogName parent) List all databases in a specified catalog.listDatabases(ListDatabasesRequest request) List all databases in a specified catalog.listDatabases(String parent) List all databases in a specified catalog.List all databases in a specified catalog.List all databases in a specified catalog.listTables(DatabaseName parent) List all tables in a specified database.listTables(ListTablesRequest request) List all tables in a specified database.listTables(String parent) List all tables in a specified database.List all tables in a specified database.List all tables in a specified database.final TablerenameTable(RenameTableRequest request) Renames an existing table specified by the table ID.final TablerenameTable(TableName name, TableName newName) Renames an existing table specified by the table ID.final TablerenameTable(TableName name, String newName) Renames an existing table specified by the table ID.final TablerenameTable(String name, TableName newName) Renames an existing table specified by the table ID.final TablerenameTable(String name, String newName) Renames an existing table specified by the table ID.final UnaryCallable<RenameTableRequest,Table> Renames an existing table specified by the table ID.voidshutdown()voidfinal DatabaseupdateDatabase(Database database, com.google.protobuf.FieldMask updateMask) Updates an existing database specified by the database ID.final DatabaseupdateDatabase(UpdateDatabaseRequest request) Updates an existing database specified by the database ID.Updates an existing database specified by the database ID.final TableupdateTable(Table table, com.google.protobuf.FieldMask updateMask) Updates an existing table specified by the table ID.final TableupdateTable(UpdateTableRequest request) Updates an existing table specified by the table ID.final UnaryCallable<UpdateTableRequest,Table> Updates an existing table specified by the table ID.
-
Constructor Details
-
MetastoreServiceClient
Constructs an instance of MetastoreServiceClient, using the given settings. This is protected so that it is easy to make a subclass, but otherwise, the static factory methods should be preferred.- Throws:
IOException
-
MetastoreServiceClient
-
-
Method Details
-
create
Constructs an instance of MetastoreServiceClient with default settings.- Throws:
IOException
-
create
public static final MetastoreServiceClient create(MetastoreServiceSettings settings) throws IOException Constructs an instance of MetastoreServiceClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.- Throws:
IOException
-
create
Constructs an instance of MetastoreServiceClient, using the given stub for making calls. This is for advanced usage - prefer using create(MetastoreServiceSettings). -
getSettings
-
getStub
-
createCatalog
Creates a new catalog.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 (MetastoreServiceClient metastoreServiceClient = MetastoreServiceClient.create()) { LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); Catalog catalog = Catalog.newBuilder().build(); String catalogId = "catalogId1455933204"; Catalog response = metastoreServiceClient.createCatalog(parent, catalog, catalogId); }- Parameters:
parent- Required. The parent resource where this catalog will be created. Format: projects/{project_id_or_number}/locations/{location_id}catalog- Required. The catalog to create. The `name` field does not need to be provided.catalogId- Required. The ID to use for the catalog, which will become the final component of the catalog's resource name.- Throws:
ApiException- if the remote call fails
-
createCatalog
Creates a new catalog.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 (MetastoreServiceClient metastoreServiceClient = MetastoreServiceClient.create()) { String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); Catalog catalog = Catalog.newBuilder().build(); String catalogId = "catalogId1455933204"; Catalog response = metastoreServiceClient.createCatalog(parent, catalog, catalogId); }- Parameters:
parent- Required. The parent resource where this catalog will be created. Format: projects/{project_id_or_number}/locations/{location_id}catalog- Required. The catalog to create. The `name` field does not need to be provided.catalogId- Required. The ID to use for the catalog, which will become the final component of the catalog's resource name.- Throws:
ApiException- if the remote call fails
-
createCatalog
Creates a new catalog.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 (MetastoreServiceClient metastoreServiceClient = MetastoreServiceClient.create()) { CreateCatalogRequest request = CreateCatalogRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setCatalog(Catalog.newBuilder().build()) .setCatalogId("catalogId1455933204") .build(); Catalog response = metastoreServiceClient.createCatalog(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
createCatalogCallable
Creates a new catalog.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 (MetastoreServiceClient metastoreServiceClient = MetastoreServiceClient.create()) { CreateCatalogRequest request = CreateCatalogRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setCatalog(Catalog.newBuilder().build()) .setCatalogId("catalogId1455933204") .build(); ApiFuture<Catalog> future = metastoreServiceClient.createCatalogCallable().futureCall(request); // Do something. Catalog response = future.get(); } -
deleteCatalog
Deletes an existing catalog specified by the catalog ID.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 (MetastoreServiceClient metastoreServiceClient = MetastoreServiceClient.create()) { CatalogName name = CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]"); Catalog response = metastoreServiceClient.deleteCatalog(name); }- Parameters:
name- Required. The name of the catalog to delete. Format: projects/{project_id_or_number}/locations/{location_id}/catalogs/{catalog_id}- Throws:
ApiException- if the remote call fails
-
deleteCatalog
Deletes an existing catalog specified by the catalog ID.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 (MetastoreServiceClient metastoreServiceClient = MetastoreServiceClient.create()) { String name = CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString(); Catalog response = metastoreServiceClient.deleteCatalog(name); }- Parameters:
name- Required. The name of the catalog to delete. Format: projects/{project_id_or_number}/locations/{location_id}/catalogs/{catalog_id}- Throws:
ApiException- if the remote call fails
-
deleteCatalog
Deletes an existing catalog specified by the catalog ID.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 (MetastoreServiceClient metastoreServiceClient = MetastoreServiceClient.create()) { DeleteCatalogRequest request = DeleteCatalogRequest.newBuilder() .setName(CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString()) .build(); Catalog response = metastoreServiceClient.deleteCatalog(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
deleteCatalogCallable
Deletes an existing catalog specified by the catalog ID.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 (MetastoreServiceClient metastoreServiceClient = MetastoreServiceClient.create()) { DeleteCatalogRequest request = DeleteCatalogRequest.newBuilder() .setName(CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString()) .build(); ApiFuture<Catalog> future = metastoreServiceClient.deleteCatalogCallable().futureCall(request); // Do something. Catalog response = future.get(); } -
getCatalog
Gets the catalog specified by the resource name.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 (MetastoreServiceClient metastoreServiceClient = MetastoreServiceClient.create()) { CatalogName name = CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]"); Catalog response = metastoreServiceClient.getCatalog(name); }- Parameters:
name- Required. The name of the catalog to retrieve. Format: projects/{project_id_or_number}/locations/{location_id}/catalogs/{catalog_id}- Throws:
ApiException- if the remote call fails
-
getCatalog
Gets the catalog specified by the resource name.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 (MetastoreServiceClient metastoreServiceClient = MetastoreServiceClient.create()) { String name = CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString(); Catalog response = metastoreServiceClient.getCatalog(name); }- Parameters:
name- Required. The name of the catalog to retrieve. Format: projects/{project_id_or_number}/locations/{location_id}/catalogs/{catalog_id}- Throws:
ApiException- if the remote call fails
-
getCatalog
Gets the catalog specified by the resource name.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 (MetastoreServiceClient metastoreServiceClient = MetastoreServiceClient.create()) { GetCatalogRequest request = GetCatalogRequest.newBuilder() .setName(CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString()) .build(); Catalog response = metastoreServiceClient.getCatalog(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
getCatalogCallable
Gets the catalog specified by the resource name.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 (MetastoreServiceClient metastoreServiceClient = MetastoreServiceClient.create()) { GetCatalogRequest request = GetCatalogRequest.newBuilder() .setName(CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString()) .build(); ApiFuture<Catalog> future = metastoreServiceClient.getCatalogCallable().futureCall(request); // Do something. Catalog response = future.get(); } -
listCatalogs
List all catalogs in a specified project.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (MetastoreServiceClient metastoreServiceClient = MetastoreServiceClient.create()) { LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); for (Catalog element : metastoreServiceClient.listCatalogs(parent).iterateAll()) { // doThingsWith(element); } }- Parameters:
parent- Required. The parent, which owns this collection of catalogs. Format: projects/{project_id_or_number}/locations/{location_id}- Throws:
ApiException- if the remote call fails
-
listCatalogs
List all catalogs in a specified project.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (MetastoreServiceClient metastoreServiceClient = MetastoreServiceClient.create()) { String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); for (Catalog element : metastoreServiceClient.listCatalogs(parent).iterateAll()) { // doThingsWith(element); } }- Parameters:
parent- Required. The parent, which owns this collection of catalogs. Format: projects/{project_id_or_number}/locations/{location_id}- Throws:
ApiException- if the remote call fails
-
listCatalogs
public final MetastoreServiceClient.ListCatalogsPagedResponse listCatalogs(ListCatalogsRequest request) List all catalogs in a specified project.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (MetastoreServiceClient metastoreServiceClient = MetastoreServiceClient.create()) { ListCatalogsRequest request = ListCatalogsRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setPageSize(883849137) .setPageToken("pageToken873572522") .build(); for (Catalog element : metastoreServiceClient.listCatalogs(request).iterateAll()) { // doThingsWith(element); } }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
listCatalogsPagedCallable
public final UnaryCallable<ListCatalogsRequest,MetastoreServiceClient.ListCatalogsPagedResponse> listCatalogsPagedCallable()List all catalogs in a specified project.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (MetastoreServiceClient metastoreServiceClient = MetastoreServiceClient.create()) { ListCatalogsRequest request = ListCatalogsRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setPageSize(883849137) .setPageToken("pageToken873572522") .build(); ApiFuture<Catalog> future = metastoreServiceClient.listCatalogsPagedCallable().futureCall(request); // Do something. for (Catalog element : future.get().iterateAll()) { // doThingsWith(element); } } -
listCatalogsCallable
List all catalogs in a specified project.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (MetastoreServiceClient metastoreServiceClient = MetastoreServiceClient.create()) { ListCatalogsRequest request = ListCatalogsRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setPageSize(883849137) .setPageToken("pageToken873572522") .build(); while (true) { ListCatalogsResponse response = metastoreServiceClient.listCatalogsCallable().call(request); for (Catalog element : response.getCatalogsList()) { // doThingsWith(element); } String nextPageToken = response.getNextPageToken(); if (!Strings.isNullOrEmpty(nextPageToken)) { request = request.toBuilder().setPageToken(nextPageToken).build(); } else { break; } } } -
createDatabase
Creates a new database.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 (MetastoreServiceClient metastoreServiceClient = MetastoreServiceClient.create()) { CatalogName parent = CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]"); Database database = Database.newBuilder().build(); String databaseId = "databaseId1688905718"; Database response = metastoreServiceClient.createDatabase(parent, database, databaseId); }- Parameters:
parent- Required. The parent resource where this database will be created. Format: projects/{project_id_or_number}/locations/{location_id}/catalogs/{catalog_id}database- Required. The database to create. The `name` field does not need to be provided.databaseId- Required. The ID to use for the database, which will become the final component of the database's resource name.- Throws:
ApiException- if the remote call fails
-
createDatabase
Creates a new database.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 (MetastoreServiceClient metastoreServiceClient = MetastoreServiceClient.create()) { String parent = CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString(); Database database = Database.newBuilder().build(); String databaseId = "databaseId1688905718"; Database response = metastoreServiceClient.createDatabase(parent, database, databaseId); }- Parameters:
parent- Required. The parent resource where this database will be created. Format: projects/{project_id_or_number}/locations/{location_id}/catalogs/{catalog_id}database- Required. The database to create. The `name` field does not need to be provided.databaseId- Required. The ID to use for the database, which will become the final component of the database's resource name.- Throws:
ApiException- if the remote call fails
-
createDatabase
Creates a new database.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 (MetastoreServiceClient metastoreServiceClient = MetastoreServiceClient.create()) { CreateDatabaseRequest request = CreateDatabaseRequest.newBuilder() .setParent(CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString()) .setDatabase(Database.newBuilder().build()) .setDatabaseId("databaseId1688905718") .build(); Database response = metastoreServiceClient.createDatabase(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
createDatabaseCallable
Creates a new database.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 (MetastoreServiceClient metastoreServiceClient = MetastoreServiceClient.create()) { CreateDatabaseRequest request = CreateDatabaseRequest.newBuilder() .setParent(CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString()) .setDatabase(Database.newBuilder().build()) .setDatabaseId("databaseId1688905718") .build(); ApiFuture<Database> future = metastoreServiceClient.createDatabaseCallable().futureCall(request); // Do something. Database response = future.get(); } -
deleteDatabase
Deletes an existing database specified by the database ID.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 (MetastoreServiceClient metastoreServiceClient = MetastoreServiceClient.create()) { DatabaseName name = DatabaseName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[DATABASE]"); Database response = metastoreServiceClient.deleteDatabase(name); }- Parameters:
name- Required. The name of the database to delete. Format: projects/{project_id_or_number}/locations/{location_id}/catalogs/{catalog_id}/databases/{database_id}- Throws:
ApiException- if the remote call fails
-
deleteDatabase
Deletes an existing database specified by the database ID.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 (MetastoreServiceClient metastoreServiceClient = MetastoreServiceClient.create()) { String name = DatabaseName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[DATABASE]").toString(); Database response = metastoreServiceClient.deleteDatabase(name); }- Parameters:
name- Required. The name of the database to delete. Format: projects/{project_id_or_number}/locations/{location_id}/catalogs/{catalog_id}/databases/{database_id}- Throws:
ApiException- if the remote call fails
-
deleteDatabase
Deletes an existing database specified by the database ID.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 (MetastoreServiceClient metastoreServiceClient = MetastoreServiceClient.create()) { DeleteDatabaseRequest request = DeleteDatabaseRequest.newBuilder() .setName( DatabaseName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[DATABASE]").toString()) .build(); Database response = metastoreServiceClient.deleteDatabase(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
deleteDatabaseCallable
Deletes an existing database specified by the database ID.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 (MetastoreServiceClient metastoreServiceClient = MetastoreServiceClient.create()) { DeleteDatabaseRequest request = DeleteDatabaseRequest.newBuilder() .setName( DatabaseName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[DATABASE]").toString()) .build(); ApiFuture<Database> future = metastoreServiceClient.deleteDatabaseCallable().futureCall(request); // Do something. Database response = future.get(); } -
updateDatabase
Updates an existing database specified by the database ID.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 (MetastoreServiceClient metastoreServiceClient = MetastoreServiceClient.create()) { Database database = Database.newBuilder().build(); FieldMask updateMask = FieldMask.newBuilder().build(); Database response = metastoreServiceClient.updateDatabase(database, updateMask); }- Parameters:
database- Required. The database to update.The database's `name` field is used to identify the database to update. Format: projects/{project_id_or_number}/locations/{location_id}/catalogs/{catalog_id}/databases/{database_id}
updateMask- The list of fields to update.For the `FieldMask` definition, see https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask If not set, defaults to all of the fields that are allowed to update.
- Throws:
ApiException- if the remote call fails
-
updateDatabase
Updates an existing database specified by the database ID.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 (MetastoreServiceClient metastoreServiceClient = MetastoreServiceClient.create()) { UpdateDatabaseRequest request = UpdateDatabaseRequest.newBuilder() .setDatabase(Database.newBuilder().build()) .setUpdateMask(FieldMask.newBuilder().build()) .build(); Database response = metastoreServiceClient.updateDatabase(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
updateDatabaseCallable
Updates an existing database specified by the database ID.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 (MetastoreServiceClient metastoreServiceClient = MetastoreServiceClient.create()) { UpdateDatabaseRequest request = UpdateDatabaseRequest.newBuilder() .setDatabase(Database.newBuilder().build()) .setUpdateMask(FieldMask.newBuilder().build()) .build(); ApiFuture<Database> future = metastoreServiceClient.updateDatabaseCallable().futureCall(request); // Do something. Database response = future.get(); } -
getDatabase
Gets the database specified by the resource name.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 (MetastoreServiceClient metastoreServiceClient = MetastoreServiceClient.create()) { DatabaseName name = DatabaseName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[DATABASE]"); Database response = metastoreServiceClient.getDatabase(name); }- Parameters:
name- Required. The name of the database to retrieve. Format: projects/{project_id_or_number}/locations/{location_id}/catalogs/{catalog_id}/databases/{database_id}- Throws:
ApiException- if the remote call fails
-
getDatabase
Gets the database specified by the resource name.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 (MetastoreServiceClient metastoreServiceClient = MetastoreServiceClient.create()) { String name = DatabaseName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[DATABASE]").toString(); Database response = metastoreServiceClient.getDatabase(name); }- Parameters:
name- Required. The name of the database to retrieve. Format: projects/{project_id_or_number}/locations/{location_id}/catalogs/{catalog_id}/databases/{database_id}- Throws:
ApiException- if the remote call fails
-
getDatabase
Gets the database specified by the resource name.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 (MetastoreServiceClient metastoreServiceClient = MetastoreServiceClient.create()) { GetDatabaseRequest request = GetDatabaseRequest.newBuilder() .setName( DatabaseName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[DATABASE]").toString()) .build(); Database response = metastoreServiceClient.getDatabase(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
getDatabaseCallable
Gets the database specified by the resource name.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 (MetastoreServiceClient metastoreServiceClient = MetastoreServiceClient.create()) { GetDatabaseRequest request = GetDatabaseRequest.newBuilder() .setName( DatabaseName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[DATABASE]").toString()) .build(); ApiFuture<Database> future = metastoreServiceClient.getDatabaseCallable().futureCall(request); // Do something. Database response = future.get(); } -
listDatabases
List all databases in a specified catalog.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 (MetastoreServiceClient metastoreServiceClient = MetastoreServiceClient.create()) { CatalogName parent = CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]"); for (Database element : metastoreServiceClient.listDatabases(parent).iterateAll()) { // doThingsWith(element); } }- Parameters:
parent- Required. The parent, which owns this collection of databases. Format: projects/{project_id_or_number}/locations/{location_id}/catalogs/{catalog_id}- Throws:
ApiException- if the remote call fails
-
listDatabases
List all databases in a specified catalog.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 (MetastoreServiceClient metastoreServiceClient = MetastoreServiceClient.create()) { String parent = CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString(); for (Database element : metastoreServiceClient.listDatabases(parent).iterateAll()) { // doThingsWith(element); } }- Parameters:
parent- Required. The parent, which owns this collection of databases. Format: projects/{project_id_or_number}/locations/{location_id}/catalogs/{catalog_id}- Throws:
ApiException- if the remote call fails
-
listDatabases
public final MetastoreServiceClient.ListDatabasesPagedResponse listDatabases(ListDatabasesRequest request) List all databases in a specified catalog.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 (MetastoreServiceClient metastoreServiceClient = MetastoreServiceClient.create()) { ListDatabasesRequest request = ListDatabasesRequest.newBuilder() .setParent(CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString()) .setPageSize(883849137) .setPageToken("pageToken873572522") .build(); for (Database element : metastoreServiceClient.listDatabases(request).iterateAll()) { // doThingsWith(element); } }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
listDatabasesPagedCallable
public final UnaryCallable<ListDatabasesRequest,MetastoreServiceClient.ListDatabasesPagedResponse> listDatabasesPagedCallable()List all databases in a specified catalog.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 (MetastoreServiceClient metastoreServiceClient = MetastoreServiceClient.create()) { ListDatabasesRequest request = ListDatabasesRequest.newBuilder() .setParent(CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString()) .setPageSize(883849137) .setPageToken("pageToken873572522") .build(); ApiFuture<Database> future = metastoreServiceClient.listDatabasesPagedCallable().futureCall(request); // Do something. for (Database element : future.get().iterateAll()) { // doThingsWith(element); } } -
listDatabasesCallable
List all databases in a specified catalog.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 (MetastoreServiceClient metastoreServiceClient = MetastoreServiceClient.create()) { ListDatabasesRequest request = ListDatabasesRequest.newBuilder() .setParent(CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString()) .setPageSize(883849137) .setPageToken("pageToken873572522") .build(); while (true) { ListDatabasesResponse response = metastoreServiceClient.listDatabasesCallable().call(request); for (Database element : response.getDatabasesList()) { // doThingsWith(element); } String nextPageToken = response.getNextPageToken(); if (!Strings.isNullOrEmpty(nextPageToken)) { request = request.toBuilder().setPageToken(nextPageToken).build(); } else { break; } } } -
createTable
Creates a new table.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 (MetastoreServiceClient metastoreServiceClient = MetastoreServiceClient.create()) { DatabaseName parent = DatabaseName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[DATABASE]"); Table table = Table.newBuilder().build(); String tableId = "tableId-1552905847"; Table response = metastoreServiceClient.createTable(parent, table, tableId); }- Parameters:
parent- Required. The parent resource where this table will be created. Format: projects/{project_id_or_number}/locations/{location_id}/catalogs/{catalog_id}/databases/{database_id}table- Required. The table to create. The `name` field does not need to be provided for the table creation.tableId- Required. The ID to use for the table, which will become the final component of the table's resource name.- Throws:
ApiException- if the remote call fails
-
createTable
Creates a new table.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 (MetastoreServiceClient metastoreServiceClient = MetastoreServiceClient.create()) { String parent = DatabaseName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[DATABASE]").toString(); Table table = Table.newBuilder().build(); String tableId = "tableId-1552905847"; Table response = metastoreServiceClient.createTable(parent, table, tableId); }- Parameters:
parent- Required. The parent resource where this table will be created. Format: projects/{project_id_or_number}/locations/{location_id}/catalogs/{catalog_id}/databases/{database_id}table- Required. The table to create. The `name` field does not need to be provided for the table creation.tableId- Required. The ID to use for the table, which will become the final component of the table's resource name.- Throws:
ApiException- if the remote call fails
-
createTable
Creates a new table.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 (MetastoreServiceClient metastoreServiceClient = MetastoreServiceClient.create()) { CreateTableRequest request = CreateTableRequest.newBuilder() .setParent( DatabaseName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[DATABASE]").toString()) .setTable(Table.newBuilder().build()) .setTableId("tableId-1552905847") .build(); Table response = metastoreServiceClient.createTable(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
createTableCallable
Creates a new table.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 (MetastoreServiceClient metastoreServiceClient = MetastoreServiceClient.create()) { CreateTableRequest request = CreateTableRequest.newBuilder() .setParent( DatabaseName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[DATABASE]").toString()) .setTable(Table.newBuilder().build()) .setTableId("tableId-1552905847") .build(); ApiFuture<Table> future = metastoreServiceClient.createTableCallable().futureCall(request); // Do something. Table response = future.get(); } -
deleteTable
Deletes an existing table specified by the table ID.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 (MetastoreServiceClient metastoreServiceClient = MetastoreServiceClient.create()) { TableName name = TableName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[DATABASE]", "[TABLE]"); Table response = metastoreServiceClient.deleteTable(name); }- Parameters:
name- Required. The name of the table to delete. Format: projects/{project_id_or_number}/locations/{location_id}/catalogs/{catalog_id}/databases/{database_id}/tables/{table_id}- Throws:
ApiException- if the remote call fails
-
deleteTable
Deletes an existing table specified by the table ID.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 (MetastoreServiceClient metastoreServiceClient = MetastoreServiceClient.create()) { String name = TableName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[DATABASE]", "[TABLE]").toString(); Table response = metastoreServiceClient.deleteTable(name); }- Parameters:
name- Required. The name of the table to delete. Format: projects/{project_id_or_number}/locations/{location_id}/catalogs/{catalog_id}/databases/{database_id}/tables/{table_id}- Throws:
ApiException- if the remote call fails
-
deleteTable
Deletes an existing table specified by the table ID.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 (MetastoreServiceClient metastoreServiceClient = MetastoreServiceClient.create()) { DeleteTableRequest request = DeleteTableRequest.newBuilder() .setName( TableName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[DATABASE]", "[TABLE]") .toString()) .build(); Table response = metastoreServiceClient.deleteTable(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
deleteTableCallable
Deletes an existing table specified by the table ID.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 (MetastoreServiceClient metastoreServiceClient = MetastoreServiceClient.create()) { DeleteTableRequest request = DeleteTableRequest.newBuilder() .setName( TableName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[DATABASE]", "[TABLE]") .toString()) .build(); ApiFuture<Table> future = metastoreServiceClient.deleteTableCallable().futureCall(request); // Do something. Table response = future.get(); } -
updateTable
Updates an existing table specified by the table ID.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 (MetastoreServiceClient metastoreServiceClient = MetastoreServiceClient.create()) { Table table = Table.newBuilder().build(); FieldMask updateMask = FieldMask.newBuilder().build(); Table response = metastoreServiceClient.updateTable(table, updateMask); }- Parameters:
table- Required. The table to update.The table's `name` field is used to identify the table to update. Format: projects/{project_id_or_number}/locations/{location_id}/catalogs/{catalog_id}/databases/{database_id}/tables/{table_id}
updateMask- The list of fields to update.For the `FieldMask` definition, see https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask If not set, defaults to all of the fields that are allowed to update.
- Throws:
ApiException- if the remote call fails
-
updateTable
Updates an existing table specified by the table ID.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 (MetastoreServiceClient metastoreServiceClient = MetastoreServiceClient.create()) { UpdateTableRequest request = UpdateTableRequest.newBuilder() .setTable(Table.newBuilder().build()) .setUpdateMask(FieldMask.newBuilder().build()) .build(); Table response = metastoreServiceClient.updateTable(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
updateTableCallable
Updates an existing table specified by the table ID.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 (MetastoreServiceClient metastoreServiceClient = MetastoreServiceClient.create()) { UpdateTableRequest request = UpdateTableRequest.newBuilder() .setTable(Table.newBuilder().build()) .setUpdateMask(FieldMask.newBuilder().build()) .build(); ApiFuture<Table> future = metastoreServiceClient.updateTableCallable().futureCall(request); // Do something. Table response = future.get(); } -
renameTable
Renames an existing table specified by the table ID.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 (MetastoreServiceClient metastoreServiceClient = MetastoreServiceClient.create()) { TableName name = TableName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[DATABASE]", "[TABLE]"); TableName newName = TableName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[DATABASE]", "[TABLE]"); Table response = metastoreServiceClient.renameTable(name, newName); }- Parameters:
name- Required. The table's `name` field is used to identify the table to rename. Format: projects/{project_id_or_number}/locations/{location_id}/catalogs/{catalog_id}/databases/{database_id}/tables/{table_id}newName- Required. The new `name` for the specified table, must be in the same database. Format: projects/{project_id_or_number}/locations/{location_id}/catalogs/{catalog_id}/databases/{database_id}/tables/{table_id}- Throws:
ApiException- if the remote call fails
-
renameTable
Renames an existing table specified by the table ID.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 (MetastoreServiceClient metastoreServiceClient = MetastoreServiceClient.create()) { TableName name = TableName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[DATABASE]", "[TABLE]"); String newName = TableName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[DATABASE]", "[TABLE]").toString(); Table response = metastoreServiceClient.renameTable(name, newName); }- Parameters:
name- Required. The table's `name` field is used to identify the table to rename. Format: projects/{project_id_or_number}/locations/{location_id}/catalogs/{catalog_id}/databases/{database_id}/tables/{table_id}newName- Required. The new `name` for the specified table, must be in the same database. Format: projects/{project_id_or_number}/locations/{location_id}/catalogs/{catalog_id}/databases/{database_id}/tables/{table_id}- Throws:
ApiException- if the remote call fails
-
renameTable
Renames an existing table specified by the table ID.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 (MetastoreServiceClient metastoreServiceClient = MetastoreServiceClient.create()) { String name = TableName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[DATABASE]", "[TABLE]").toString(); TableName newName = TableName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[DATABASE]", "[TABLE]"); Table response = metastoreServiceClient.renameTable(name, newName); }- Parameters:
name- Required. The table's `name` field is used to identify the table to rename. Format: projects/{project_id_or_number}/locations/{location_id}/catalogs/{catalog_id}/databases/{database_id}/tables/{table_id}newName- Required. The new `name` for the specified table, must be in the same database. Format: projects/{project_id_or_number}/locations/{location_id}/catalogs/{catalog_id}/databases/{database_id}/tables/{table_id}- Throws:
ApiException- if the remote call fails
-
renameTable
Renames an existing table specified by the table ID.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 (MetastoreServiceClient metastoreServiceClient = MetastoreServiceClient.create()) { String name = TableName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[DATABASE]", "[TABLE]").toString(); String newName = TableName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[DATABASE]", "[TABLE]").toString(); Table response = metastoreServiceClient.renameTable(name, newName); }- Parameters:
name- Required. The table's `name` field is used to identify the table to rename. Format: projects/{project_id_or_number}/locations/{location_id}/catalogs/{catalog_id}/databases/{database_id}/tables/{table_id}newName- Required. The new `name` for the specified table, must be in the same database. Format: projects/{project_id_or_number}/locations/{location_id}/catalogs/{catalog_id}/databases/{database_id}/tables/{table_id}- Throws:
ApiException- if the remote call fails
-
renameTable
Renames an existing table specified by the table ID.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 (MetastoreServiceClient metastoreServiceClient = MetastoreServiceClient.create()) { RenameTableRequest request = RenameTableRequest.newBuilder() .setName( TableName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[DATABASE]", "[TABLE]") .toString()) .setNewName( TableName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[DATABASE]", "[TABLE]") .toString()) .build(); Table response = metastoreServiceClient.renameTable(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
renameTableCallable
Renames an existing table specified by the table ID.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 (MetastoreServiceClient metastoreServiceClient = MetastoreServiceClient.create()) { RenameTableRequest request = RenameTableRequest.newBuilder() .setName( TableName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[DATABASE]", "[TABLE]") .toString()) .setNewName( TableName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[DATABASE]", "[TABLE]") .toString()) .build(); ApiFuture<Table> future = metastoreServiceClient.renameTableCallable().futureCall(request); // Do something. Table response = future.get(); } -
getTable
Gets the table specified by the resource name.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 (MetastoreServiceClient metastoreServiceClient = MetastoreServiceClient.create()) { TableName name = TableName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[DATABASE]", "[TABLE]"); Table response = metastoreServiceClient.getTable(name); }- Parameters:
name- Required. The name of the table to retrieve. Format: projects/{project_id_or_number}/locations/{location_id}/catalogs/{catalog_id}/databases/{database_id}/tables/{table_id}- Throws:
ApiException- if the remote call fails
-
getTable
Gets the table specified by the resource name.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 (MetastoreServiceClient metastoreServiceClient = MetastoreServiceClient.create()) { String name = TableName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[DATABASE]", "[TABLE]").toString(); Table response = metastoreServiceClient.getTable(name); }- Parameters:
name- Required. The name of the table to retrieve. Format: projects/{project_id_or_number}/locations/{location_id}/catalogs/{catalog_id}/databases/{database_id}/tables/{table_id}- Throws:
ApiException- if the remote call fails
-
getTable
Gets the table specified by the resource name.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 (MetastoreServiceClient metastoreServiceClient = MetastoreServiceClient.create()) { GetTableRequest request = GetTableRequest.newBuilder() .setName( TableName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[DATABASE]", "[TABLE]") .toString()) .build(); Table response = metastoreServiceClient.getTable(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
getTableCallable
Gets the table specified by the resource name.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 (MetastoreServiceClient metastoreServiceClient = MetastoreServiceClient.create()) { GetTableRequest request = GetTableRequest.newBuilder() .setName( TableName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[DATABASE]", "[TABLE]") .toString()) .build(); ApiFuture<Table> future = metastoreServiceClient.getTableCallable().futureCall(request); // Do something. Table response = future.get(); } -
listTables
List all tables in a specified database.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 (MetastoreServiceClient metastoreServiceClient = MetastoreServiceClient.create()) { DatabaseName parent = DatabaseName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[DATABASE]"); for (Table element : metastoreServiceClient.listTables(parent).iterateAll()) { // doThingsWith(element); } }- Parameters:
parent- Required. The parent, which owns this collection of tables. Format: projects/{project_id_or_number}/locations/{location_id}/catalogs/{catalog_id}/databases/{database_id}- Throws:
ApiException- if the remote call fails
-
listTables
List all tables in a specified database.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 (MetastoreServiceClient metastoreServiceClient = MetastoreServiceClient.create()) { String parent = DatabaseName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[DATABASE]").toString(); for (Table element : metastoreServiceClient.listTables(parent).iterateAll()) { // doThingsWith(element); } }- Parameters:
parent- Required. The parent, which owns this collection of tables. Format: projects/{project_id_or_number}/locations/{location_id}/catalogs/{catalog_id}/databases/{database_id}- Throws:
ApiException- if the remote call fails
-
listTables
List all tables in a specified database.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 (MetastoreServiceClient metastoreServiceClient = MetastoreServiceClient.create()) { ListTablesRequest request = ListTablesRequest.newBuilder() .setParent( DatabaseName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[DATABASE]").toString()) .setPageSize(883849137) .setPageToken("pageToken873572522") .setView(TableView.forNumber(0)) .build(); for (Table element : metastoreServiceClient.listTables(request).iterateAll()) { // doThingsWith(element); } }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
listTablesPagedCallable
public final UnaryCallable<ListTablesRequest,MetastoreServiceClient.ListTablesPagedResponse> listTablesPagedCallable()List all tables in a specified database.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 (MetastoreServiceClient metastoreServiceClient = MetastoreServiceClient.create()) { ListTablesRequest request = ListTablesRequest.newBuilder() .setParent( DatabaseName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[DATABASE]").toString()) .setPageSize(883849137) .setPageToken("pageToken873572522") .setView(TableView.forNumber(0)) .build(); ApiFuture<Table> future = metastoreServiceClient.listTablesPagedCallable().futureCall(request); // Do something. for (Table element : future.get().iterateAll()) { // doThingsWith(element); } } -
listTablesCallable
List all tables in a specified database.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 (MetastoreServiceClient metastoreServiceClient = MetastoreServiceClient.create()) { ListTablesRequest request = ListTablesRequest.newBuilder() .setParent( DatabaseName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[DATABASE]").toString()) .setPageSize(883849137) .setPageToken("pageToken873572522") .setView(TableView.forNumber(0)) .build(); while (true) { ListTablesResponse response = metastoreServiceClient.listTablesCallable().call(request); for (Table element : response.getTablesList()) { // doThingsWith(element); } String nextPageToken = response.getNextPageToken(); if (!Strings.isNullOrEmpty(nextPageToken)) { request = request.toBuilder().setPageToken(nextPageToken).build(); } else { break; } } } -
close
public final void close()- Specified by:
closein interfaceAutoCloseable
-
shutdown
public void shutdown()- Specified by:
shutdownin interfaceBackgroundResource
-
isShutdown
public boolean isShutdown()- Specified by:
isShutdownin interfaceBackgroundResource
-
isTerminated
public boolean isTerminated()- Specified by:
isTerminatedin interfaceBackgroundResource
-
shutdownNow
public void shutdownNow()- Specified by:
shutdownNowin interfaceBackgroundResource
-
awaitTermination
- Specified by:
awaitTerminationin interfaceBackgroundResource- Throws:
InterruptedException
-