use of com.google.api.services.dataplex.v1.model.GoogleCloudDataplexV1Zone in project DataflowTemplates by GoogleCloudPlatform.
the class DefaultDataplexClient method shouldSkipCreatingMetadata.
/**
* Determines if we should skip creating metadata under {@code assetName}.
*
* <p>Currently, we skip creating metadata if discovery is enabled on either the zone or asset.
* Trying to create metadata manually when this is enabled can lead to undefined behavior.
*
* @param assetName name of the asset to check
* @return true if we should skip metadata creation, false otherwise
*/
private boolean shouldSkipCreatingMetadata(String assetName) throws IOException {
GoogleCloudDataplexV1Asset asset = getAsset(assetName);
if (asset.getDiscoverySpec().getEnabled()) {
LOG.warn("Automatic discovery enabled for asset `{}`.", assetName);
return true;
}
String zoneName = getZoneFromAsset(assetName);
GoogleCloudDataplexV1Zone zone = getZone(zoneName);
if (zone.getDiscoverySpec().getEnabled()) {
LOG.warn("Automatic discovery enabled for zone `{}`", zoneName);
return true;
}
return false;
}
Aggregations