# API Reference ## Constructs ### DockerImageDeployment `DockerImageDeployment` pushes an image from a local or external source to a specified external destination. #### Initializers ```typescript import { DockerImageDeployment } from 'cdk-docker-image-deployment' new DockerImageDeployment(scope: Construct, id: string, props: DockerImageDeploymentProps) ``` | **Name** | **Type** | **Description** | | --- | --- | --- | | scope | constructs.Construct | *No description.* | | id | string | *No description.* | | props | DockerImageDeploymentProps | *No description.* | --- ##### `scope`Required - *Type:* constructs.Construct --- ##### `id`Required - *Type:* string --- ##### `props`Required - *Type:* DockerImageDeploymentProps --- #### Methods | **Name** | **Description** | | --- | --- | | toString | Returns a string representation of this construct. | --- ##### `toString` ```typescript public toString(): string ``` Returns a string representation of this construct. #### Static Functions | **Name** | **Description** | | --- | --- | | isConstruct | Checks if `x` is a construct. | --- ##### ~~`isConstruct`~~ ```typescript import { DockerImageDeployment } from 'cdk-docker-image-deployment' DockerImageDeployment.isConstruct(x: any) ``` Checks if `x` is a construct. ###### `x`Required - *Type:* any Any object. --- #### Properties | **Name** | **Type** | **Description** | | --- | --- | --- | | node | constructs.Node | The tree node. | --- ##### `node`Required ```typescript public readonly node: Node; ``` - *Type:* constructs.Node The tree node. --- ## Structs ### DestinationConfig Destination information. #### Initializer ```typescript import { DestinationConfig } from 'cdk-docker-image-deployment' const destinationConfig: DestinationConfig = { ... } ``` #### Properties | **Name** | **Type** | **Description** | | --- | --- | --- | | destinationUri | string | The URI of the destination repository to deploy to. | | loginConfig | LoginConfig | The login command and region. | | destinationTag | string | The tag of the deployed image. | --- ##### `destinationUri`Required ```typescript public readonly destinationUri: string; ``` - *Type:* string The URI of the destination repository to deploy to. --- ##### `loginConfig`Required ```typescript public readonly loginConfig: LoginConfig; ``` - *Type:* LoginConfig The login command and region. --- ##### `destinationTag`Optional ```typescript public readonly destinationTag: string; ``` - *Type:* string - *Default:* the tag of the source The tag of the deployed image. --- ### DockerImageDeploymentProps #### Initializer ```typescript import { DockerImageDeploymentProps } from 'cdk-docker-image-deployment' const dockerImageDeploymentProps: DockerImageDeploymentProps = { ... } ``` #### Properties | **Name** | **Type** | **Description** | | --- | --- | --- | | destination | Destination | Destination repository to deploy the image to. | | source | Source | Source of the image to deploy. | --- ##### `destination`Required ```typescript public readonly destination: Destination; ``` - *Type:* Destination Destination repository to deploy the image to. --- ##### `source`Required ```typescript public readonly source: Source; ``` - *Type:* Source Source of the image to deploy. --- ### EcrSourceOptions Properties needed for Source.ecr. #### Initializer ```typescript import { EcrSourceOptions } from 'cdk-docker-image-deployment' const ecrSourceOptions: EcrSourceOptions = { ... } ``` #### Properties | **Name** | **Type** | **Description** | | --- | --- | --- | | tag | string | Tag of deployed image. | --- ##### `tag`Optional ```typescript public readonly tag: string; ``` - *Type:* string - *Default:* tag of source Tag of deployed image. --- ### LoginConfig Login commands for specified registry. #### Initializer ```typescript import { LoginConfig } from 'cdk-docker-image-deployment' const loginConfig: LoginConfig = { ... } ``` #### Properties | **Name** | **Type** | **Description** | | --- | --- | --- | | loginCommand | string | Command to run in codebuild to login. | | region | string | Region of ECR repository. | --- ##### `loginCommand`Required ```typescript public readonly loginCommand: string; ``` - *Type:* string Command to run in codebuild to login. Formatted `docker login ...`. --- ##### `region`Optional ```typescript public readonly region: string; ``` - *Type:* string - *Default:* undefined if not an ECR repository Region of ECR repository. --- ### SourceConfig Source information. #### Initializer ```typescript import { SourceConfig } from 'cdk-docker-image-deployment' const sourceConfig: SourceConfig = { ... } ``` #### Properties | **Name** | **Type** | **Description** | | --- | --- | --- | | imageTag | string | The source tag. | | imageUri | string | The source image URI. | | loginConfig | LoginConfig | The login command and region. | --- ##### `imageTag`Required ```typescript public readonly imageTag: string; ``` - *Type:* string The source tag. --- ##### `imageUri`Required ```typescript public readonly imageUri: string; ``` - *Type:* string The source image URI. --- ##### `loginConfig`Required ```typescript public readonly loginConfig: LoginConfig; ``` - *Type:* LoginConfig The login command and region. --- ### SourceContext Bind context for Source. #### Initializer ```typescript import { SourceContext } from 'cdk-docker-image-deployment' const sourceContext: SourceContext = { ... } ``` #### Properties | **Name** | **Type** | **Description** | | --- | --- | --- | | handlerRole | aws-cdk-lib.aws_iam.IRole | The role for the handler. | --- ##### `handlerRole`Required ```typescript public readonly handlerRole: IRole; ``` - *Type:* aws-cdk-lib.aws_iam.IRole The role for the handler. --- ## Classes ### Destination Specifies docker image deployment destination. Usage: ```ts declare const repo: ecr.IRepository; const destinationEcr = dockerDeploy.Destination.ecr(repository, { tag: 'tag', }); ``` #### Initializers ```typescript import { Destination } from 'cdk-docker-image-deployment' new Destination() ``` | **Name** | **Type** | **Description** | | --- | --- | --- | --- #### Methods | **Name** | **Description** | | --- | --- | | bind | Bind grants the CodeBuild role permissions to pull and push to a repository if necessary. | --- ##### `bind` ```typescript public bind(role: IGrantable): DestinationConfig ``` Bind grants the CodeBuild role permissions to pull and push to a repository if necessary. Bind should be invoked by the caller to get the DestinationConfig. ###### `role`Required - *Type:* aws-cdk-lib.aws_iam.IGrantable --- #### Static Functions | **Name** | **Description** | | --- | --- | | ecr | Uses an ECR repository in the same account as the stack as the destination for the image. | --- ##### `ecr` ```typescript import { Destination } from 'cdk-docker-image-deployment' Destination.ecr(repository: IRepository, options?: EcrSourceOptions) ``` Uses an ECR repository in the same account as the stack as the destination for the image. ###### `repository`Required - *Type:* aws-cdk-lib.aws_ecr.IRepository --- ###### `options`Optional - *Type:* EcrSourceOptions --- ### Source Specifies docker image deployment source. Usage: ```ts import * as path from 'path'; const path = path.join(__dirname, 'path/to/directory'); const sourceDirectory = Source.directory(path); ``` #### Initializers ```typescript import { Source } from 'cdk-docker-image-deployment' new Source() ``` | **Name** | **Type** | **Description** | | --- | --- | --- | --- #### Methods | **Name** | **Description** | | --- | --- | | bind | Bind grants the CodeBuild role permissions to pull from a repository if necessary. | --- ##### `bind` ```typescript public bind(scope: Construct, context: SourceContext): SourceConfig ``` Bind grants the CodeBuild role permissions to pull from a repository if necessary. Bind should be invoked by the caller to get the SourceConfig. ###### `scope`Required - *Type:* constructs.Construct --- ###### `context`Required - *Type:* SourceContext --- #### Static Functions | **Name** | **Description** | | --- | --- | | directory | Uses a local image built from a Dockerfile in a local directory as the source. | --- ##### `directory` ```typescript import { Source } from 'cdk-docker-image-deployment' Source.directory(path: string) ``` Uses a local image built from a Dockerfile in a local directory as the source. ###### `path`Required - *Type:* string path to the directory containing your Dockerfile (not a path to a file). ---