-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #655 from atlanhq/DVX-385
Adds secure credential-based object store support for S3, GCS, ADLS
- Loading branch information
Showing
25 changed files
with
958 additions
and
587 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
165 changes: 165 additions & 0 deletions
165
package-toolkit/config/src/main/resources/Credential.pkl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,165 @@ | ||
/* SPDX-License-Identifier: Apache-2.0 | ||
Copyright 2024 Atlan Pte. Ltd. */ | ||
|
||
/// Template for defining configuration for a custom connector credential in Atlan. | ||
/// Details provided through such credential configs are securely stored in an encrypted vault. | ||
/// | ||
/// | Variable | | Usage | Default | | ||
/// |---|---|---|---| | ||
/// | **name** | | Name of this connector-specific credential configuration. | | ||
/// | **source** | | Connector for which this credential configuration is applicable. | | ||
/// | **icon** | | Icon to use for the credential configuration. | | ||
/// | **helpdesk** | | Link to documentation for the credential configuration. | | ||
/// | **logo** | | Logo to use for the credential configuration. | | ||
/// | **[inputs][UIElement]** | | Mapping of common properties that exist across connection options, keyed by a unique variable name in lower_snake_case. | | ||
/// | **[rules][UIRule]** | | Listing of rules to control which [inputs][UIElement] appear based on values selected in other inputs. | | ||
@ModuleInfo { minPklVersion = "0.25.1" } | ||
open module com.atlan.pkg.Credential | ||
|
||
import "Config.pkl" | ||
import "Renderers.pkl" | ||
|
||
/// Name of this connector-specific credential configuration. | ||
hidden name: String | ||
|
||
/// Name of a connector for which this credential configuration is applicable. | ||
hidden source: String | ||
|
||
/// Icon to use for the credential configuration. | ||
hidden icon: String | ||
|
||
/// Link to documentation for the credential configuration. | ||
hidden helpdesk: String | ||
|
||
/// Logo to use for the credential configuration. | ||
hidden logo: String | ||
|
||
/// Default connector type to use for the credential configuration. | ||
hidden connectorType: String = "rest" | ||
|
||
/// TBC | ||
hidden jdbcCredential: String = "{}" | ||
|
||
/// TBC | ||
hidden restCredential: String = "{}" | ||
|
||
/// TBC | ||
hidden odbcCredential: String = "{}" | ||
|
||
/// TBC | ||
hidden grpcCredential: String = "{}" | ||
|
||
/// TBC | ||
hidden restMetadata: String = "" | ||
|
||
/// TBC | ||
hidden restTransformer: String = "" | ||
|
||
/// TBC | ||
hidden sage: String? | ||
|
||
/// TBC | ||
hidden soda: String? | ||
|
||
/// Mapping of fixed [inputs][UIElement] that are common across all or many of the different connectivity options. | ||
/// Typically this is used to capture hidden properties once that can then be shared across different connectivity | ||
/// options. | ||
/// | ||
/// Remember in Pkl to define a mapping, put the key in square brackets and the value in curly braces: | ||
/// ``` | ||
/// commonInputs { | ||
/// ["host"] = new TextInput { | ||
/// ... | ||
/// } | ||
/// ["port"] = new TextInput { | ||
/// ... | ||
/// } | ||
/// ... | ||
/// } | ||
/// ``` | ||
hidden commonInputs: Mapping<CredentialAttribute, Config.UIElement>? | ||
|
||
/// Label to use above the radio button of options | ||
hidden optionsTitle: String = "Authentication" | ||
|
||
/// Options for configuring the connector. | ||
hidden options: Mapping<String, NestedCredentialInput> | ||
|
||
/// (Generated) Details of all properties. | ||
fixed properties: Map<String, Config.UIElement> = new Mapping<String, Config.UIElement> { | ||
when (commonInputs != null) { ...commonInputs } | ||
["auth-type"] = new Config.Radio { | ||
title = optionsTitle | ||
possibleValues = new Mapping { | ||
for (k, v in options) { | ||
[k] = v.title | ||
} | ||
} | ||
default = options.keys.first | ||
required = true | ||
} | ||
...options | ||
}.toMap() | ||
|
||
/// Listing of rules to control which [inputs][UIElement] appear based on values selected in other inputs. | ||
/// | ||
/// Remember in Pkl to define a listing, use curly braces and create new elements within: | ||
/// ``` | ||
/// rules { | ||
/// new UIRule { | ||
/// whenInputs { ["option1"] = "setting_a" } | ||
/// required = { "field_name_z" } | ||
/// } | ||
/// new UIRule { | ||
/// ... | ||
/// } | ||
/// ... | ||
/// } | ||
/// ``` | ||
hidden rules: Listing<Config.UIRule> = new Listing {} | ||
|
||
/// (Generated) Details of all UI rules to use to control the UI. | ||
fixed anyOf: List<Config.UIRule>? = | ||
new Listing { | ||
for (k, _ in options) { | ||
new Config.UIRule { | ||
whenInputs { ["auth-type"] = k } | ||
required { k } | ||
} | ||
} | ||
...rules | ||
}.toList() | ||
|
||
/// Valid attributes to map to in the credential. | ||
/// Note: You can ONLY use these attributes to map credential information. If you require | ||
/// any additional attributes, they should be a NestedInput inside the ["extra"]. | ||
typealias CredentialAttribute = "host"|"port"|"connection"|"username"|"password"|"extra"|"name"|"connector"|"connectorType" | ||
|
||
/// Set up multiple outputs for the module, one for each configuration file. | ||
/// - `m` the package config to generate outputs for | ||
const function getOutputs(m): Mapping<String, FileOutput> = new Mapping { | ||
["connectors/configmaps/\(m.name).yaml"] = Renderers.getCredentialConfigMap(m) | ||
} | ||
|
||
/// Translate the credential config content into a file for both type definitions (JSON) | ||
/// and UI configuration (TypeScript). | ||
const function getModuleOutput(m): ModuleOutput = new ModuleOutput { | ||
files = getOutputs(m) | ||
} | ||
|
||
/// Set the output of the module to be a dedicated file for the credential config defined herein. | ||
output = getModuleOutput(this) | ||
|
||
/// Widget that allows you to configure multiple sub-elements all grouped together under a single parent | ||
/// variable. | ||
/// | ||
/// | Field | | Description | Default | | ||
/// |---|---|---|---| | ||
/// | **`title`** | | name to show in the UI for the widget | | | ||
/// | **`inputs`** | | map of the sub-elements that should be nested within this input | | | ||
/// | `helpText` | | informational text to place in a hover-over to describe the use of the input | `""` | | ||
/// | `width` | | sizing of the input on the UI (8 is full-width, 4 is half-width) | `8` | | ||
class NestedCredentialInput extends Config.NestedInput { | ||
/// Map of the sub-elements that should be nested within this input, keyed by unique lower_snake_case variable name. | ||
hidden inputs: Mapping<CredentialAttribute, Config.UIElement> | ||
} |
Oops, something went wrong.