Skip to content

Latest commit

 

History

History
1186 lines (668 loc) · 20.4 KB

File metadata and controls

1186 lines (668 loc) · 20.4 KB

README

@cloudcomponents/cdk-container-registry

@cloudcomponents/cdk-container-registry

Table of contents

Enumerations

Classes

Interfaces

Image Repository

@cloudcomponents/cdk-container-registry / ImageRepository

Class: ImageRepository

Hierarchy

  • Repository

    ImageRepository

Table of contents

Constructors

Properties

Accessors

Methods

Constructors

constructor

new ImageRepository(scope, id, props?)

Parameters

Name Type
scope Construct
id string
props? ImageRepositoryProps

Overrides

Repository.constructor

Properties

env

Readonly env: ResourceEnvironment

The environment this resource belongs to.

For resources that are created and managed by the CDK (generally, those created by creating new class instances like Role, Bucket, etc.), this is always the same as the environment of the stack they belong to; however, for imported resources (those obtained from static methods like fromRoleArn, fromBucketName, etc.), that might be different than the stack they were imported into.

stability stable

Inherited from

Repository.env


node

Readonly node: ConstructNode

The construct tree node associated with this construct.

stability stable

Inherited from

Repository.node


physicalName

Protected Readonly physicalName: string

Returns a string-encoded token that resolves to the physical name that should be passed to the CloudFormation resource.

This value will resolve to one of the following:

  • a concrete value (e.g. "my-awesome-bucket")
  • undefined, when a name should be generated by CloudFormation
  • a concrete name generated automatically during synthesis, in cross-environment scenarios.

stability stable

Inherited from

Repository.physicalName


repositoryArn

Readonly repositoryArn: string

The ARN of the repository.

stability stable

Inherited from

Repository.repositoryArn


repositoryName

Readonly repositoryName: string

The name of the repository.

stability stable

Inherited from

Repository.repositoryName


stack

Readonly stack: Stack

The stack in which this resource is defined.

stability stable

Inherited from

Repository.stack

Accessors

repositoryUri

get repositoryUri(): string

The URI of this repository (represents the latest image):.

ACCOUNT.dkr.ecr.REGION.amazonaws.com/REPOSITORY

stability stable

Returns

string

Inherited from

Repository.repositoryUri

Methods

_enableCrossEnvironment

_enableCrossEnvironment(): void

Called when this resource is referenced across environments (account/region) to order to request that a physical name will be generated for this resource during synthesis, so the resource can be referenced through it's absolute name/arn.

internal

Returns

void

Inherited from

Repository._enableCrossEnvironment


addLifecycleRule

addLifecycleRule(rule): void

Add a life cycle rule to the repository.

Life cycle rules automatically expire images from the repository that match certain conditions.

stability stable

Parameters

Name Type
rule LifecycleRule

Returns

void

Inherited from

Repository.addLifecycleRule


addToResourcePolicy

addToResourcePolicy(statement): AddToResourcePolicyResult

Add a policy statement to the repository's resource policy.

stability stable

Parameters

Name Type
statement PolicyStatement

Returns

AddToResourcePolicyResult

Inherited from

Repository.addToResourcePolicy


applyRemovalPolicy

applyRemovalPolicy(policy): void

Apply the given removal policy to this resource.

The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you've removed it from the CDK application or because you've made a change that requires the resource to be replaced.

The resource can be deleted (RemovalPolicy.DESTROY), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN).

stability stable

Parameters

Name Type
policy RemovalPolicy

Returns

void

Inherited from

Repository.applyRemovalPolicy


generatePhysicalName

Protected generatePhysicalName(): string

stability stable

Returns

string

Inherited from

Repository.generatePhysicalName


getResourceArnAttribute

Protected getResourceArnAttribute(arnAttr, arnComponents): string

Returns an environment-sensitive token that should be used for the resource's "ARN" attribute (e.g. bucket.bucketArn).

Normally, this token will resolve to arnAttr, but if the resource is referenced across environments, arnComponents will be used to synthesize a concrete ARN with the resource's physical name. Make sure to reference this.physicalName in arnComponents.

stability stable

Parameters

Name Type Description
arnAttr string The CFN attribute which resolves to the ARN of the resource.
arnComponents ArnComponents The format of the ARN of this resource.

Returns

string

Inherited from

Repository.getResourceArnAttribute


getResourceNameAttribute

Protected getResourceNameAttribute(nameAttr): string

Returns an environment-sensitive token that should be used for the resource's "name" attribute (e.g. bucket.bucketName).

Normally, this token will resolve to nameAttr, but if the resource is referenced across environments, it will be resolved to this.physicalName, which will be a concrete name.

stability stable

Parameters

Name Type Description
nameAttr string The CFN attribute which resolves to the resource's name.

