All Downloads are FREE. Search and download functionalities are using the official Maven repository.

e-assets-builder.2.0.1.source-code.package.pkl Maven / Gradle / Ivy

/* SPDX-License-Identifier: Apache-2.0
   Copyright 2024 Atlan Pte. Ltd. */
amends "modulepath:/Config.pkl"
import "pkl:semver"
import "modulepath:/BuildInfo.pkl"

packageId = "@csa/cube-assets-builder"
packageName = "Cube Assets Builder"
version = semver.Version(BuildInfo.VERSION)
description = "Build (and update) cube assets managed through a CSV file."
iconUrl = "http://assets.atlan.com/assets/ph-cube-light.svg"
docsUrl = "https://solutions.atlan.com/cube-assets-builder/"
implementationLanguage = "Kotlin"
containerImage = "ghcr.io/atlanhq/\(name):\(BuildInfo.VERSION)"
containerImagePullPolicy = if (BuildInfo.VERSION.endsWith("-SNAPSHOT")) "Always" else "IfNotPresent"
containerCommand {
  "/dumb-init"
  "--"
  "java"
  "com.atlan.pkg.cab.Importer"
}
outputs {
  files {
    ["debug-logs"] = "/tmp/debug.log"
  }
}
keywords {
  "kotlin"
  "utility"
}
preview = true

uiConfig {
  tasks {
    ["Source"] {
      description = "Assets to import"
      inputs {
        ["assets_import_type"] = new Radio {
          title = "Import assets from"
          required = true
          helpText = "Select how you want to provide the file containing cube assets to be imported."
          possibleValues {
            ["DIRECT"] = "Direct upload"
            ["CLOUD"] = "Object storage"
          }
          default = "DIRECT"
        }
        ["assets_file"] = new FileUploader {
          title = "Assets file"
          fileTypes { "text/csv" }
          required = false
          helpText = "Select the file containing the cube assets to import."
          placeholderText = "Select assets CSV file"
        }
        ["assets_prefix"] = new TextInput {
          title = "Prefix (path)"
          helpText = "Enter the directory (path) within the object store from which to retrieve the file containing cube assets."
          placeholderText = "path/to/file"
          width = 4
        }
        ["assets_key"] = new TextInput {
          title = "Object key (filename)"
          helpText = "Enter the object key (filename), including its extension, within the object store and prefix."
          placeholderText = "cubes.csv"
          width = 4
        }
        ["cloud_source"] = new CredentialInput {
          title = "Import metadata from"
          required = true
          credType = "csa-connectors-objectstore"
          helpText = "Enter details for the object store from which to retrieve the file(s) containing cube assets to be imported."
        }
      }
    }
    ["Semantics"] {
      description = "Processing logic"
      inputs {
        ["assets_upsert_semantic"] = new Radio {
          title = "Input handling"
          required = false
          possibleValues {
            ["upsert"] = "Create and update"
            ["update"] = "Update only"
          }
          default = "upsert"
          helpText = "Whether to allow the creation of new assets from the input CSV, or ensure assets are only updated if they already exist in Atlan."
        }
        ["delta_semantic"] = new Radio {
          title = "Delta handling"
          required = false
          possibleValues {
            ["full"] = "Full replacement"
            ["delta"] = "Incremental"
          }
          default = "full"
          helpText = "Whether to treat the input file as an initial load, full replacement (deleting any existing assets not in the file) or only incremental (no deletion of existing assets)."
        }
        ["delta_removal_type"] = new Radio {
          title = "Removal type"
          required = false
          possibleValues {
            ["archive"] = "Archive (recoverable)"
            ["purge"] = "Purge (cannot be recovered)"
          }
          default = "archive"
          helpText = "How to delete any assets not found in the latest file."
        }
        ["previous_file_direct"] = new TextInput {
          title = "Previous file"
          required = false
          hide = true
          helpText = "Path to a direct file (locally) to use for delta processing."
        }
        ["skip_object_store"] = new BooleanInput {
          title = "Skip object storage"
          required = false
          hide = true
          defaultSelection = false
          helpText = "Whether to skip object storage operations (uploading and downloading files) as part of delta processing."
        }
      }
    }
    ["Options"] {
      description = "Configuration options"
      inputs {
        ["assets_attr_to_overwrite"] = new DropDown {
          title = "Remove attributes, if empty"
          required = false
          possibleValues {
            ["certificateStatus"] = "Certificate"
            ["announcementType"] = "Announcement"
            ["displayName"] = "Display name"
            ["description"] = "Description (system)"
            ["userDescription"] = "Description (user)"
            ["ownerUsers"] = "Owners (users)"
            ["ownerGroups"] = "Owners (groups)"
            ["assignedTerms"] = "Assigned terms"
            ["readme"] = "README"
          }
          helpText = "Select attributes you want to clear (remove) from assets if their value is blank in the provided file."
          multiSelect = true
          width = 8
        }
        ["assets_fail_on_errors"] = new BooleanInput {
          title = "Fail on errors"
          required = false
          helpText = "Whether an invalid value in a field should cause the import to fail (Yes) or log a warning, skip that value, and proceed (No)."
        }
        ["assets_field_separator"] = new TextInput {
          title = "Field separator"
          required = false
          helpText = "Character used to separate fields in the input file (for example, ',' or ';')."
          placeholderText = ","
          width = 4
        }
        ["assets_batch_size"] = new NumericInput {
          title = "Batch size"
          required = false
          helpText = "Maximum number of rows to process at a time (per API request)."
          placeholderValue = 20
          width = 4
        }
        ["track_batches"] = new BooleanInput {
          title = "Track asset details"
          required = false
          hide = true
          defaultSelection = true
          helpText = "Whether to track details about every asset across batches (Yes) or only counts (No)."
        }
      }
    }
  }
  rules {
    new UIRule {
      whenInputs { ["assets_import_type"] = "DIRECT" }
      required { "assets_file" }
    }
    new UIRule {
      whenInputs { ["assets_import_type"] = "CLOUD" }
      required {
        "assets_prefix"
        "assets_key"
        "cloud_source"
      }
    }
    new UIRule {
      whenInputs { ["delta_semantic"] = "full" }
      required { "delta_removal_type" }
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy