Search in sources :

Example 1 with GoogleCloudDataplexV1Zone

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;
}
Also used : GoogleCloudDataplexV1Asset(com.google.api.services.dataplex.v1.model.GoogleCloudDataplexV1Asset) GoogleCloudDataplexV1Zone(com.google.api.services.dataplex.v1.model.GoogleCloudDataplexV1Zone)

Aggregations

GoogleCloudDataplexV1Asset (com.google.api.services.dataplex.v1.model.GoogleCloudDataplexV1Asset)1 GoogleCloudDataplexV1Zone (com.google.api.services.dataplex.v1.model.GoogleCloudDataplexV1Zone)1