IRepository¶
-
class
aws_cdk.aws_ecr.
IRepository
(*args, **kwds)¶ Bases:
aws_cdk.core.IResource
,typing_extensions.Protocol
Represents an ECR repository.
Methods
-
add_to_resource_policy
(statement)¶ Add a policy statement to the repository’s resource policy.
- Parameters
statement (
PolicyStatement
) –- Return type
-
grant
(grantee, *actions)¶ Grant the given principal identity permissions to perform the actions on this repository.
- Parameters
grantee (
IGrantable
) –actions (
str
) –
- Return type
-
grant_pull
(grantee)¶ Grant the given identity permissions to pull images in this repository.
- Parameters
grantee (
IGrantable
) –- Return type
-
grant_pull_push
(grantee)¶ Grant the given identity permissions to pull and push images to this repository.
- Parameters
grantee (
IGrantable
) –- Return type
-
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 descriptionevent_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. UseaddTarget()
to add a target.
- Return type
-
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 tagsdescription (
Optional
[str
]) – A description of the rule’s purpose. Default: - No descriptionevent_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. UseaddTarget()
to add a target.
- Return type
-
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 descriptionevent_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. UseaddTarget()
to add a target.
- Return type
-
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 tagsdescription (
Optional
[str
]) – A description of the rule’s purpose. Default: - No descriptionevent_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. UseaddTarget()
to add a target.
- Return type
-
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
-
env
¶ 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.
- Return type
-
node
¶ The construct tree node for this construct.
- Return type
-
repository_arn
¶ The ARN of the repository.
- Attribute
true
- Return type
str
-
repository_name
¶ The name of the repository.
- Attribute
true
- Return type
str
-
repository_uri
¶ .
ACCOUNT.dkr.ecr.REGION.amazonaws.com/REPOSITORY
- Attribute
true
- Type
The URI of this repository (represents the latest image)
- Return type
str
-