/// import { SchedulerInterval as IntegrationPollingInterval } from '../scheduler'; import { IntegrationJob } from './jobs'; export { IntegrationPollingInterval }; export * from './actions'; export * from './jobs'; /** * This is used to feature toggle integrations in specific environments and/or * in a specific set of accounts. */ export interface IntegrationDefinitionEnvironment { name: string; value: boolean; accounts?: string[]; } /** * A record representing an integration, used to make the system aware of an * integration that users may install into their account. */ export interface IntegrationDefinition { /** * A unique identifier (uuid) associated with the integration. All * `IntegrationInstance` records must be associated with an * `IntegrationDefinition` by this value. */ id: string; /** * A unique name associated with the integration, used for ... */ name: string; /** * Identifies the integration implementation type, such as `"managed_lambda"`. * See also `integrationType`. */ type: string; /** * A unique title associated with the integration, used in presenting the * integration to users. * * This value is also used in UI code to associate input validation meta data * with the definition! WARNING: Changing this value currently requires * changing that UI code 😳 */ title: string; /** * The ARN of the Lambda function that receives * `IntegrationActionTriggerEvent`s. */ lambdaFunctionArn: string; /** * The type of the integration, transferred to entity data created by the * integration. */ integrationType: string; /** * The class of the integration, transferred to entity data created by the * integration. */ integrationClass: string[]; /** * Url used exclusively in the GitHub integration to initiate oAuth * @deprecated */ offsiteUrl?: string; /** * Title for the button used to initiate an oAuth workflow for the Github integration in the J1 UI * @deprecated */ offsiteButtonTitle?: string; /** * Query for checking the status of oAuth authentication for the Github integration * @deprecated */ offsiteStatusQuery?: string; oAuth?: { /** * The url path that will be used to generate a url that, when followed, will initiate an oAuth flow * NOTE: The existence of this URL indicates to the UI that this integration will need oAuth authentication */ oAuthUrlGeneratorPath?: string; }; /** * The fields specific to this integration that will be included in the * integration instance configuration UI and in the instance's encrypted * config in DynamoDB. */ configFields: ConfigField[]; /** * The fields specific to this integration that will be checked for uniqueness * when a user attempts to create an integration instance. */ uniqueFields?: string[]; /** * When set to "true", this integration will have the beta indicator in the UI. */ beta?: boolean; /** * The link that will be shown in the J1 UI that points to the repository of * the integration. * * e.g. https://github.com/JupiterOne/graph-slack */ repoWebLink?: string; environments?: IntegrationDefinitionEnvironment[]; } export interface ConfigFieldOption { value: string; description?: string; label?: string; webLink?: string; /** * When set to `true` the client should mark this config option as checked */ default?: boolean; } /** * A field that will be included in the integration instance configuration UI * and in the instance's encrypted config in DynamoDB. */ export interface ConfigField { /** * The unique, camel-case identifier for the field. Used as the key in the * config object. */ key: string; displayName: string; description: string; /** * Determines how the raw JSON values stored in the integration instance * configuration are interpreted in the UI. * * `array` is always treated as `string[]`. */ type?: 'string' | 'boolean' | 'number' | 'array' | 'multiSelect'; /** * Determines what validator the UI runs against the value input by the user. */ format?: string; /** * The default value of the field. This will be placed into the config when a * value is not present or provided, so that the integration will receive the * default value. * * `string[]` supports `type: 'array'`. */ defaultValue?: string | number | boolean | string[]; /** * Indicates to the UI that if this value is changed, it should initiate * refetching oAuth credentials as the current credentials are now invalid. */ triggerOAuth?: boolean; /** * Whether or not the field contains user secrets. If it does, the value is * not returned to the UI so that user secrets are never available in the * UI source. */ mask?: boolean; optional?: boolean; /** * A hint that is displayed in miniature below the input field. Keep it short! */ helperText?: string; /** * A prefix appended at the beginning of an input field (E.G. "https://"). Use * with the string type. */ inputAdornment?: string; /** * Whether or not the field is immutable. Only set this to true if there is a * config generator in the UI that will fetch and set the value for the field. * Otherwise, it will never have a value. */ immutable?: boolean; /** * Whether or not the value for this field should be computed from other * fields in an instance creation lifecycle hook. Setting this to true hides * the field on the instance configuration page. */ computed?: boolean; /** * If the "type" of "ConfigField" is "multiSelect", then each value inside * of the "options" array should be displayed in the client. */ options?: ConfigFieldOption[]; } /** * A stored user configuration for executing the integration defined by * associated the `integrationDefinitionId`. */ export interface IntegrationInstance { /** * Unique identifier for the activated integration instance. */ id: string; /** * `accountId` identifies the tenant/account holder that activated the * integration. */ accountId: string; /** * If the integration instance should be triggered at a regular interval then * the `pollingInterval` field should be populated. The `jupiter-scheduler` * will automatically invoke integration jobs according to the * `pollingInterval` associated with each integration instance. */ pollingInterval?: IntegrationPollingInterval; /** * The `integrationDefinitionId` identifies a integration definition. */ integrationDefinitionId: string; /** * A short friendly name for the integration instance that is provided by * end-user. */ name: string; /** * Optional description of the integration instance. */ description?: string; /** * The configuration of the integration instance that has been encrypted using * a data key produced from a KMS key. Includes initialization vector. */ configEncryptedV2?: { algorithm: string; keyCiphertext: Buffer; dataCiphertext: Buffer; iv: Buffer; }; /** * The unencrypted user configuration of the integration instance. * * Each integration specifies the properties it requires a user provide when * configuring an instance of the integration. It is up to the UI to validate * input at configuration time, and the integration should also validate the * configuration upon invocation and provide useful configuration error * messages. * * This property is populated at runtime by decrypting `configEncrypted`. The * clear text value is never stored unencrypted at rest. */ config?: any; /** * A hash of the config field values that the system will require to be unique * to this instance. It is computed by sorting the unique field names in * ascending alphabetical order, concatening their stringified values, and * then SHA1 hashing that concatenated string for a hex output. * * Any field in this list must be non-optional in the config. */ uniqueFieldsHash?: string; /** * Ternary marker for offsite flow state. * * Integrations supporting an offsite installation flow will set this value to * `false` when the instance is created, indicating that the configuration is * incomplete. The value will become `true` when the offsite flow has * completed successfully. * * Integrations that do/will not support an offsite installation flow will * leave this value `undefined`. */ offsiteComplete?: boolean; /** * Jobs run for the integration, provided only in certain GraphQL queries. * * This data is only available on instances returned from the public API * endpoint, used in presenting job status information in the instance * configuration UI. It is not provided to integrations during execution. */ jobs?: { jobs?: [IntegrationJob]; }; } /** * The status of the integration instances for a given definition. */ export declare enum IntegrationInstancesStatus { FAILED = "FAILED", INDETERMINATE = "INDETERMINATE", SUCCEEDED = "SUCCEEDED", IN_PROGRESS = "IN_PROGRESS" }