@adpt/cloud
Version:
AdaptJS cloud component library
82 lines • 4.6 kB
TypeScript
import Adapt, { ActionInfo, AdaptElementOrNull, FinalDomElement, QueryDomain, WidgetChange, WidgetPlugin } from "@adpt/core";
import AWS from "./aws-sdk";
import { CFResourceProps } from "./CFResource";
import { CFStackPrimitiveProps } from "./CFStack";
import { Tagged } from "./plugin_utils";
export declare enum TemplateFormatVersion {
current = "2010-09-09"
}
export declare type ResourceId = string;
export interface Resources {
[id: string]: CFResourceProps;
}
export interface Template {
AWSTemplateFormatVersion?: TemplateFormatVersion;
Description?: string;
Metadata?: any;
Parameters?: any;
Mappings?: any;
Conditions?: any;
Transform?: any;
Resources: Resources;
Outputs?: any;
}
interface AwsRegion {
region: string;
accessKeyId: string;
}
interface AwsSecret {
awsSecretAccessKey: string;
}
declare type StackObs = AWS.CloudFormation.Stack;
export declare function getAdaptDeployId(stack: StackObs): string | undefined;
export declare function getAdaptStackId(stack: StackObs): string | undefined;
export declare function getAdaptResourceId(item: Tagged): string | undefined;
export declare function isStatusActive(status: AWS.CloudFormation.StackStatus): boolean;
export declare function isStackActive(stack: StackObs): boolean;
export declare function createTemplate(stackEl: StackElement): Template;
export declare function findStackElems(dom: AdaptElementOrNull): StackElement[];
export declare function stacksWithDeployID(stacks: StackObs[] | undefined, deployID: string): StackObs[];
/**
* Given a CFStackPrimitiveElement, creates a representation of the stack
* that can be given to the client to create the stack.
*/
export declare function createStackParams(el: StackElement, deployID: string): {
StackName: string;
TemplateBody?: string | undefined;
TemplateURL?: string | undefined;
Parameters: never[] | AWS.CloudFormation.Parameter[];
DisableRollback?: boolean | undefined;
RollbackConfiguration: AWS.CloudFormation.RollbackConfiguration | {};
TimeoutInMinutes?: number | undefined;
NotificationARNs: string[] | never[];
Capabilities: string[] | never[];
ResourceTypes?: string[] | undefined;
RoleARN?: string | undefined;
OnFailure?: string | undefined;
StackPolicyBody?: string | undefined;
StackPolicyURL?: string | undefined;
Tags: never[] | AWS.CloudFormation.Tag[];
ClientRequestToken?: string | undefined;
EnableTerminationProtection?: boolean | undefined;
};
export declare function computeStackChanges(change: WidgetChange<StackElement>, actual: StackObs | undefined, deployID: string): ActionInfo;
declare type AwsQueryDomain = QueryDomain<AwsRegion, AwsSecret>;
declare type StackElement = FinalDomElement<CFStackPrimitiveProps>;
export declare class AwsPluginImpl extends WidgetPlugin<StackElement, StackObs, AwsQueryDomain> {
findElems: (dom: Adapt.AdaptElementOrNull) => Adapt.AdaptMountedPrimitiveElement<CFStackPrimitiveProps>[];
getElemQueryDomain: (el: Adapt.AdaptMountedPrimitiveElement<CFStackPrimitiveProps>) => Adapt.QueryDomain<AwsRegion, AwsSecret>;
getWidgetTypeFromObs: (_obs: AWS.CloudFormation.Stack) => string;
getWidgetIdFromObs: (obs: AWS.CloudFormation.Stack) => string;
getWidgetTypeFromElem: (_el: Adapt.AdaptMountedPrimitiveElement<CFStackPrimitiveProps>) => string;
getWidgetIdFromElem: (el: Adapt.AdaptMountedPrimitiveElement<CFStackPrimitiveProps>) => string;
computeChanges: (change: Adapt.WidgetChange<Adapt.AdaptMountedPrimitiveElement<CFStackPrimitiveProps>>, obs: AWS.CloudFormation.Stack | undefined) => Adapt.ActionInfo;
getObservations: (domain: Adapt.QueryDomain<AwsRegion, AwsSecret>, deployID: string) => Promise<AWS.CloudFormation.Stack[]>;
createWidget: (domain: Adapt.QueryDomain<AwsRegion, AwsSecret>, deployID: string, resource: Adapt.WidgetPair<Adapt.AdaptMountedPrimitiveElement<CFStackPrimitiveProps>, AWS.CloudFormation.Stack>) => Promise<void>;
destroyWidget: (domain: Adapt.QueryDomain<AwsRegion, AwsSecret>, _deployID: string, resource: Adapt.WidgetPair<Adapt.AdaptMountedPrimitiveElement<CFStackPrimitiveProps>, AWS.CloudFormation.Stack>) => Promise<void>;
modifyWidget: (domain: Adapt.QueryDomain<AwsRegion, AwsSecret>, deployID: string, resource: Adapt.WidgetPair<Adapt.AdaptMountedPrimitiveElement<CFStackPrimitiveProps>, AWS.CloudFormation.Stack>) => Promise<void>;
getClient(domain: AwsQueryDomain): AWS.CloudFormation;
}
export declare function createAwsPlugin(): AwsPluginImpl;
export {};
//# sourceMappingURL=aws_plugin.d.ts.map