Search in sources :

Example 1 with LookupEntryRequest

use of com.google.cloud.datacatalog.v1beta1.LookupEntryRequest in project DataflowTemplates by GoogleCloudPlatform.

the class DataCatalogSchemaUtils method lookupPubSubEntry.

static Entry lookupPubSubEntry(DataCatalogClient client, String pubsubTopic, String gcpProject) {
    String linkedResource = String.format(DATA_CATALOG_PUBSUB_URI_TEMPLATE, gcpProject, pubsubTopic);
    LOG.info("Looking up LinkedResource {}", linkedResource);
    LookupEntryRequest request = LookupEntryRequest.newBuilder().setLinkedResource(linkedResource).build();
    try {
        Entry entry = client.lookupEntry(request);
        return entry;
    } catch (ApiException e) {
        System.out.println("CANT LOOKUP ENTRY" + e.toString());
        e.printStackTrace();
        LOG.error("ApiException thrown by Data Catalog API:", e);
        return null;
    }
}
Also used : LookupEntryRequest(com.google.cloud.datacatalog.v1beta1.LookupEntryRequest) Entry(com.google.cloud.datacatalog.v1beta1.Entry) ApiException(com.google.api.gax.rpc.ApiException)

Aggregations

ApiException (com.google.api.gax.rpc.ApiException)1 Entry (com.google.cloud.datacatalog.v1beta1.Entry)1 LookupEntryRequest (com.google.cloud.datacatalog.v1beta1.LookupEntryRequest)1