IRepository

class aws_cdk.aws_ecr.IRepository(*args, **kwargs)

Bases: aws_cdk.core.IResource, typing_extensions.Protocol

Represents an ECR repository.

__init__(*args, **kwargs)

Methods

add_to_resource_policy(statement)

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

Parameters

statement (PolicyStatement) –

Return type

None

grant(grantee, *actions)

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

Parameters
Return type

Grant

grant_pull(grantee)

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

Parameters

grantee (IGrantable) –

Return type

Grant

grant_pull_push(grantee)

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

Parameters

grantee (IGrantable) –

Return type

Grant

on_cloud_trail_event(id, *, description=None, event_pattern=None, rule_name=None, target=None)

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.

Parameters
  • id (str) – The id of the rule.

  • description (Optional[str]) – A description of the rule’s purpose. Default: - No description

  • event_pattern (Optional[EventPattern]) – Additional restrictions for the event to route to the specified target. The method that generates the rule probably imposes some type of event filtering. The filtering implied by what you pass here is added on top of that filtering. Default: - No additional filtering based on an event pattern.

  • rule_name (Optional[str]) – A name for the rule. Default: AWS CloudFormation generates a unique physical ID.

  • target (Optional[IRuleTarget]) – The target to register for the event. Default: - No target is added to the rule. Use addTarget() to add a target.

Return type

Rule

on_cloud_trail_image_pushed(id, *, image_tag=None, description=None, event_pattern=None, rule_name=None, target=None)

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.

Parameters
  • id (str) – The id of the rule.

  • image_tag (Optional[str]) – Only watch changes to this image tag. Default: - Watch changes to all tags

  • description (Optional[str]) – A description of the rule’s purpose. Default: - No description

  • event_pattern (Optional[EventPattern]) – Additional restrictions for the event to route to the specified target. The method that generates the rule probably imposes some type of event filtering. The filtering implied by what you pass here is added on top of that filtering. Default: - No additional filtering based on an event pattern.

  • rule_name (Optional[str]) – A name for the rule. Default: AWS CloudFormation generates a unique physical ID.

  • target (Optional[IRuleTarget]) – The target to register for the event. Default: - No target is added to the rule. Use addTarget() to add a target.

Return type

Rule

on_event(id, *, description=None, event_pattern=None, rule_name=None, target=None)

Defines a CloudWatch event rule which triggers for repository events.

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

Parameters
  • id (str) –

  • description (Optional[str]) – A description of the rule’s purpose. Default: - No description

  • event_pattern (Optional[EventPattern]) – Additional restrictions for the event to route to the specified target. The method that generates the rule probably imposes some type of event filtering. The filtering implied by what you pass here is added on top of that filtering. Default: - No additional filtering based on an event pattern.

  • rule_name (Optional[str]) – A name for the rule. Default: AWS CloudFormation generates a unique physical ID.

  • target (Optional[IRuleTarget]) – The target to register for the event. Default: - No target is added to the rule. Use addTarget() to add a target.

Return type

Rule

on_image_scan_completed(id, *, image_tags=None, description=None, event_pattern=None, rule_name=None, target=None)

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

Parameters
  • id (str) – The id of the rule.

  • image_tags (Optional[List[str]]) – Only watch changes to the image tags spedified. Leave it undefined to watch the full repository. Default: - Watch the changes to the repository with all image tags

  • description (Optional[str]) – A description of the rule’s purpose. Default: - No description

  • event_pattern (Optional[EventPattern]) – Additional restrictions for the event to route to the specified target. The method that generates the rule probably imposes some type of event filtering. The filtering implied by what you pass here is added on top of that filtering. Default: - No additional filtering based on an event pattern.

  • rule_name (Optional[str]) – A name for the rule. Default: AWS CloudFormation generates a unique physical ID.

  • target (Optional[IRuleTarget]) – The target to register for the event. Default: - No target is added to the rule. Use addTarget() to add a target.

Return type

Rule

repository_uri_for_tag(tag=None)

Returns the URI of the repository for a certain tag. Can be used in docker push/pull.

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

Parameters

tag (Optional[str]) – Image tag to use (tools usually default to “latest” if omitted).

Return type

str

Attributes

node

The construct tree node for this construct.

Return type

ConstructNode

repository_arn

The ARN of the repository.

attribute: :attribute:: true

Return type

str

repository_name

The name of the repository.

attribute: :attribute:: true

Return type

str

repository_uri

.

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

attribute: :attribute:: true

Type

The URI of this repository (represents the latest image)

Return type

str

stack

The stack in which this resource is defined.

Return type

Stack