@BetaApi @Generated(value="by gapic-generator-java") public class MetastoreServiceClient extends Object implements com.google.api.gax.core.BackgroundResource
The BigLake Metastore API defines the following resource model:
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().
The surface of this class includes several types of Java methods for each of the API's methods:
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.
| Modifier and Type | Class and Description |
|---|---|
static class |
MetastoreServiceClient.ListCatalogsFixedSizeCollection |
static class |
MetastoreServiceClient.ListCatalogsPage |
static class |
MetastoreServiceClient.ListCatalogsPagedResponse |
static class |
MetastoreServiceClient.ListDatabasesFixedSizeCollection |
static class |
MetastoreServiceClient.ListDatabasesPage |
static class |
MetastoreServiceClient.ListDatabasesPagedResponse |
static class |
MetastoreServiceClient.ListLocksFixedSizeCollection |
static class |
MetastoreServiceClient.ListLocksPage |
static class |
MetastoreServiceClient.ListLocksPagedResponse |
static class |
MetastoreServiceClient.ListTablesFixedSizeCollection |
static class |
MetastoreServiceClient.ListTablesPage |
static class |
MetastoreServiceClient.ListTablesPagedResponse |
| Modifier | Constructor and Description |
|---|---|
protected |
MetastoreServiceClient(MetastoreServiceSettings settings)
Constructs an instance of MetastoreServiceClient, using the given settings.
|
protected |
MetastoreServiceClient(MetastoreServiceStub stub) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
awaitTermination(long duration,
TimeUnit unit) |
Lock |
checkLock(CheckLockRequest request)
Checks the state of a lock specified by the lock ID.
|
Lock |
checkLock(LockName name)
Checks the state of a lock specified by the lock ID.
|
Lock |
checkLock(String name)
Checks the state of a lock specified by the lock ID.
|
com.google.api.gax.rpc.UnaryCallable<CheckLockRequest,Lock> |
checkLockCallable()
Checks the state of a lock specified by the lock ID.
|
void |
close() |
static MetastoreServiceClient |
create()
Constructs an instance of MetastoreServiceClient with default settings.
|
static MetastoreServiceClient |
create(MetastoreServiceSettings settings)
Constructs an instance of MetastoreServiceClient, using the given settings.
|
static MetastoreServiceClient |
create(MetastoreServiceStub stub)
Constructs an instance of MetastoreServiceClient, using the given stub for making calls.
|
Catalog |
createCatalog(CreateCatalogRequest request)
Creates a new catalog.
|
Catalog |
createCatalog(LocationName parent,
Catalog catalog,
String catalogId)
Creates a new catalog.
|
Catalog |
createCatalog(String parent,
Catalog catalog,
String catalogId)
Creates a new catalog.
|
com.google.api.gax.rpc.UnaryCallable<CreateCatalogRequest,Catalog> |
createCatalogCallable()
Creates a new catalog.
|
Database |
createDatabase(CatalogName parent,
Database database,
String databaseId)
Creates a new database.
|
Database |
createDatabase(CreateDatabaseRequest request)
Creates a new database.
|
Database |
createDatabase(String parent,
Database database,
String databaseId)
Creates a new database.
|
com.google.api.gax.rpc.UnaryCallable<CreateDatabaseRequest,Database> |
createDatabaseCallable()
Creates a new database.
|
Lock |
createLock(CreateLockRequest request)
Creates a new lock.
|
Lock |
createLock(DatabaseName parent,
Lock lock)
Creates a new lock.
|
Lock |
createLock(String parent,
Lock lock)
Creates a new lock.
|
com.google.api.gax.rpc.UnaryCallable<CreateLockRequest,Lock> |
createLockCallable()
Creates a new lock.
|
Table |
createTable(CreateTableRequest request)
Creates a new table.
|
Table |
createTable(DatabaseName parent,
Table table,
String tableId)
Creates a new table.
|
Table |
createTable(String parent,
Table table,
String tableId)
Creates a new table.
|
com.google.api.gax.rpc.UnaryCallable<CreateTableRequest,Table> |
createTableCallable()
Creates a new table.
|
Catalog |
deleteCatalog(CatalogName name)
Deletes an existing catalog specified by the catalog ID.
|
Catalog |
deleteCatalog(DeleteCatalogRequest request)
Deletes an existing catalog specified by the catalog ID.
|
Catalog |
deleteCatalog(String name)
Deletes an existing catalog specified by the catalog ID.
|
com.google.api.gax.rpc.UnaryCallable<DeleteCatalogRequest,Catalog> |
deleteCatalogCallable()
Deletes an existing catalog specified by the catalog ID.
|
Database |
deleteDatabase(DatabaseName name)
Deletes an existing database specified by the database ID.
|
Database |
deleteDatabase(DeleteDatabaseRequest request)
Deletes an existing database specified by the database ID.
|
Database |
deleteDatabase(String name)
Deletes an existing database specified by the database ID.
|
com.google.api.gax.rpc.UnaryCallable<DeleteDatabaseRequest,Database> |
deleteDatabaseCallable()
Deletes an existing database specified by the database ID.
|
void |
deleteLock(DeleteLockRequest request)
Deletes an existing lock specified by the lock ID.
|
void |
deleteLock(LockName name)
Deletes an existing lock specified by the lock ID.
|
void |
deleteLock(String name)
Deletes an existing lock specified by the lock ID.
|
com.google.api.gax.rpc.UnaryCallable<DeleteLockRequest,com.google.protobuf.Empty> |
deleteLockCallable()
Deletes an existing lock specified by the lock ID.
|
Table |
deleteTable(DeleteTableRequest request)
Deletes an existing table specified by the table ID.
|
Table |
deleteTable(String name)
Deletes an existing table specified by the table ID.
|
Table |
deleteTable(TableName name)
Deletes an existing table specified by the table ID.
|
com.google.api.gax.rpc.UnaryCallable<DeleteTableRequest,Table> |
deleteTableCallable()
Deletes an existing table specified by the table ID.
|
Catalog |
getCatalog(CatalogName name)
Gets the catalog specified by the resource name.
|
Catalog |
getCatalog(GetCatalogRequest request)
Gets the catalog specified by the resource name.
|
Catalog |
getCatalog(String name)
Gets the catalog specified by the resource name.
|
com.google.api.gax.rpc.UnaryCallable<GetCatalogRequest,Catalog> |
getCatalogCallable()
Gets the catalog specified by the resource name.
|
Database |
getDatabase(DatabaseName name)
Gets the database specified by the resource name.
|
Database |
getDatabase(GetDatabaseRequest request)
Gets the database specified by the resource name.
|
Database |
getDatabase(String name)
Gets the database specified by the resource name.
|
com.google.api.gax.rpc.UnaryCallable<GetDatabaseRequest,Database> |
getDatabaseCallable()
Gets the database specified by the resource name.
|
MetastoreServiceSettings |
getSettings() |
MetastoreServiceStub |
getStub() |
Table |
getTable(GetTableRequest request)
Gets the table specified by the resource name.
|
Table |
getTable(String name)
Gets the table specified by the resource name.
|
Table |
getTable(TableName name)
Gets the table specified by the resource name.
|
com.google.api.gax.rpc.UnaryCallable<GetTableRequest,Table> |
getTableCallable()
Gets the table specified by the resource name.
|
boolean |
isShutdown() |
boolean |
isTerminated() |
MetastoreServiceClient.ListCatalogsPagedResponse |
listCatalogs(ListCatalogsRequest request)
List all catalogs in a specified project.
|
MetastoreServiceClient.ListCatalogsPagedResponse |
listCatalogs(LocationName parent)
List all catalogs in a specified project.
|
MetastoreServiceClient.ListCatalogsPagedResponse |
listCatalogs(String parent)
List all catalogs in a specified project.
|
com.google.api.gax.rpc.UnaryCallable<ListCatalogsRequest,ListCatalogsResponse> |
listCatalogsCallable()
List all catalogs in a specified project.
|
com.google.api.gax.rpc.UnaryCallable<ListCatalogsRequest,MetastoreServiceClient.ListCatalogsPagedResponse> |
listCatalogsPagedCallable()
List all catalogs in a specified project.
|
MetastoreServiceClient.ListDatabasesPagedResponse |
listDatabases(CatalogName parent)
List all databases in a specified catalog.
|
MetastoreServiceClient.ListDatabasesPagedResponse |
listDatabases(ListDatabasesRequest request)
List all databases in a specified catalog.
|
MetastoreServiceClient.ListDatabasesPagedResponse |
listDatabases(String parent)
List all databases in a specified catalog.
|
com.google.api.gax.rpc.UnaryCallable<ListDatabasesRequest,ListDatabasesResponse> |
listDatabasesCallable()
List all databases in a specified catalog.
|
com.google.api.gax.rpc.UnaryCallable<ListDatabasesRequest,MetastoreServiceClient.ListDatabasesPagedResponse> |
listDatabasesPagedCallable()
List all databases in a specified catalog.
|
MetastoreServiceClient.ListLocksPagedResponse |
listLocks(DatabaseName parent)
List all locks in a specified database.
|
MetastoreServiceClient.ListLocksPagedResponse |
listLocks(ListLocksRequest request)
List all locks in a specified database.
|
MetastoreServiceClient.ListLocksPagedResponse |
listLocks(String parent)
List all locks in a specified database.
|
com.google.api.gax.rpc.UnaryCallable<ListLocksRequest,ListLocksResponse> |
listLocksCallable()
List all locks in a specified database.
|
com.google.api.gax.rpc.UnaryCallable<ListLocksRequest,MetastoreServiceClient.ListLocksPagedResponse> |
listLocksPagedCallable()
List all locks in a specified database.
|
MetastoreServiceClient.ListTablesPagedResponse |
listTables(DatabaseName parent)
List all tables in a specified database.
|
MetastoreServiceClient.ListTablesPagedResponse |
listTables(ListTablesRequest request)
List all tables in a specified database.
|
MetastoreServiceClient.ListTablesPagedResponse |
listTables(String parent)
List all tables in a specified database.
|
com.google.api.gax.rpc.UnaryCallable<ListTablesRequest,ListTablesResponse> |
listTablesCallable()
List all tables in a specified database.
|
com.google.api.gax.rpc.UnaryCallable<ListTablesRequest,MetastoreServiceClient.ListTablesPagedResponse> |
listTablesPagedCallable()
List all tables in a specified database.
|
void |
shutdown() |
void |
shutdownNow() |
Database |
updateDatabase(Database database,
com.google.protobuf.FieldMask updateMask)
Updates an existing database specified by the database ID.
|
Database |
updateDatabase(UpdateDatabaseRequest request)
Updates an existing database specified by the database ID.
|
com.google.api.gax.rpc.UnaryCallable<UpdateDatabaseRequest,Database> |
updateDatabaseCallable()
Updates an existing database specified by the database ID.
|
Table |
updateTable(Table table,
com.google.protobuf.FieldMask updateMask)
Updates an existing table specified by the table ID.
|
Table |
updateTable(UpdateTableRequest request)
Updates an existing table specified by the table ID.
|
com.google.api.gax.rpc.UnaryCallable<UpdateTableRequest,Table> |
updateTableCallable()
Updates an existing table specified by the table ID.
|
protected MetastoreServiceClient(MetastoreServiceSettings settings) throws IOException
IOExceptionprotected MetastoreServiceClient(MetastoreServiceStub stub)
public static final MetastoreServiceClient create() throws IOException
IOExceptionpublic static final MetastoreServiceClient create(MetastoreServiceSettings settings) throws IOException
IOExceptionpublic static final MetastoreServiceClient create(MetastoreServiceStub stub)
public final MetastoreServiceSettings getSettings()
public MetastoreServiceStub getStub()
public final Catalog createCatalog(LocationName parent, Catalog catalog, String catalogId)
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);
}
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.com.google.api.gax.rpc.ApiException - if the remote call failspublic final Catalog createCatalog(String parent, Catalog catalog, String catalogId)
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);
}
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.com.google.api.gax.rpc.ApiException - if the remote call failspublic final Catalog createCatalog(CreateCatalogRequest request)
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);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<CreateCatalogRequest,Catalog> createCatalogCallable()
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();
}
public final Catalog deleteCatalog(CatalogName 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.deleteCatalog(name);
}
name - Required. The name of the catalog to delete. Format:
projects/{project_id_or_number}/locations/{location_id}/catalogs/{catalog_id}com.google.api.gax.rpc.ApiException - if the remote call failspublic final Catalog deleteCatalog(String 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.deleteCatalog(name);
}
name - Required. The name of the catalog to delete. Format:
projects/{project_id_or_number}/locations/{location_id}/catalogs/{catalog_id}com.google.api.gax.rpc.ApiException - if the remote call failspublic final Catalog deleteCatalog(DeleteCatalogRequest request)
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);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<DeleteCatalogRequest,Catalog> deleteCatalogCallable()
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();
}
public final Catalog getCatalog(CatalogName 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);
}
name - Required. The name of the catalog to retrieve. Format:
projects/{project_id_or_number}/locations/{location_id}/catalogs/{catalog_id}com.google.api.gax.rpc.ApiException - if the remote call failspublic final Catalog getCatalog(String 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);
}
name - Required. The name of the catalog to retrieve. Format:
projects/{project_id_or_number}/locations/{location_id}/catalogs/{catalog_id}com.google.api.gax.rpc.ApiException - if the remote call failspublic final Catalog getCatalog(GetCatalogRequest request)
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);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<GetCatalogRequest,Catalog> getCatalogCallable()
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();
}
public final MetastoreServiceClient.ListCatalogsPagedResponse listCatalogs(LocationName parent)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (MetastoreServiceClient metastoreServiceClient = MetastoreServiceClient.create()) {
LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
for (Catalog element : metastoreServiceClient.listCatalogs(parent).iterateAll()) {
// doThingsWith(element);
}
}
parent - Required. The parent, which owns this collection of catalogs. Format:
projects/{project_id_or_number}/locations/{location_id}com.google.api.gax.rpc.ApiException - if the remote call failspublic final MetastoreServiceClient.ListCatalogsPagedResponse listCatalogs(String parent)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (MetastoreServiceClient metastoreServiceClient = MetastoreServiceClient.create()) {
String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
for (Catalog element : metastoreServiceClient.listCatalogs(parent).iterateAll()) {
// doThingsWith(element);
}
}
parent - Required. The parent, which owns this collection of catalogs. Format:
projects/{project_id_or_number}/locations/{location_id}com.google.api.gax.rpc.ApiException - if the remote call failspublic final MetastoreServiceClient.ListCatalogsPagedResponse listCatalogs(ListCatalogsRequest request)
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);
}
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<ListCatalogsRequest,MetastoreServiceClient.ListCatalogsPagedResponse> listCatalogsPagedCallable()
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);
}
}
public final com.google.api.gax.rpc.UnaryCallable<ListCatalogsRequest,ListCatalogsResponse> listCatalogsCallable()
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;
}
}
}
public final Database createDatabase(CatalogName parent, Database database, String databaseId)
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);
}
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.com.google.api.gax.rpc.ApiException - if the remote call failspublic final Database createDatabase(String parent, Database database, String databaseId)
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);
}
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.com.google.api.gax.rpc.ApiException - if the remote call failspublic final Database createDatabase(CreateDatabaseRequest request)
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);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<CreateDatabaseRequest,Database> createDatabaseCallable()
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();
}
public final Database deleteDatabase(DatabaseName 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.deleteDatabase(name);
}
name - Required. The name of the database to delete. Format:
projects/{project_id_or_number}/locations/{location_id}/catalogs/{catalog_id}/databases/{database_id}com.google.api.gax.rpc.ApiException - if the remote call failspublic final Database deleteDatabase(String 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.deleteDatabase(name);
}
name - Required. The name of the database to delete. Format:
projects/{project_id_or_number}/locations/{location_id}/catalogs/{catalog_id}/databases/{database_id}com.google.api.gax.rpc.ApiException - if the remote call failspublic final Database deleteDatabase(DeleteDatabaseRequest request)
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);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<DeleteDatabaseRequest,Database> deleteDatabaseCallable()
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();
}
public final Database updateDatabase(Database database, com.google.protobuf.FieldMask updateMask)
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);
}
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.
com.google.api.gax.rpc.ApiException - if the remote call failspublic final Database updateDatabase(UpdateDatabaseRequest request)
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);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<UpdateDatabaseRequest,Database> updateDatabaseCallable()
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();
}
public final Database getDatabase(DatabaseName 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);
}
name - Required. The name of the database to retrieve. Format:
projects/{project_id_or_number}/locations/{location_id}/catalogs/{catalog_id}/databases/{database_id}com.google.api.gax.rpc.ApiException - if the remote call failspublic final Database getDatabase(String 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);
}
name - Required. The name of the database to retrieve. Format:
projects/{project_id_or_number}/locations/{location_id}/catalogs/{catalog_id}/databases/{database_id}com.google.api.gax.rpc.ApiException - if the remote call failspublic final Database getDatabase(GetDatabaseRequest request)
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);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<GetDatabaseRequest,Database> getDatabaseCallable()
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();
}
public final MetastoreServiceClient.ListDatabasesPagedResponse listDatabases(CatalogName parent)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (MetastoreServiceClient metastoreServiceClient = MetastoreServiceClient.create()) {
CatalogName parent = CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]");
for (Database element : metastoreServiceClient.listDatabases(parent).iterateAll()) {
// doThingsWith(element);
}
}
parent - Required. The parent, which owns this collection of databases. Format:
projects/{project_id_or_number}/locations/{location_id}/catalogs/{catalog_id}com.google.api.gax.rpc.ApiException - if the remote call failspublic final MetastoreServiceClient.ListDatabasesPagedResponse listDatabases(String parent)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (MetastoreServiceClient metastoreServiceClient = MetastoreServiceClient.create()) {
String parent = CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString();
for (Database element : metastoreServiceClient.listDatabases(parent).iterateAll()) {
// doThingsWith(element);
}
}
parent - Required. The parent, which owns this collection of databases. Format:
projects/{project_id_or_number}/locations/{location_id}/catalogs/{catalog_id}com.google.api.gax.rpc.ApiException - if the remote call failspublic final MetastoreServiceClient.ListDatabasesPagedResponse listDatabases(ListDatabasesRequest request)
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);
}
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<ListDatabasesRequest,MetastoreServiceClient.ListDatabasesPagedResponse> listDatabasesPagedCallable()
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);
}
}
public final com.google.api.gax.rpc.UnaryCallable<ListDatabasesRequest,ListDatabasesResponse> listDatabasesCallable()
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;
}
}
}
public final Table createTable(DatabaseName parent, Table table, String tableId)
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);
}
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.com.google.api.gax.rpc.ApiException - if the remote call failspublic final Table createTable(String parent, Table table, String tableId)
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);
}
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.com.google.api.gax.rpc.ApiException - if the remote call failspublic final Table createTable(CreateTableRequest request)
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);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<CreateTableRequest,Table> createTableCallable()
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();
}
public final Table deleteTable(TableName 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.deleteTable(name);
}
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}com.google.api.gax.rpc.ApiException - if the remote call failspublic final Table deleteTable(String 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.deleteTable(name);
}
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}com.google.api.gax.rpc.ApiException - if the remote call failspublic final Table deleteTable(DeleteTableRequest request)
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);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<DeleteTableRequest,Table> deleteTableCallable()
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();
}
public final Table updateTable(Table table, com.google.protobuf.FieldMask updateMask)
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);
}
table - Required. The table to update.
The table'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}/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.
com.google.api.gax.rpc.ApiException - if the remote call failspublic final Table updateTable(UpdateTableRequest request)
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);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<UpdateTableRequest,Table> updateTableCallable()
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();
}
public final Table getTable(TableName 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);
}
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}com.google.api.gax.rpc.ApiException - if the remote call failspublic final Table getTable(String 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);
}
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}com.google.api.gax.rpc.ApiException - if the remote call failspublic final Table getTable(GetTableRequest request)
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);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<GetTableRequest,Table> getTableCallable()
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();
}
public final MetastoreServiceClient.ListTablesPagedResponse listTables(DatabaseName parent)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (MetastoreServiceClient metastoreServiceClient = MetastoreServiceClient.create()) {
DatabaseName parent = DatabaseName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[DATABASE]");
for (Table element : metastoreServiceClient.listTables(parent).iterateAll()) {
// doThingsWith(element);
}
}
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}com.google.api.gax.rpc.ApiException - if the remote call failspublic final MetastoreServiceClient.ListTablesPagedResponse listTables(String parent)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (MetastoreServiceClient metastoreServiceClient = MetastoreServiceClient.create()) {
String parent =
DatabaseName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[DATABASE]").toString();
for (Table element : metastoreServiceClient.listTables(parent).iterateAll()) {
// doThingsWith(element);
}
}
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}com.google.api.gax.rpc.ApiException - if the remote call failspublic final MetastoreServiceClient.ListTablesPagedResponse listTables(ListTablesRequest request)
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")
.build();
for (Table element : metastoreServiceClient.listTables(request).iterateAll()) {
// doThingsWith(element);
}
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<ListTablesRequest,MetastoreServiceClient.ListTablesPagedResponse> listTablesPagedCallable()
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")
.build();
ApiFuture<Table> future =
metastoreServiceClient.listTablesPagedCallable().futureCall(request);
// Do something.
for (Table element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final com.google.api.gax.rpc.UnaryCallable<ListTablesRequest,ListTablesResponse> listTablesCallable()
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")
.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;
}
}
}
public final Lock createLock(DatabaseName parent, Lock lock)
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]");
Lock lock = Lock.newBuilder().build();
Lock response = metastoreServiceClient.createLock(parent, lock);
}
parent - Required. The parent resource where this lock will be created. Format:
projects/{project_id_or_number}/locations/{location_id}/catalogs/{catalog_id}/databases/{database_id}lock - Required. The lock to create. The `name` field does not need to be provided for the
lock creation.com.google.api.gax.rpc.ApiException - if the remote call failspublic final Lock createLock(String parent, Lock lock)
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();
Lock lock = Lock.newBuilder().build();
Lock response = metastoreServiceClient.createLock(parent, lock);
}
parent - Required. The parent resource where this lock will be created. Format:
projects/{project_id_or_number}/locations/{location_id}/catalogs/{catalog_id}/databases/{database_id}lock - Required. The lock to create. The `name` field does not need to be provided for the
lock creation.com.google.api.gax.rpc.ApiException - if the remote call failspublic final Lock createLock(CreateLockRequest request)
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()) {
CreateLockRequest request =
CreateLockRequest.newBuilder()
.setParent(
DatabaseName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[DATABASE]").toString())
.setLock(Lock.newBuilder().build())
.build();
Lock response = metastoreServiceClient.createLock(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<CreateLockRequest,Lock> createLockCallable()
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()) {
CreateLockRequest request =
CreateLockRequest.newBuilder()
.setParent(
DatabaseName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[DATABASE]").toString())
.setLock(Lock.newBuilder().build())
.build();
ApiFuture<Lock> future = metastoreServiceClient.createLockCallable().futureCall(request);
// Do something.
Lock response = future.get();
}
public final void deleteLock(LockName 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()) {
LockName name = LockName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[DATABASE]", "[LOCK]");
metastoreServiceClient.deleteLock(name);
}
name - Required. The name of the lock to delete. Format:
projects/{project_id_or_number}/locations/{location_id}/catalogs/{catalog_id}/databases/{database_id}/locks/{lock_id}com.google.api.gax.rpc.ApiException - if the remote call failspublic final void deleteLock(String 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 =
LockName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[DATABASE]", "[LOCK]").toString();
metastoreServiceClient.deleteLock(name);
}
name - Required. The name of the lock to delete. Format:
projects/{project_id_or_number}/locations/{location_id}/catalogs/{catalog_id}/databases/{database_id}/locks/{lock_id}com.google.api.gax.rpc.ApiException - if the remote call failspublic final void deleteLock(DeleteLockRequest request)
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()) {
DeleteLockRequest request =
DeleteLockRequest.newBuilder()
.setName(
LockName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[DATABASE]", "[LOCK]")
.toString())
.build();
metastoreServiceClient.deleteLock(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<DeleteLockRequest,com.google.protobuf.Empty> deleteLockCallable()
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()) {
DeleteLockRequest request =
DeleteLockRequest.newBuilder()
.setName(
LockName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[DATABASE]", "[LOCK]")
.toString())
.build();
ApiFuture<Empty> future = metastoreServiceClient.deleteLockCallable().futureCall(request);
// Do something.
future.get();
}
public final Lock checkLock(LockName 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()) {
LockName name = LockName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[DATABASE]", "[LOCK]");
Lock response = metastoreServiceClient.checkLock(name);
}
name - Required. The name of the lock to check. Format:
projects/{project_id_or_number}/locations/{location_id}/catalogs/{catalog_id}/databases/{database_id}/locks/{lock_id}com.google.api.gax.rpc.ApiException - if the remote call failspublic final Lock checkLock(String 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 =
LockName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[DATABASE]", "[LOCK]").toString();
Lock response = metastoreServiceClient.checkLock(name);
}
name - Required. The name of the lock to check. Format:
projects/{project_id_or_number}/locations/{location_id}/catalogs/{catalog_id}/databases/{database_id}/locks/{lock_id}com.google.api.gax.rpc.ApiException - if the remote call failspublic final Lock checkLock(CheckLockRequest request)
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()) {
CheckLockRequest request =
CheckLockRequest.newBuilder()
.setName(
LockName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[DATABASE]", "[LOCK]")
.toString())
.build();
Lock response = metastoreServiceClient.checkLock(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<CheckLockRequest,Lock> checkLockCallable()
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()) {
CheckLockRequest request =
CheckLockRequest.newBuilder()
.setName(
LockName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[DATABASE]", "[LOCK]")
.toString())
.build();
ApiFuture<Lock> future = metastoreServiceClient.checkLockCallable().futureCall(request);
// Do something.
Lock response = future.get();
}
public final MetastoreServiceClient.ListLocksPagedResponse listLocks(DatabaseName parent)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (MetastoreServiceClient metastoreServiceClient = MetastoreServiceClient.create()) {
DatabaseName parent = DatabaseName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[DATABASE]");
for (Lock element : metastoreServiceClient.listLocks(parent).iterateAll()) {
// doThingsWith(element);
}
}
parent - Required. The parent, which owns this collection of locks. Format:
projects/{project_id_or_number}/locations/{location_id}/catalogs/{catalog_id}/databases/{database_id}com.google.api.gax.rpc.ApiException - if the remote call failspublic final MetastoreServiceClient.ListLocksPagedResponse listLocks(String parent)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (MetastoreServiceClient metastoreServiceClient = MetastoreServiceClient.create()) {
String parent =
DatabaseName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[DATABASE]").toString();
for (Lock element : metastoreServiceClient.listLocks(parent).iterateAll()) {
// doThingsWith(element);
}
}
parent - Required. The parent, which owns this collection of locks. Format:
projects/{project_id_or_number}/locations/{location_id}/catalogs/{catalog_id}/databases/{database_id}com.google.api.gax.rpc.ApiException - if the remote call failspublic final MetastoreServiceClient.ListLocksPagedResponse listLocks(ListLocksRequest request)
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()) {
ListLocksRequest request =
ListLocksRequest.newBuilder()
.setParent(
DatabaseName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[DATABASE]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
for (Lock element : metastoreServiceClient.listLocks(request).iterateAll()) {
// doThingsWith(element);
}
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<ListLocksRequest,MetastoreServiceClient.ListLocksPagedResponse> listLocksPagedCallable()
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()) {
ListLocksRequest request =
ListLocksRequest.newBuilder()
.setParent(
DatabaseName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[DATABASE]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
ApiFuture<Lock> future = metastoreServiceClient.listLocksPagedCallable().futureCall(request);
// Do something.
for (Lock element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final com.google.api.gax.rpc.UnaryCallable<ListLocksRequest,ListLocksResponse> listLocksCallable()
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()) {
ListLocksRequest request =
ListLocksRequest.newBuilder()
.setParent(
DatabaseName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[DATABASE]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
while (true) {
ListLocksResponse response = metastoreServiceClient.listLocksCallable().call(request);
for (Lock element : response.getLocksList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
public final void close()
close in interface AutoCloseablepublic void shutdown()
shutdown in interface com.google.api.gax.core.BackgroundResourcepublic boolean isShutdown()
isShutdown in interface com.google.api.gax.core.BackgroundResourcepublic boolean isTerminated()
isTerminated in interface com.google.api.gax.core.BackgroundResourcepublic void shutdownNow()
shutdownNow in interface com.google.api.gax.core.BackgroundResourcepublic boolean awaitTermination(long duration,
TimeUnit unit)
throws InterruptedException
awaitTermination in interface com.google.api.gax.core.BackgroundResourceInterruptedExceptionCopyright © 2023 Google LLC. All rights reserved.