UNPKG

@altostra/core

Version:

Core library for shared types and logic

32 lines (31 loc) 1.43 kB
import type { Arn } from "../../../aws/Arn"; import type { Maybe } from "../../../common/Maybe"; import type { ExternalResourceType, ExternalType } from "../../Resources/ExternalResource"; import type { ValidArnDbResource } from "../../Resources/ExternalResource/ExternalDataBase"; import { DynamoDbTableIdentifier } from "../../Utils/DynamoDbTableIdentifier"; import type { ResourceHelper } from "../ResourceHelper"; export declare function getExternalResourceUtils(helper: ResourceHelper<ExternalResourceType>): ExternalResourceUtils; export interface ExternalRelationalDatabaseUtils { isValidDatabaseArn(arn: Arn): boolean; /** * returns Tuple [resourceType, dbName] * @param arn */ parseRdbArn(arn: Arn): Maybe<[ValidArnDbResource, string]>; } export declare type ExternalUtilsByType<T extends ExternalType> = ExternalUtilityByType[T]; export interface ExternalUtilityByType { 'external.rdb': ExternalRelationalDatabaseUtils; 'external.dynamo'?: true; 'external.simple'?: true; } export interface ExternalResourceUtils { readonly supportsOutgoingConnections: boolean; readonly supportsIncomingConnections: boolean; readonly tableId: Maybe<DynamoDbTableIdentifier>; utilsByType<T extends keyof ExternalUtilityByType>(key: T): ExternalUtilsByType<T>; /** * Validates that the resource does not have unsupported connections */ validateConnections(): void; }