@adpt/cloud
Version:
AdaptJS cloud component library
1,254 lines (1,238 loc) • 587 kB
TypeScript
/// <reference types="node" />
import { AdaptElementOrNull } from '@adpt/core';
import { FIXME_NeedsProperType } from '@adpt/utils';
import { WithChildren } from '@adpt/core';
export declare namespace action {
/**
* Type guard for {@link action.ShouldActDetail}.
* @public
*/
export declare function isShouldActDetail(val: any): val is ShouldActDetail;/**
* Transforms a {@link action.ShouldAct} into an {@link action.ShouldActDetail}.
* @internal
*/
export declare function toDetail(val: ShouldAct): {
act: boolean;
detail: string;
};/**
* Type guard for Action FinalDomElements.
* @internal
*/
export declare function isActionFinalElement(val: any): val is FinalDomElement;/**
* Returns the component instance for an {@link action.Action} component.
* @internal
*/
export declare function getActionInstance(el: FinalDomElement): Action | null;/**
* Detailed information on why an action should be taken.
* @public
*/
export declare interface ShouldActDetail {
/**
* True if the action should be performed.
*/
act: boolean;
/**
* Explanation of why the action should be performed.
*/
detail: string;
}/**
* Return type for {@link action.Action.shouldAct} that describes whether an
* action should be taken and why.
* @public
*/
export declare type ShouldAct = false | ShouldActDetail;/**
* Helper information for an {@link action.Action} component.
* @public
*/
export declare interface ActionContext {
/** Various pieces of data about the current element and build cycle */
buildData: BuildData;
/** A location to put files that need to be persisted as state */
dataDir: string;
/** Interface to use for logging messages. Prefer to using stderr or stdout */
logger: MessageLogger;
}/**
* Component that can be inherited to perform actions during deploy
*
* @public
*/
export declare class Action<P extends object = {}, S extends object = {}> extends PrimitiveComponent<P, S> {
/**
* Calculates whether or not any action is needed based on state/props/observation
*
* @returns false if no action needed, `{ act: true, detail: <user-facing description of action> }`.
*/
shouldAct(_op: ChangeType, _ctx: ActionContext): ShouldAct | Promise<ShouldAct>;
action(_op: ChangeType, _ctx: ActionContext): void | Promise<void>;
}/**
* Properties for the {@link action.Command | Command} component.
* @public
*/
export declare interface CommandProps {
shouldRun?: string[];
shouldDelete?: string[];
run: string[];
delete?: string[];
}/**
* Primitive component that can be used to interact with commands via the
* OS shell to implement actions in Adapt.
* @public
*/
export declare class Command extends Action<CommandProps> {
shouldAct(op: ChangeType, ctx: ActionContext): Promise<ShouldActDetail>;
action(op: ChangeType, ctx: ActionContext): Promise<void>;
}/**
* Type guard for {@link action.ShouldActDetail}.
* @public
*/
export declare function isShouldActDetail(val: any): val is ShouldActDetail;/**
* Transforms a {@link action.ShouldAct} into an {@link action.ShouldActDetail}.
* @internal
*/
export declare function toDetail(val: ShouldAct): {
act: boolean;
detail: string;
};/**
* Type guard for Action FinalDomElements.
* @internal
*/
export declare function isActionFinalElement(val: any): val is FinalDomElement;/**
* Returns the component instance for an {@link action.Action} component.
* @internal
*/
export declare function getActionInstance(el: FinalDomElement): Action | null;/**
* Detailed information on why an action should be taken.
* @public
*/
export declare interface ShouldActDetail {
/**
* True if the action should be performed.
*/
act: boolean;
/**
* Explanation of why the action should be performed.
*/
detail: string;
}/**
* Return type for {@link action.Action.shouldAct} that describes whether an
* action should be taken and why.
* @public
*/
export declare type ShouldAct = false | ShouldActDetail;/**
* Helper information for an {@link action.Action} component.
* @public
*/
export declare interface ActionContext {
/** Various pieces of data about the current element and build cycle */
buildData: BuildData;
/** A location to put files that need to be persisted as state */
dataDir: string;
/** Interface to use for logging messages. Prefer to using stderr or stdout */
logger: MessageLogger;
}/**
* Component that can be inherited to perform actions during deploy
*
* @public
*/
export declare class Action<P extends object = {}, S extends object = {}> extends PrimitiveComponent<P, S> {
/**
* Calculates whether or not any action is needed based on state/props/observation
*
* @returns false if no action needed, `{ act: true, detail: <user-facing description of action> }`.
*/
shouldAct(_op: ChangeType, _ctx: ActionContext): ShouldAct | Promise<ShouldAct>;
action(_op: ChangeType, _ctx: ActionContext): void | Promise<void>;
}/**
* Properties for the {@link action.Command | Command} component.
* @public
*/
export declare interface CommandProps {
shouldRun?: string[];
shouldDelete?: string[];
run: string[];
delete?: string[];
}/**
* Primitive component that can be used to interact with commands via the
* OS shell to implement actions in Adapt.
* @public
*/
export declare class Command extends Action<CommandProps> {
shouldAct(op: ChangeType, ctx: ActionContext): Promise<ShouldActDetail>;
action(op: ChangeType, ctx: ActionContext): Promise<void>;
}/**
* Type guard for {@link action.ShouldActDetail}.
* @public
*/
export declare function isShouldActDetail(val: any): val is ShouldActDetail;/**
* Transforms a {@link action.ShouldAct} into an {@link action.ShouldActDetail}.
* @internal
*/
export declare function toDetail(val: ShouldAct): {
act: boolean;
detail: string;
};/**
* Type guard for Action FinalDomElements.
* @internal
*/
export declare function isActionFinalElement(val: any): val is FinalDomElement;/**
* Returns the component instance for an {@link action.Action} component.
* @internal
*/
export declare function getActionInstance(el: FinalDomElement): Action | null;/**
* Detailed information on why an action should be taken.
* @public
*/
export declare interface ShouldActDetail {
/**
* True if the action should be performed.
*/
act: boolean;
/**
* Explanation of why the action should be performed.
*/
detail: string;
}/**
* Return type for {@link action.Action.shouldAct} that describes whether an
* action should be taken and why.
* @public
*/
export declare type ShouldAct = false | ShouldActDetail;/**
* Helper information for an {@link action.Action} component.
* @public
*/
export declare interface ActionContext {
/** Various pieces of data about the current element and build cycle */
buildData: BuildData;
/** A location to put files that need to be persisted as state */
dataDir: string;
/** Interface to use for logging messages. Prefer to using stderr or stdout */
logger: MessageLogger;
}/**
* Component that can be inherited to perform actions during deploy
*
* @public
*/
export declare class Action<P extends object = {}, S extends object = {}> extends PrimitiveComponent<P, S> {
/**
* Calculates whether or not any action is needed based on state/props/observation
*
* @returns false if no action needed, `{ act: true, detail: <user-facing description of action> }`.
*/
shouldAct(_op: ChangeType, _ctx: ActionContext): ShouldAct | Promise<ShouldAct>;
action(_op: ChangeType, _ctx: ActionContext): void | Promise<void>;
}/**
* Properties for the {@link action.Command | Command} component.
* @public
*/
export declare interface CommandProps {
shouldRun?: string[];
shouldDelete?: string[];
run: string[];
delete?: string[];
}/**
* Primitive component that can be used to interact with commands via the
* OS shell to implement actions in Adapt.
* @public
*/
export declare class Command extends Action<CommandProps> {
shouldAct(op: ChangeType, ctx: ActionContext): Promise<ShouldActDetail>;
action(op: ChangeType, ctx: ActionContext): Promise<void>;
}
}
export declare namespace aws {
/** @beta */
export declare function isCFResourcePrimitiveElement(val: any): val is FinalDomElement<CFResourceProps>;/** @beta */
export declare function CFResource(props: SFCDeclProps<CFResourceProps>): Adapt.AdaptElement<Adapt.AnyProps>;/** @beta */
export declare interface AnyProperties {
[propName: string]: any;
}/** @beta */
export declare interface CFResourceProps {
Type: string;
Properties: AnyProperties;
cfStackHandle?: Handle;
children?: any;
/**
* Set to true if CloudFormation or the underlying AWS resource does not
* support tagging
*/
tagsUnsupported?: boolean;
}/** @beta */
export declare class CFResourcePrimitive extends PrimitiveComponent<CFResourceProps> {
deployedWhen: DeployedWhenMethod;
}/** @beta */
export declare function awsCredentialsContext(defaultCreds: AwsCredentialsProps): Adapt.Context<AwsCredentialsProps>;/** @beta */
export declare function withCredentials<W extends Constructor<Component<any, any>>>(Wrapped: W, Ctx?: AwsCredentialsContext): (props: Adapt.PropsType<W> & Adapt.WithChildren) => Adapt.AdaptElement<Adapt.AnyProps>;/** @beta */
export declare function loadAwsCreds(options?: AwsCredsOptions): Promise<AwsCredentials>;/** @beta */
export declare interface AwsCredentialsProps {
awsAccessKeyId: string;
awsSecretAccessKey: string;
awsRegion: string;
}/** @beta */
export declare interface WithCredentials {
awsCredentials?: AwsCredentialsProps;
}/** @beta */
export declare type AwsCredentialsContext = Context<AwsCredentialsProps>;/** @beta */
const awsDefaultCredentialsContext: Adapt.Context<AwsCredentialsProps>;/** @beta */
export declare interface AwsCredentials {
awsAccessKeyId: string;
awsSecretAccessKey: string;
awsRegion: string;
}/** @beta */
export declare interface AwsCredsOptions {
credsFile?: string;
}/** @beta */
export declare interface EC2Props extends ComputeProps, WithChildren, WithCredentials {
imageId: string;
instanceType: string;
sshKeyName: string;
securityGroups: string[];
userData?: string;
}/** @beta */
export declare interface EC2InstanceStatus extends Status, AWS.EC2.Instance {
}/** @beta */
const EC2Instance: (props: EC2Props & Adapt.WithChildren) => Adapt.AdaptElement<Adapt.AnyProps>;/** @beta */
export declare interface EIPAssociationProps extends WithCredentials {
AllocationId?: string;
EIP?: string;
InstanceId?: string | Handle;
NetworkInterfaceId?: string;
PrivateIpAddress?: string;
}/** @beta */
const EIPAssociation: (props: EIPAssociationProps & Adapt.WithChildren) => Adapt.AdaptElement<Adapt.AnyProps>;/** @beta */
const EIPAssociation: (props: EIPAssociationProps & Adapt.WithChildren) => Adapt.AdaptElement<Adapt.AnyProps>;/** @beta */
export declare function isCFResourcePrimitiveElement(val: any): val is FinalDomElement<CFResourceProps>;/** @beta */
export declare function CFResource(props: SFCDeclProps<CFResourceProps>): Adapt.AdaptElement<Adapt.AnyProps>;/** @beta */
export declare interface AnyProperties {
[propName: string]: any;
}/** @beta */
export declare interface CFResourceProps {
Type: string;
Properties: AnyProperties;
cfStackHandle?: Handle;
children?: any;
/**
* Set to true if CloudFormation or the underlying AWS resource does not
* support tagging
*/
tagsUnsupported?: boolean;
}/** @beta */
export declare class CFResourcePrimitive extends PrimitiveComponent<CFResourceProps> {
deployedWhen: DeployedWhenMethod;
}/** @beta */
export declare function awsCredentialsContext(defaultCreds: AwsCredentialsProps): Adapt.Context<AwsCredentialsProps>;/** @beta */
export declare function withCredentials<W extends Constructor<Component<any, any>>>(Wrapped: W, Ctx?: AwsCredentialsContext): (props: Adapt.PropsType<W> & Adapt.WithChildren) => Adapt.AdaptElement<Adapt.AnyProps>;/** @beta */
export declare function loadAwsCreds(options?: AwsCredsOptions): Promise<AwsCredentials>;/** @beta */
export declare interface AwsCredentialsProps {
awsAccessKeyId: string;
awsSecretAccessKey: string;
awsRegion: string;
}/** @beta */
export declare interface WithCredentials {
awsCredentials?: AwsCredentialsProps;
}/** @beta */
export declare type AwsCredentialsContext = Context<AwsCredentialsProps>;/** @beta */
const awsDefaultCredentialsContext: Adapt.Context<AwsCredentialsProps>;/** @beta */
export declare interface AwsCredentials {
awsAccessKeyId: string;
awsSecretAccessKey: string;
awsRegion: string;
}/** @beta */
export declare interface AwsCredsOptions {
credsFile?: string;
}/** @beta */
export declare interface EC2Props extends ComputeProps, WithChildren, WithCredentials {
imageId: string;
instanceType: string;
sshKeyName: string;
securityGroups: string[];
userData?: string;
}/** @beta */
export declare interface EC2InstanceStatus extends Status, AWS.EC2.Instance {
}/** @beta */
const EC2Instance: (props: EC2Props & Adapt.WithChildren) => Adapt.AdaptElement<Adapt.AnyProps>;/** @beta */
export declare interface EIPAssociationProps extends WithCredentials {
AllocationId?: string;
EIP?: string;
InstanceId?: string | Handle;
NetworkInterfaceId?: string;
PrivateIpAddress?: string;
}/** @beta */
const EIPAssociation: (props: EIPAssociationProps & Adapt.WithChildren) => Adapt.AdaptElement<Adapt.AnyProps>;/** @beta */
const EIPAssociation: (props: EIPAssociationProps & Adapt.WithChildren) => Adapt.AdaptElement<Adapt.AnyProps>;/** @beta */
export declare function isCFResourcePrimitiveElement(val: any): val is FinalDomElement<CFResourceProps>;/** @beta */
export declare function CFResource(props: SFCDeclProps<CFResourceProps>): Adapt.AdaptElement<Adapt.AnyProps>;/** @beta */
export declare interface AnyProperties {
[propName: string]: any;
}/** @beta */
export declare interface CFResourceProps {
Type: string;
Properties: AnyProperties;
cfStackHandle?: Handle;
children?: any;
/**
* Set to true if CloudFormation or the underlying AWS resource does not
* support tagging
*/
tagsUnsupported?: boolean;
}/** @beta */
export declare class CFResourcePrimitive extends PrimitiveComponent<CFResourceProps> {
deployedWhen: DeployedWhenMethod;
}/** @beta */
export declare function awsCredentialsContext(defaultCreds: AwsCredentialsProps): Adapt.Context<AwsCredentialsProps>;/** @beta */
export declare function withCredentials<W extends Constructor<Component<any, any>>>(Wrapped: W, Ctx?: AwsCredentialsContext): (props: Adapt.PropsType<W> & Adapt.WithChildren) => Adapt.AdaptElement<Adapt.AnyProps>;/** @beta */
export declare function loadAwsCreds(options?: AwsCredsOptions): Promise<AwsCredentials>;/** @beta */
export declare interface AwsCredentialsProps {
awsAccessKeyId: string;
awsSecretAccessKey: string;
awsRegion: string;
}/** @beta */
export declare interface WithCredentials {
awsCredentials?: AwsCredentialsProps;
}/** @beta */
export declare type AwsCredentialsContext = Context<AwsCredentialsProps>;/** @beta */
const awsDefaultCredentialsContext: Adapt.Context<AwsCredentialsProps>;/** @beta */
export declare interface AwsCredentials {
awsAccessKeyId: string;
awsSecretAccessKey: string;
awsRegion: string;
}/** @beta */
export declare interface AwsCredsOptions {
credsFile?: string;
}/** @beta */
export declare interface EC2Props extends ComputeProps, WithChildren, WithCredentials {
imageId: string;
instanceType: string;
sshKeyName: string;
securityGroups: string[];
userData?: string;
}/** @beta */
export declare interface EC2InstanceStatus extends Status, AWS.EC2.Instance {
}/** @beta */
const EC2Instance: (props: EC2Props & Adapt.WithChildren) => Adapt.AdaptElement<Adapt.AnyProps>;/** @beta */
export declare interface EIPAssociationProps extends WithCredentials {
AllocationId?: string;
EIP?: string;
InstanceId?: string | Handle;
NetworkInterfaceId?: string;
PrivateIpAddress?: string;
}/** @beta */
const EIPAssociation: (props: EIPAssociationProps & Adapt.WithChildren) => Adapt.AdaptElement<Adapt.AnyProps>;/** @beta */
const EIPAssociation: (props: EIPAssociationProps & Adapt.WithChildren) => Adapt.AdaptElement<Adapt.AnyProps>;/** @beta */
export declare function isCFResourcePrimitiveElement(val: any): val is FinalDomElement<CFResourceProps>;/** @beta */
export declare function CFResource(props: SFCDeclProps<CFResourceProps>): Adapt.AdaptElement<Adapt.AnyProps>;/** @beta */
export declare interface AnyProperties {
[propName: string]: any;
}/** @beta */
export declare interface CFResourceProps {
Type: string;
Properties: AnyProperties;
cfStackHandle?: Handle;
children?: any;
/**
* Set to true if CloudFormation or the underlying AWS resource does not
* support tagging
*/
tagsUnsupported?: boolean;
}/** @beta */
export declare class CFResourcePrimitive extends PrimitiveComponent<CFResourceProps> {
deployedWhen: DeployedWhenMethod;
}/** @beta */
export declare function awsCredentialsContext(defaultCreds: AwsCredentialsProps): Adapt.Context<AwsCredentialsProps>;/** @beta */
export declare function withCredentials<W extends Constructor<Component<any, any>>>(Wrapped: W, Ctx?: AwsCredentialsContext): (props: Adapt.PropsType<W> & Adapt.WithChildren) => Adapt.AdaptElement<Adapt.AnyProps>;/** @beta */
export declare function loadAwsCreds(options?: AwsCredsOptions): Promise<AwsCredentials>;/** @beta */
export declare interface AwsCredentialsProps {
awsAccessKeyId: string;
awsSecretAccessKey: string;
awsRegion: string;
}/** @beta */
export declare interface WithCredentials {
awsCredentials?: AwsCredentialsProps;
}/** @beta */
export declare type AwsCredentialsContext = Context<AwsCredentialsProps>;/** @beta */
const awsDefaultCredentialsContext: Adapt.Context<AwsCredentialsProps>;/** @beta */
export declare interface AwsCredentials {
awsAccessKeyId: string;
awsSecretAccessKey: string;
awsRegion: string;
}/** @beta */
export declare interface AwsCredsOptions {
credsFile?: string;
}/** @beta */
export declare interface EC2Props extends ComputeProps, WithChildren, WithCredentials {
imageId: string;
instanceType: string;
sshKeyName: string;
securityGroups: string[];
userData?: string;
}/** @beta */
export declare interface EC2InstanceStatus extends Status, AWS.EC2.Instance {
}/** @beta */
const EC2Instance: (props: EC2Props & Adapt.WithChildren) => Adapt.AdaptElement<Adapt.AnyProps>;/** @beta */
export declare interface EIPAssociationProps extends WithCredentials {
AllocationId?: string;
EIP?: string;
InstanceId?: string | Handle;
NetworkInterfaceId?: string;
PrivateIpAddress?: string;
}/** @beta */
const EIPAssociation: (props: EIPAssociationProps & Adapt.WithChildren) => Adapt.AdaptElement<Adapt.AnyProps>;/** @beta */
const EIPAssociation: (props: EIPAssociationProps & Adapt.WithChildren) => Adapt.AdaptElement<Adapt.AnyProps>;/** @beta */
export declare function isCFResourcePrimitiveElement(val: any): val is FinalDomElement<CFResourceProps>;/** @beta */
export declare function CFResource(props: SFCDeclProps<CFResourceProps>): Adapt.AdaptElement<Adapt.AnyProps>;/** @beta */
export declare interface AnyProperties {
[propName: string]: any;
}/** @beta */
export declare interface CFResourceProps {
Type: string;
Properties: AnyProperties;
cfStackHandle?: Handle;
children?: any;
/**
* Set to true if CloudFormation or the underlying AWS resource does not
* support tagging
*/
tagsUnsupported?: boolean;
}/** @beta */
export declare class CFResourcePrimitive extends PrimitiveComponent<CFResourceProps> {
deployedWhen: DeployedWhenMethod;
}/** @beta */
export declare function awsCredentialsContext(defaultCreds: AwsCredentialsProps): Adapt.Context<AwsCredentialsProps>;/** @beta */
export declare function withCredentials<W extends Constructor<Component<any, any>>>(Wrapped: W, Ctx?: AwsCredentialsContext): (props: Adapt.PropsType<W> & Adapt.WithChildren) => Adapt.AdaptElement<Adapt.AnyProps>;/** @beta */
export declare function loadAwsCreds(options?: AwsCredsOptions): Promise<AwsCredentials>;/** @beta */
export declare interface AwsCredentialsProps {
awsAccessKeyId: string;
awsSecretAccessKey: string;
awsRegion: string;
}/** @beta */
export declare interface WithCredentials {
awsCredentials?: AwsCredentialsProps;
}/** @beta */
export declare type AwsCredentialsContext = Context<AwsCredentialsProps>;/** @beta */
const awsDefaultCredentialsContext: Adapt.Context<AwsCredentialsProps>;/** @beta */
export declare interface AwsCredentials {
awsAccessKeyId: string;
awsSecretAccessKey: string;
awsRegion: string;
}/** @beta */
export declare interface AwsCredsOptions {
credsFile?: string;
}/** @beta */
export declare interface EC2Props extends ComputeProps, WithChildren, WithCredentials {
imageId: string;
instanceType: string;
sshKeyName: string;
securityGroups: string[];
userData?: string;
}/** @beta */
export declare interface EC2InstanceStatus extends Status, AWS.EC2.Instance {
}/** @beta */
const EC2Instance: (props: EC2Props & Adapt.WithChildren) => Adapt.AdaptElement<Adapt.AnyProps>;/** @beta */
export declare interface EIPAssociationProps extends WithCredentials {
AllocationId?: string;
EIP?: string;
InstanceId?: string | Handle;
NetworkInterfaceId?: string;
PrivateIpAddress?: string;
}/** @beta */
const EIPAssociation: (props: EIPAssociationProps & Adapt.WithChildren) => Adapt.AdaptElement<Adapt.AnyProps>;/** @beta */
const EIPAssociation: (props: EIPAssociationProps & Adapt.WithChildren) => Adapt.AdaptElement<Adapt.AnyProps>;/** @beta */
export declare function isCFResourcePrimitiveElement(val: any): val is FinalDomElement<CFResourceProps>;/** @beta */
export declare function CFResource(props: SFCDeclProps<CFResourceProps>): Adapt.AdaptElement<Adapt.AnyProps>;/** @beta */
export declare interface AnyProperties {
[propName: string]: any;
}/** @beta */
export declare interface CFResourceProps {
Type: string;
Properties: AnyProperties;
cfStackHandle?: Handle;
children?: any;
/**
* Set to true if CloudFormation or the underlying AWS resource does not
* support tagging
*/
tagsUnsupported?: boolean;
}/** @beta */
export declare class CFResourcePrimitive extends PrimitiveComponent<CFResourceProps> {
deployedWhen: DeployedWhenMethod;
}/** @beta */
export declare function awsCredentialsContext(defaultCreds: AwsCredentialsProps): Adapt.Context<AwsCredentialsProps>;/** @beta */
export declare function withCredentials<W extends Constructor<Component<any, any>>>(Wrapped: W, Ctx?: AwsCredentialsContext): (props: Adapt.PropsType<W> & Adapt.WithChildren) => Adapt.AdaptElement<Adapt.AnyProps>;/** @beta */
export declare function loadAwsCreds(options?: AwsCredsOptions): Promise<AwsCredentials>;/** @beta */
export declare interface AwsCredentialsProps {
awsAccessKeyId: string;
awsSecretAccessKey: string;
awsRegion: string;
}/** @beta */
export declare interface WithCredentials {
awsCredentials?: AwsCredentialsProps;
}/** @beta */
export declare type AwsCredentialsContext = Context<AwsCredentialsProps>;/** @beta */
const awsDefaultCredentialsContext: Adapt.Context<AwsCredentialsProps>;/** @beta */
export declare interface AwsCredentials {
awsAccessKeyId: string;
awsSecretAccessKey: string;
awsRegion: string;
}/** @beta */
export declare interface AwsCredsOptions {
credsFile?: string;
}/** @beta */
export declare interface EC2Props extends ComputeProps, WithChildren, WithCredentials {
imageId: string;
instanceType: string;
sshKeyName: string;
securityGroups: string[];
userData?: string;
}/** @beta */
export declare interface EC2InstanceStatus extends Status, AWS.EC2.Instance {
}/** @beta */
const EC2Instance: (props: EC2Props & Adapt.WithChildren) => Adapt.AdaptElement<Adapt.AnyProps>;/** @beta */
export declare interface EIPAssociationProps extends WithCredentials {
AllocationId?: string;
EIP?: string;
InstanceId?: string | Handle;
NetworkInterfaceId?: string;
PrivateIpAddress?: string;
}/** @beta */
const EIPAssociation: (props: EIPAssociationProps & Adapt.WithChildren) => Adapt.AdaptElement<Adapt.AnyProps>;/** @beta */
const EIPAssociation: (props: EIPAssociationProps & Adapt.WithChildren) => Adapt.AdaptElement<Adapt.AnyProps>;
}
/**
* A command to be used when creating a {@link Container}.
*
* @remarks
* See the
* {@link https://docs.docker.com/engine/api/v1.40/#operation/ContainerCreate | Docker API Reference}
* for more information.
* @public
*/
export declare type Command = string | string[];
/**
* Abstract element to represent a computational resource
*
* @beta
*/
export declare abstract class Compute extends Component<ComputeProps, {}> {
}
/**
* Props for a {@link Compute} element
*
* @beta
*/
export declare interface ComputeProps extends WithChildren {
name?: string;
ip?: string;
}
/**
* Config for {@link ContainerStatus}
* @public
*/
export declare interface Config {
Hostname: string;
Domainname: string;
User: string;
AttachStdin: boolean;
AttachStdout: boolean;
AttachStderr: boolean;
Tty: boolean;
OpenStdin: boolean;
StdinOnce: boolean;
Env: string[];
Cmd: string[];
ArgsEscaped: boolean;
Image: string;
Volumes: FIXME_NeedsProperType;
WorkingDir: string;
Entrypoint: FIXME_NeedsProperType;
OnBuild: FIXME_NeedsProperType;
Labels: ContainerLabels;
StopSignal: FIXME_NeedsProperType;
ExposedPorts: null | {
[port: string]: {};
};
}
/**
* Components that provide a service, such as a database service or API
* service, can implement this interface in order to supply all the information
* required to connect to the service.
*
* @remarks
* Currently, the only method supported for providing connection information
* is via environment variables. However, additional formats for providing
* connection information will be added as needs arise.
* @public
*/
export declare interface ConnectToInstance {
/**
* Supplies the set of environment variables that have all the information
* needed for a consumer of a service to connect to the provider.
*
* @param scope - Scope for which connection information is desired
* @returns Environment with connection information, undefined if info not yet ready.
*
* @remarks
* This may include information like network hostname(s), port(s),
* credentials, namespace, or any other service-specific information.
*
* In cases where the service has not been deployed yet or the
* connection information is not yet available for any reason, the
* method will return `undefined`.
*
* If a scope for which there will never be connection information is
* requested, this method should throw an appropriate error. For example
* if `NetworkScope.external` is requested for a service only reachable
* from within a cluster, this method should throw.
*
* Providers are discouraged from using environment variable names
* that are too generic or are likely to conflict with other environment
* variables that may already be in use. For example, avoid names like
* `HOST` and `USERNAME`. Instead, use names that are likely to be
* unique to the type of service so that a consumer can
* use more than one type of service without causing naming conflicts.
*
* Providers are encouraged to use environment variable names that are
* typically used by consumers of the service. For example, the provider
* of a Postgres database service should use the names `PGHOST` and
* `PGUSER`, which are defined in the Postgres documentation and
* are typically supported by most Postgres database clients.
*
* Providers should never return partial information. Return `undefined`
* until all required connection information is available.
*/
connectEnv(scope?: NetworkScope): Environment | undefined;
}
/**
* Abstract component representing a container.
* @public
*/
export declare abstract class Container extends PrimitiveComponent<ContainerProps> {
static defaultProps: {
dockerHost: string;
autoRemove: boolean;
ports: never[];
stdinOpen: boolean;
tty: boolean;
portBindings: {};
environment: {};
links: {};
imagePullPolicy: string;
};
static displayName: string;
}
/**
* Labels for a {@link Container}
* @public
*/
export declare interface ContainerLabels {
[name: string]: string;
}
/**
* Network for {@link ContainerStatus}
* @public
*/
export declare interface ContainerNetwork {
IPAMConfig: FIXME_NeedsProperType;
Links: FIXME_NeedsProperType;
Aliases: FIXME_NeedsProperType;
NetworkID: string;
EndpointID: string;
Gateway: string;
IPAddress: string;
IPPrefixLen: number;
IPv6Gateway: string;
GlobalIPv6Address: string;
GlobalIPv6PrefixLen: number;
MacAddress: string;
DriverOpts: FIXME_NeedsProperType;
}
/**
* NetworkSettings for {@link ContainerStatus}
* @public
*/
export declare interface ContainerNetworkSettings {
Bridge: FIXME_NeedsProperType;
SandboxID: string;
HairpinMode: boolean;
LinkLocalIPv6Address: string;
LinkLocalIPv6PrefixLen: number;
Ports: FIXME_NeedsProperType;
SandboxKey: string;
SecondaryIPAddresses: FIXME_NeedsProperType;
SecondaryIPv6Addresses: FIXME_NeedsProperType;
EndpointID: string;
Gateway: string;
GlobalIPv6Address: string;
GlobalIPv6PrefixLen: number;
IPAddress: string;
IPPrefixLen: number;
IPv6Gateway: string;
MacAddress: string;
Networks: {
[name: string]: ContainerNetwork;
};
}
/**
* Props for the {@link Container} component.
*
* @remarks
* See the
* {@link https://docs.docker.com/engine/api/v1.40/#operation/ContainerCreate | Docker API Reference}
* for more information.
* @public
*/
export declare interface ContainerProps {
name: string;
dockerHost: string;
image: ImageId;
autoRemove?: boolean;
ports?: PortDescription[];
stdinOpen?: boolean;
stopSignal?: string;
tty?: boolean;
command?: Command;
portBindings?: PortBinding;
environment?: Environment;
links?: Links;
entrypoint?: Command;
/**
* The behavior to apply when the container exits.
* @remarks
* See {@link RestartPolicy} and {@link RestartPolicyName} for the
* possible values and corresponding behavior.
* @defaultValue The default is `{ name: "Never" }`, which does not
* restart the container.
*/
restartPolicy?: RestartPolicy;
workingDir?: string;
imagePullPolicy?: "Always" | "Never" | "IfNotPresent";
}
/**
* State information for a {@link Container}.
* @public
*/
export declare interface ContainerState {
Status: string;
Running: boolean;
Paused: boolean;
Restarting: boolean;
OOMKilled: boolean;
Dead: boolean;
Pid: number;
ExitCode: number;
Error: string;
StartedAt: string;
FinishedAt: string;
}
/**
* Status of a {@link Container}.
* @public
*/
export declare interface ContainerStatus {
Id: string;
Created: string;
Path: string;
Args: string[];
State: ContainerState;
Image: string;
ResolvConfPath: string;
HostnamePath: string;
HostsPath: string;
Node: FIXME_NeedsProperType;
Name: string;
RestartCount: number;
Driver: string;
MountLabel: string;
ProcessLabel: string;
AppArmorProfile: string;
ExecIDs: string;
HostConfig: HostConfigStatus;
GraphDriver: FIXME_NeedsProperType;
SizeRw: number;
SizeRootFs: number;
Mounts: MountStatus[];
Config: Config;
NetworkSettings: ContainerNetworkSettings;
}
export declare namespace docker {
/**
* Components that provide a Docker image can implement this interface to
* allow other components to get information about the Docker image.
* @public
*/
export declare interface DockerImageInstance {
/**
* Returns information about the version of the Docker image that reflects
* the current set of props for the component.
* @remarks
* Returns undefined if no image has ever been built by
* this component OR if the component props have changed and the image
* that corresponds to the current props has not yet been built.
*/
image(): ImageInfo | undefined;
/**
* Returns information about the most current version of the Docker image
* that has completed building, even if that version does not reflect the
* current set of props for the component.
* @remarks
* Returns undefined if no image has ever been built by this component.
*/
latestImage(): ImageInfo | undefined;
/**
* Pushes the image returned by `latestImage` to a Docker registry.
* @remarks
* If `newTag` is provided, the image will have that tag in the
* given registry. Otherwise, the image's existing tag will be used.
* It is an error in that case if there is no tag associated with the
* `latestImage` image.
*
* If there is no latest image available (`latestImage` returns
* undefined), then `pushTo` will return undefined. Otherwise, if the
* push was successful, returns an {@link docker.ImageInfo} that contains
* the complete nameTag, including registry portion.
*/
pushTo?(registryUrl: string, newTag?: NameTagString): MaybePromise<ImageInfo | undefined>;
}/**
* Components that provide a Docker image can implement this interface to
* allow other components to get information about the Docker image and
* to be able to push the image to a registry.
* @public
*/
export declare interface DockerPushableImageInstance extends DockerImageInstance {
/**
* {@inheritdoc docker.DockerImageInstance.pushTo}
*/
pushTo(registryUrl: string, newTag?: NameTagString): MaybePromise<ImageInfo | undefined>;
}/**
* Props for {@link docker.DockerImage}.
* @beta
*/
export declare interface DockerImageProps {
}/**
* Abstract component representing a {@link https://docker.com | Docker}
* image that can be used to create containers.
* @remarks
* See also {@link Container}.
* @beta
*/
export declare abstract class DockerImage extends Component<DockerImageProps> implements DockerImageInstance {
/**
* {@inheritdoc docker.DockerImageInstance.image}
*/
image(): ImageInfo | undefined;
/**
* {@inheritdoc docker.DockerImageInstance.latestImage}
*/
latestImage(): ImageInfo | undefined;
}/**
* Compute the status of a container based on a graphQL schema
*
* @internal
*/
export declare function containerStatus(observe: ObserveForStatus, containerName: string, dockerHost: string): Promise<ContainerStatus | NoStatus>;/** @public */
export declare interface DockerContainerStatus extends ContainerStatus {
}/**
* Compute a unique name for the container
*
* @internal
*/
const computeContainerName: (elemKey: string, elemID: string, deployID: string) => string;/**
* Component to instantiate an image container with docker
*
* @remarks
* See {@link docker.DockerContainerProps}.
*
* @public
*/
declare class DockerContainer extends Action<DockerContainerProps, DockerContainerState> {
static defaultProps: {
dockerHost: string | undefined;
};
dependsOn: DependsOnMethod;
/** @internal */
shouldAct(diff: ChangeType, context: ActionContext): Promise<false | ShouldAct>;
/** @internal */
action(diff: ChangeType, context: ActionContext): Promise<void>;
status(observe: ObserveForStatus, buildData: BuildData): Promise<NoStatus | ContainerStatus>;
/**
* Get the IP address of the container, optionally for a specific Docker
* network.
* @remarks
* The IP addresses that are returned by this function are valid only
* on the associated Docker network, which is often only associated
* with a single host node for most Docker network types.
*
* @param network - Name of a Docker network. If `network` is provided
* and the container is connected to the network with an IP address, that
* address will be returned. If the container is not connected to the
* network, `undefined` will be returned. If `network` is not provided,
* the default container IP address will be returned.
*
* @beta
*/
dockerIP(network?: string): string | undefined;
/** @internal */
initialState(): {};
private displayName;
}/**
* Component to instantiate an image container with docker
*
* @remarks
* See {@link docker.DockerContainerProps}.
*
* @public
*/
declare class DockerContainer extends Action<DockerContainerProps, DockerContainerState> {
static defaultProps: {
dockerHost: string | undefined;
};
dependsOn: DependsOnMethod;
/** @internal */
shouldAct(diff: ChangeType, context: ActionContext): Promise<false | ShouldAct>;
/** @internal */
action(diff: ChangeType, context: ActionContext): Promise<void>;
status(observe: ObserveForStatus, buildData: BuildData): Promise<NoStatus | ContainerStatus>;
/**
* Get the IP address of the container, optionally for a specific Docker
* network.
* @remarks
* The IP addresses that are returned by this function are valid only
* on the associated Docker network, which is often only associated
* with a single host node for most Docker network types.
*
* @param network - Name of a Docker network. If `network` is provided
* and the container is connected to the network with an IP address, that
* address will be returned. If the container is not connected to the
* network, `undefined` will be returned. If `network` is not provided,
* the default container IP address will be returned.
*
* @beta
*/
dockerIP(network?: string): string | undefined;
/** @internal */
initialState(): {};
private displayName;
}/**
* Docker network service component, compatible with the abstract
* {@link NetworkService} component.
*
* @remarks
*
* Implements the {@link NetworkServiceInstance} interface.
* In a Docker deployment, there is no actual network service object to deploy.
* So this is a "virtual" component that simply implements the required
* instance methods for a NetworkService, but renders to null.
*
* This component is typically used by {@link docker.ServiceContainerSet}. The
* {@link docker.ServiceContainerSet} component can be used to ensure the proper
* network port configuration is applied to the `props.endpoint` container.
*
* @public
*/
export declare function NetworkService(props: SFCDeclProps<NetworkServiceProps, typeof defaultProps>): null;/**
* The base string used for Adapt Docker labels.
* @internal
*/
const adaptDockerKey = "org.adaptjs";/**
* Docker label for the deployID the object was created from.
* @internal
*/
const adaptDockerDeployIDKey: string;/**
* Props for {@link docker.LocalDockerImage}
*
* @public
*/
export declare interface LocalDockerImageProps {
/** Directory for use as the build context in docker build */
contextDir?: string;
/**
* Contents of the dockerfile
*
* @remarks
* Should not be used if dockerfileName is set
*/
dockerfile?: string;
/**
* Path to a local Dockerfile in the Adapt project.
*
* @remarks
* This path is relative to the root of the Adapt project.
* Should not be used if `dockerfile` is set.
*/
dockerfileName?: string;
/**
* Extra files that should be included during the docker build
*
* @remarks
* LocalDockerImage uses a multi-stage build process. It first creates
* a temporary image that includes the files specified in this field.
* This temporary image is then made available to the `dockerfile` with
* stage name `files` and can then be copied into the final image, as
* desired, using `COPY` or `ADD` commands in the `dockerfile`.
*
* @example
* To create a final Docker image that contains a file that has some
* programmatically created content, use the `dockerfile` prop along
* with the `files` prop like this:
* ```tsx
* const files = [{
* path: '/path/to/myfile.txt',
* contents: 'contents for myfile\n'
* }];
* const dockerfile = `
* FROM alpine
* COPY --from=files /path/to/myfile.txt /app/myfile.txt
* ...
* `;
* return <LocalDockerImage files={files} dockerfile={dockerfile} />
* ```
*/
files?: File[];
/**
* Options to control the behavior of docker build
*/
options?: DockerBuildOptions;
/**
* Extra stages to include in a multi-stage docker build
*/
stages?: Stage[];
}/**
* @internal
*/
export declare interface LocalDockerImageState {
deployOpID?: DeployOpID;
image?: ImageInfo;
imagePropsJson?: string;
prevUniqueTag?: string;
}/**
* Locally builds a docker image
*
* @remarks
* See {@link docker.LocalDockerImageProps}.
*
* @public
*/
export declare class LocalDockerImage extends Action<LocalDockerImageProps, LocalDockerImageState> implements DockerPushableImageInstance {
static defaultProps: {
options: {
dockerHost: string | undefined;
forceRm: boolean;
};
};
deployedWhenIsTrivial: boolean;
private image_?;
private imagePropsJson_?;
private options_;
constructor(props: LocalDockerImageProps);
buildComplete(): boolean;
ready(): boolean;
image(): ImageInfo | undefined;
pushTo(registryUrl: string, newTag?: NameTagString): Promise<undefined | ImageInfo>;
latestImage(): ImageInfo | undefined;
/**
* User-facing name to display in status messages.
*/
displayName(): string | undefined;
/**
* Implementations for Action base class
* @internal
*/
shouldAct(op: ChangeType): Promise<ShouldAct>;
/**
* Implementations for Action base class
* @internal
*/
action(op: ChangeType, ctx: ActionContext): Promise<void>;
/** @internal */
initialState(): {};
/** @internal */
deployedWhen: (goalStatus: GoalStatus) => true | import("@adpt/core").Waiting;
/** @internal */
protected readonly imagePropsJson: string;
}/**
* Runs a Docker registry in a container.
* @remarks
* Implements {@link docker.DockerRegistryInstance}.
*
* @public
*/
export declare function LocalDockerRegistry(props: SFCDeclProps<LocalDockerRegistryProps, typeof defaultProps>): Adapt.AdaptElement<Adapt.AnyProps>;/**
* Props for {@link docker.LocalDockerRegistry}
* @public
*/
export declare interface LocalDockerRegistryProps extends ExcludeKeys<DockerContainerProps, "image"> {
/**
* Tag to use for official Docker Hub `registry` image repo.
*/
imageTag: NameTagString;
/**
* Port number to expose for the registry HTTP server.
*/
port: number;
}/** @public */
export declare interface DockerRegistryInstance {
registry(): RegistryString | undefined;
}/**
* Props for {@link docker.RegistryDockerImage}
* @public
*/
export declare interface RegistryDockerImageProps {
/**
* Handle for image source
* @remarks
* Currently, only handle to LocalDockerImage components and compatible
* interfaces are supported.
* @privateRemarks
* FIXME(manishv) support string refs to other registries and handles of
* other registry images
*/
imageSrc: Handle<DockerPushableImageInstance>;
/**
* URL or string for the registry where the image should be pushed and pulled
*
* @remarks
* If this parameter is a string, registryUrl will be used for both push and pull
*
* If registryUrl is of the form `{ external: string, internal: string }`, docker images wil be
* pushed to `external` and image strings will refer to `internal`.
*
* Note(manishv)
* This is a bit of a hack to allow one hostname or IP address to push images from outside
* a particular environment (say k8s) and a different URL for that environment to pull
* images.
*
* A good example of this is a k3s-dind (k3s docker-in-docker) instance of kubernetes where
* a private registry is running on a docker network attached to the k3s-dind instance, but where we
* want to push {@link docker.LocalDockerImage} built images to that registry. Since
* {@link docker.LocalDockerImage | LocalDockerImage} is outside the k3s-dind environment, it must
* use a host accessible network to push to the registry. However, since the k3s-dind instance sees
* the registry from within Docker, it must use a different address to pull the images for use.
*
* Once network scopes are fully supported, this interface will change to whatever is appropriate. It
* is best if you can arrange to have the same URL or registry string work for all access regardless
* of which network the registry, Adapt host, and ultimate container running environment is uses.
*/
registryUrl: string | DockerSplitRegistryInfo;
/**
* Tag to use for the image in the registry.
* @remarks
* If omitted, the tag from the source is used. The tag should not
* include the registry hostname/port prefix.
*/
newTag?: string;
}/**
* Represents a Docker image in a registry.
* @remarks
* If the image does not exist in the specified registry, it will be pushed
* to that registry.
* @public
*/
export declare class RegistryDockerImage extends Action<RegistryDockerImageProps, State> implements DockerImageInstance {
private latestImage_?;
private latestRegistryUrl_?;
private registry;
constructor(props: RegistryDockerImageProps);
/**
* Returns information about the version of the Docker image that reflects
* the current set of props for the component and has been pushed to the
* registry.
* @remarks
* Returns undefined if the `props.imageSrc` component's `latestImage` method