Returns

string

Inherited from

Repository.getResourceNameAttribute


grant

grant(grantee, ...actions): Grant

Grant the given principal identity permissions to perform the actions on this repository.

stability stable

Parameters

Name Type
grantee IGrantable
...actions string[]

Returns

Grant

Inherited from

Repository.grant


grantPull

grantPull(grantee): Grant

Grant the given identity permissions to use the images in this repository.

stability stable

Parameters

Name Type
grantee IGrantable

Returns

Grant

Inherited from

Repository.grantPull


grantPullPush

grantPullPush(grantee): Grant

Grant the given identity permissions to pull and push images to this repository.

stability stable

Parameters

Name Type
grantee IGrantable

Returns

Grant

Inherited from

Repository.grantPullPush


onCloudTrailEvent

onCloudTrailEvent(id, options?): Rule

Define a CloudWatch event that triggers when something happens to this repository.

Requires that there exists at least one CloudTrail Trail in your account that captures the event. This method will not create the Trail.

stability stable

Parameters

Name Type Description
id string The id of the rule.
options? OnEventOptions Options for adding the rule.

Returns

Rule

Inherited from

Repository.onCloudTrailEvent


onCloudTrailImagePushed

onCloudTrailImagePushed(id, options?): Rule

Defines an AWS CloudWatch event rule that can trigger a target when an image is pushed to this repository.

Requires that there exists at least one CloudTrail Trail in your account that captures the event. This method will not create the Trail.

stability stable

Parameters

Name Type Description
id string The id of the rule.
options? OnCloudTrailImagePushedOptions Options for adding the rule.

Returns

Rule

Inherited from

Repository.onCloudTrailImagePushed


onEvent

onEvent(id, options?): Rule

Defines a CloudWatch event rule which triggers for repository events.

Use rule.addEventPattern(pattern) to specify a filter.

stability stable

Parameters

Name Type
id string
options? OnEventOptions

Returns

Rule

Inherited from

Repository.onEvent


onFinding

onFinding(id, options): Rule

Parameters

Name Type
id string
options OnFindingOptions

Returns

Rule


onImageScanCompleted

onImageScanCompleted(id, options?): Rule

Defines an AWS CloudWatch event rule that can trigger a target when an image scan is completed.

stability stable

Parameters

Name Type Description
id string The id of the rule.
options? OnImageScanCompletedOptions Options for adding the rule.

Returns

Rule

Inherited from

Repository.onImageScanCompleted


onPrepare

Protected onPrepare(): void

Perform final modifications before synthesis.

This method can be implemented by derived constructs in order to perform final changes before synthesis. prepare() will be called after child constructs have been prepared.

This is an advanced framework feature. Only use this if you understand the implications.

stability stable

Returns

void

Inherited from

Repository.onPrepare


onSynthesize

Protected onSynthesize(session): void

Allows this construct to emit artifacts into the cloud assembly during synthesis.

This method is usually implemented by framework-level constructs such as Stack and Asset as they participate in synthesizing the cloud assembly.

stability stable

Parameters

Name Type Description
session ISynthesisSession The synthesis session.

Returns

void

Inherited from

Repository.onSynthesize


onValidate

Protected onValidate(): string[]

Validate the current construct.

This method can be implemented by derived constructs in order to perform validation logic. It is called on all constructs before synthesis.

stability stable

Returns

string[]

An array of validation error messages, or an empty array if the construct is valid.

Inherited from

Repository.onValidate


prepare

Protected prepare(): void

Perform final modifications before synthesis.

This method can be implemented by derived constructs in order to perform final changes before synthesis. prepare() will be called after child constructs have been prepared.

This is an advanced framework feature. Only use this if you understand the implications.

stability stable

Returns

void

Inherited from

Repository.prepare


repositoryUriForDigest

repositoryUriForDigest(digest?): string

Returns the URL of the repository. Can be used in docker push/pull.

ACCOUNT.dkr.ecr.REGION.amazonaws.com/REPOSITORY[@DIGEST]

stability stable

Parameters

Name Type Description
digest? string Optional image digest.

Returns

string

Inherited from

Repository.repositoryUriForDigest


repositoryUriForTag

repositoryUriForTag(tag?): string

Returns the URL of the repository. Can be used in docker push/pull.

ACCOUNT.dkr.ecr.REGION.amazonaws.com/REPOSITORY[:TAG]

stability stable

Parameters

Name Type Description
tag? string Optional image tag.

Returns

string

Inherited from

Repository.repositoryUriForTag


synthesize

Protected synthesize(session): void

Allows this construct to emit artifacts into the cloud assembly during synthesis.

This method is usually implemented by framework-level constructs such as Stack and Asset as they participate in synthesizing the cloud assembly.

