@Generated(value="by gapic-generator") @BetaApi public class DataCatalogClient extends Object implements BackgroundResource
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:
try (DataCatalogClient dataCatalogClient = DataCatalogClient.create()) {
LookupEntryRequest request = LookupEntryRequest.newBuilder().build();
Entry response = dataCatalogClient.lookupEntry(request);
}
Note: close() needs to be called on the dataCatalogClient 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 DataCatalogSettings to create(). For example:
To customize credentials:
DataCatalogSettings dataCatalogSettings =
DataCatalogSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
DataCatalogClient dataCatalogClient =
DataCatalogClient.create(dataCatalogSettings);
To customize the endpoint:
DataCatalogSettings dataCatalogSettings =
DataCatalogSettings.newBuilder().setEndpoint(myEndpoint).build();
DataCatalogClient dataCatalogClient =
DataCatalogClient.create(dataCatalogSettings);
Modifier | Constructor and Description |
---|---|
protected |
DataCatalogClient(DataCatalogSettings settings)
Constructs an instance of DataCatalogClient, using the given settings.
|
protected |
DataCatalogClient(DataCatalogStub stub) |
Modifier and Type | Method and Description |
---|---|
boolean |
awaitTermination(long duration,
TimeUnit unit) |
void |
close() |
static DataCatalogClient |
create()
Constructs an instance of DataCatalogClient with default settings.
|
static DataCatalogClient |
create(DataCatalogSettings settings)
Constructs an instance of DataCatalogClient, using the given settings.
|
static DataCatalogClient |
create(DataCatalogStub stub)
Constructs an instance of DataCatalogClient, using the given stub for making calls.
|
static String |
formatEntryName(String project,
String location,
String entryGroup,
String entry)
Deprecated.
Use the
EntryName class instead. |
static String |
formatLocationName(String project,
String location)
Deprecated.
Use the
LocationName class instead. |
DataCatalogSettings |
getSettings() |
DataCatalogStub |
getStub() |
boolean |
isShutdown() |
boolean |
isTerminated() |
com.google.cloud.datacatalog.Entry |
lookupEntry(com.google.cloud.datacatalog.LookupEntryRequest request)
Get an entry by target resource name.
|
UnaryCallable<com.google.cloud.datacatalog.LookupEntryRequest,com.google.cloud.datacatalog.Entry> |
lookupEntryCallable()
Get an entry by target resource name.
|
static String |
parseEntryFromEntryName(String entryName)
Deprecated.
Use the
EntryName class instead. |
static String |
parseEntryGroupFromEntryName(String entryName)
Deprecated.
Use the
EntryName class instead. |
static String |
parseLocationFromEntryName(String entryName)
Deprecated.
Use the
EntryName class instead. |
static String |
parseLocationFromLocationName(String locationName)
Deprecated.
Use the
LocationName class instead. |
static String |
parseProjectFromEntryName(String entryName)
Deprecated.
Use the
EntryName class instead. |
static String |
parseProjectFromLocationName(String locationName)
Deprecated.
Use the
LocationName class instead. |
void |
shutdown() |
void |
shutdownNow() |
protected DataCatalogClient(DataCatalogSettings settings) throws IOException
IOException
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") protected DataCatalogClient(DataCatalogStub stub)
@Deprecated public static final String formatEntryName(String project, String location, String entryGroup, String entry)
EntryName
class instead.@Deprecated public static final String formatLocationName(String project, String location)
LocationName
class instead.@Deprecated public static final String parseProjectFromEntryName(String entryName)
EntryName
class instead.@Deprecated public static final String parseLocationFromEntryName(String entryName)
EntryName
class instead.@Deprecated public static final String parseEntryGroupFromEntryName(String entryName)
EntryName
class instead.@Deprecated public static final String parseEntryFromEntryName(String entryName)
EntryName
class instead.@Deprecated public static final String parseProjectFromLocationName(String locationName)
LocationName
class instead.@Deprecated public static final String parseLocationFromLocationName(String locationName)
LocationName
class instead.public static final DataCatalogClient create() throws IOException
IOException
public static final DataCatalogClient create(DataCatalogSettings settings) throws IOException
IOException
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") public static final DataCatalogClient create(DataCatalogStub stub)
public final DataCatalogSettings getSettings()
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") public DataCatalogStub getStub()
public final com.google.cloud.datacatalog.Entry lookupEntry(com.google.cloud.datacatalog.LookupEntryRequest request)
Sample code:
try (DataCatalogClient dataCatalogClient = DataCatalogClient.create()) {
LookupEntryRequest request = LookupEntryRequest.newBuilder().build();
Entry response = dataCatalogClient.lookupEntry(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<com.google.cloud.datacatalog.LookupEntryRequest,com.google.cloud.datacatalog.Entry> lookupEntryCallable()
Sample code:
try (DataCatalogClient dataCatalogClient = DataCatalogClient.create()) {
LookupEntryRequest request = LookupEntryRequest.newBuilder().build();
ApiFuture<Entry> future = dataCatalogClient.lookupEntryCallable().futureCall(request);
// Do something
Entry response = future.get();
}
public final void close()
close
in interface AutoCloseable
public void shutdown()
shutdown
in interface BackgroundResource
public boolean isShutdown()
isShutdown
in interface BackgroundResource
public boolean isTerminated()
isTerminated
in interface BackgroundResource
public void shutdownNow()
shutdownNow
in interface BackgroundResource
public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException
awaitTermination
in interface BackgroundResource
InterruptedException
Copyright © 2019 Google LLC. All rights reserved.