def create_datascan()

in clouddq-migration/dataplex.py [0:0]


def create_datascan(gcp_project_id, location_id, datascan_id, datascan):
    '''
        Method to create a data scan
    '''
    try:
        # Create a client
        client = dataplex_v1.DataScanServiceClient()
        request = dataplex_v1.CreateDataScanRequest(
            parent=f"projects/{gcp_project_id}/locations/{location_id}",
            data_scan=datascan,
            data_scan_id=datascan_id,
        )
        print(f'Creating Datascan: {datascan_id}')
        # Make the request
        operation = client.create_data_scan(request=request)
        response = operation.result()
        return response
    except Exception as error:
        print(f'Error: Failed to create {datascan_id}. ')
        print(error)
        return None