stability stable

Parameters

Name Type Description
session ISynthesisSession The synthesis session.

Returns

void

Inherited from

Repository.synthesize


toString

toString(): string

Returns a string representation of this construct.

stability stable

Returns

string

Inherited from

Repository.toString


validate

Protected validate(): string[]

Validate the current construct.

This method can be implemented by derived constructs in order to perform validation logic. It is called on all constructs before synthesis.

stability stable

Returns

string[]

Inherited from

Repository.validate


arnForLocalRepository

Static arnForLocalRepository(repositoryName, scope, account?): string

Returns an ECR ARN for a repository that resides in the same account/region as the current stack.

stability stable

Parameters

Name Type
repositoryName string
scope IConstruct
account? string

Returns

string

Inherited from

Repository.arnForLocalRepository


fromRepositoryArn

Static fromRepositoryArn(scope, id, repositoryArn): IRepository

stability stable

Parameters

Name Type
scope Construct
id string
repositoryArn string

Returns

IRepository

Inherited from

Repository.fromRepositoryArn


fromRepositoryAttributes

Static fromRepositoryAttributes(scope, id, attrs): IRepository

Import a repository.

stability stable

Parameters

Name Type
scope Construct
id string
attrs RepositoryAttributes

Returns

IRepository

Inherited from

Repository.fromRepositoryAttributes


fromRepositoryName

Static fromRepositoryName(scope, id, repositoryName): IRepository

stability stable

Parameters

Name Type
scope Construct
id string
repositoryName string

Returns

IRepository

Inherited from

Repository.fromRepositoryName


isConstruct

Static isConstruct(x): x is Construct

Return whether the given object is a Construct.

stability stable

Parameters

Name Type
x any

Returns

x is Construct

Inherited from

Repository.isConstruct


isResource

Static isResource(construct): construct is CfnResource

Check whether the given construct is a Resource.

stability stable

Parameters

Name Type
construct IConstruct

Returns

construct is CfnResource

Inherited from

Repository.isResource

Severity

@cloudcomponents/cdk-container-registry / Severity

Enumeration: Severity

Table of contents

Enumeration members

Enumeration members

CRITICAL

CRITICAL = "CRITICAL"


HIGH

HIGH = "HIGH"


INFORMATIONAL

INFORMATIONAL = "INFORMATIONAL"


LOW

LOW = "LOW"


MEDIUM

MEDIUM = "MEDIUM"


UNDEFINED

UNDEFINED = "UNDEFINED"

Image Repository Props

@cloudcomponents/cdk-container-registry / ImageRepositoryProps

Interface: ImageRepositoryProps

Hierarchy

  • RepositoryProps

    ImageRepositoryProps

Table of contents

Properties

Properties

forceDelete

Optional Readonly forceDelete: boolean

If a repository contains images, forces the deletion during stack deletion.

default false


imageScanOnPush

Optional Readonly imageScanOnPush: boolean

Enable the scan on push when creating the repository.

default false

stability stable

Inherited from

RepositoryProps.imageScanOnPush


imageTagMutability

Optional Readonly imageTagMutability: TagMutability

The tag mutability setting for the repository.

If this parameter is omitted, the default setting of MUTABLE will be used which will allow image tags to be overwritten.

default TagMutability.MUTABLE

stability stable

Inherited from

RepositoryProps.imageTagMutability


lifecycleRegistryId

Optional Readonly lifecycleRegistryId: string

The AWS account ID associated with the registry that contains the repository.

default The default registry is assumed.

see https://docs.aws.amazon.com/AmazonECR/latest/APIReference/API_PutLifecyclePolicy.html

stability stable

Inherited from

RepositoryProps.lifecycleRegistryId


lifecycleRules

Optional Readonly lifecycleRules: LifecycleRule[]

Life cycle rules to apply to this registry.

default No life cycle rules

stability stable

Inherited from

RepositoryProps.lifecycleRules


removalPolicy

Optional Readonly removalPolicy: RemovalPolicy

Determine what happens to the repository when the resource/stack is deleted.

default RemovalPolicy.Retain

stability stable

Inherited from

RepositoryProps.removalPolicy


repositoryName

Optional Readonly repositoryName: string

Name for this repository.

default Automatically generated name.

stability stable

Inherited from

RepositoryProps.repositoryName

On Finding Options

@cloudcomponents/cdk-container-registry / OnFindingOptions

Interface: OnFindingOptions

Table of contents

Properties

Properties

alarmTopic

Readonly alarmTopic: ITopic


imageTags

Optional Readonly imageTags: string[]

Only watch changes to the image tags specified. Leave it undefined to watch the full repository.

default - Watch the changes to the repository with all image tags


severity

Readonly severity: Severity