Module: AWSCDK::ECR::IRepository

Includes:
IResource, Interfaces::AWSECR::IRepositoryRef
Included in:
RepositoryBase
Defined in:
ecr/i_repository.rb

Overview

Represents an ECR repository.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.jsii_overridable_methodsObject



259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
# File 'ecr/i_repository.rb', line 259

def self.jsii_overridable_methods
  {
    :node => { kind: :property, name: "node", is_optional: false },
    :env => { kind: :property, name: "env", is_optional: false },
    :stack => { kind: :property, name: "stack", is_optional: false },
    :repository_ref => { kind: :property, name: "repositoryRef", is_optional: false },
    :registry_uri => { kind: :property, name: "registryUri", is_optional: false },
    :repository_arn => { kind: :property, name: "repositoryArn", is_optional: false },
    :repository_name => { kind: :property, name: "repositoryName", is_optional: false },
    :repository_uri => { kind: :property, name: "repositoryUri", is_optional: false },
    :with => { kind: :method, name: "with", is_optional: false },
    :apply_removal_policy => { kind: :method, name: "applyRemovalPolicy", is_optional: false },
    :add_to_resource_policy => { kind: :method, name: "addToResourcePolicy", is_optional: false },
    :grant => { kind: :method, name: "grant", is_optional: false },
    :grant_pull => { kind: :method, name: "grantPull", is_optional: false },
    :grant_pull_push => { kind: :method, name: "grantPullPush", is_optional: false },
    :grant_push => { kind: :method, name: "grantPush", is_optional: false },
    :grant_read => { kind: :method, name: "grantRead", is_optional: false },
    :on_cloud_trail_event => { kind: :method, name: "onCloudTrailEvent", is_optional: false },
    :on_cloud_trail_image_pushed => { kind: :method, name: "onCloudTrailImagePushed", is_optional: false },
    :on_event => { kind: :method, name: "onEvent", is_optional: false },
    :on_image_scan_completed => { kind: :method, name: "onImageScanCompleted", is_optional: false },
    :repository_uri_for_digest => { kind: :method, name: "repositoryUriForDigest", is_optional: false },
    :repository_uri_for_tag => { kind: :method, name: "repositoryUriForTag", is_optional: false },
    :repository_uri_for_tag_or_digest => { kind: :method, name: "repositoryUriForTagOrDigest", is_optional: false },
  }
end

Instance Method Details

#add_to_resource_policy(statement) ⇒ AWSCDK::IAM::AddToResourcePolicyResult

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



112
113
114
115
# File 'ecr/i_repository.rb', line 112

def add_to_resource_policy(statement)
  Jsii::Type.check_type(statement, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLlBvbGljeVN0YXRlbWVudCJ9")), "statement")
  jsii_call_method("addToResourcePolicy", [statement])
end

#apply_removal_policy(policy) ⇒ void

This method returns an undefined value.

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).

Parameters:



103
104
105
106
# File 'ecr/i_repository.rb', line 103

def apply_removal_policy(policy)
  Jsii::Type.check_type(policy, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5SZW1vdmFsUG9saWN5In0=")), "policy")
  jsii_call_method("applyRemovalPolicy", [policy])
end

#envAWSCDK::Interfaces::ResourceEnvironment

The environment this resource belongs to.

For resources that are created and managed in a Stack (those created by creating new class instances like new Role(), new Bucket(), etc.), this is always the same as the environment of the stack they belong to.

For referenced resources (those obtained from referencing methods like Role.fromRoleArn(), Bucket.fromBucketName(), etc.), they might be different than the stack they were imported into.



27
28
29
# File 'ecr/i_repository.rb', line 27

def env()
  jsii_get_property("env")
end

#grant(grantee, *actions) ⇒ AWSCDK::IAM::Grant

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

Parameters:

Returns:



122
123
124
125
126
127
128
# File 'ecr/i_repository.rb', line 122

def grant(grantee, *actions)
  Jsii::Type.check_type(grantee, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLklHcmFudGFibGUifQ==")), "grantee")
  actions.each_with_index do |item, index|
    Jsii::Type.check_type(item, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "actions[#{index}]")
  end
  jsii_call_method("grant", [grantee, *actions])
end

#grant_pull(grantee) ⇒ AWSCDK::IAM::Grant

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

Parameters:

Returns:



134
135
136
137
# File 'ecr/i_repository.rb', line 134

def grant_pull(grantee)
  Jsii::Type.check_type(grantee, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLklHcmFudGFibGUifQ==")), "grantee")
  jsii_call_method("grantPull", [grantee])
end

#grant_pull_push(grantee) ⇒ AWSCDK::IAM::Grant

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

Parameters:

Returns:



143
144
145
146
# File 'ecr/i_repository.rb', line 143

def grant_pull_push(grantee)
  Jsii::Type.check_type(grantee, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLklHcmFudGFibGUifQ==")), "grantee")
  jsii_call_method("grantPullPush", [grantee])
end

#grant_push(grantee) ⇒ AWSCDK::IAM::Grant

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

Parameters:

Returns:



152
153
154
155
# File 'ecr/i_repository.rb', line 152

def grant_push(grantee)
  Jsii::Type.check_type(grantee, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLklHcmFudGFibGUifQ==")), "grantee")
  jsii_call_method("grantPush", [grantee])
end

#grant_read(grantee) ⇒ AWSCDK::IAM::Grant

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

Parameters:

Returns:



161
162
163
164
# File 'ecr/i_repository.rb', line 161

def grant_read(grantee)
  Jsii::Type.check_type(grantee, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLklHcmFudGFibGUifQ==")), "grantee")
  jsii_call_method("grantRead", [grantee])
end

#nodeConstructs::Node

The tree node.

Returns:

  • (Constructs::Node)


12
13
14
# File 'ecr/i_repository.rb', line 12

def node()
  jsii_get_property("node")
end

#on_cloud_trail_event(id, options = nil) ⇒ AWSCDK::Events::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.

Parameters:

Returns:



174
175
176
177
178
179
# File 'ecr/i_repository.rb', line 174

def on_cloud_trail_event(id, options = nil)
  Jsii::Type.check_type(id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id")
  options = options.is_a?(Hash) ? ::AWSCDK::Events::OnEventOptions.new(**options.transform_keys(&:to_sym)) : options
  Jsii::Type.check_type(options, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZXZlbnRzLk9uRXZlbnRPcHRpb25zIn0=")), "options") unless options.nil?
  jsii_call_method("onCloudTrailEvent", [id, options])
end

#on_cloud_trail_image_pushed(id, options = nil) ⇒ AWSCDK::Events::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.

Parameters:

Returns:



189
190
191
192
193
194
# File 'ecr/i_repository.rb', line 189

def on_cloud_trail_image_pushed(id, options = nil)
  Jsii::Type.check_type(id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id")
  options = options.is_a?(Hash) ? ::AWSCDK::ECR::OnCloudTrailImagePushedOptions.new(**options.transform_keys(&:to_sym)) : options
  Jsii::Type.check_type(options, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNyLk9uQ2xvdWRUcmFpbEltYWdlUHVzaGVkT3B0aW9ucyJ9")), "options") unless options.nil?
  jsii_call_method("onCloudTrailImagePushed", [id, options])
end

#on_event(id, options = nil) ⇒ AWSCDK::Events::Rule

Defines a CloudWatch event rule which triggers for repository events.

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

Parameters:

Returns:



204
205
206
207
208
209
# File 'ecr/i_repository.rb', line 204

def on_event(id, options = nil)
  Jsii::Type.check_type(id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id")
  options = options.is_a?(Hash) ? ::AWSCDK::Events::OnEventOptions.new(**options.transform_keys(&:to_sym)) : options
  Jsii::Type.check_type(options, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZXZlbnRzLk9uRXZlbnRPcHRpb25zIn0=")), "options") unless options.nil?
  jsii_call_method("onEvent", [id, options])
end

#on_image_scan_completed(id, options = nil) ⇒ AWSCDK::Events::Rule

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

Parameters:

Returns:



216
217
218
219
220
221
# File 'ecr/i_repository.rb', line 216

def on_image_scan_completed(id, options = nil)
  Jsii::Type.check_type(id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id")
  options = options.is_a?(Hash) ? ::AWSCDK::ECR::OnImageScanCompletedOptions.new(**options.transform_keys(&:to_sym)) : options
  Jsii::Type.check_type(options, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNyLk9uSW1hZ2VTY2FuQ29tcGxldGVkT3B0aW9ucyJ9")), "options") unless options.nil?
  jsii_call_method("onImageScanCompleted", [id, options])
end

#registry_uriString

The URI of this repository's registry:.

ACCOUNT.dkr.ecr.REGION.amazonaws.com

Returns:

  • (String)


50
51
52
# File 'ecr/i_repository.rb', line 50

def registry_uri()
  jsii_get_property("registryUri")
end

#repository_arnString

The ARN of the repository.

Returns:

  • (String)


57
58
59
# File 'ecr/i_repository.rb', line 57

def repository_arn()
  jsii_get_property("repositoryArn")
end

#repository_nameString

The name of the repository.

Returns:

  • (String)


64
65
66
# File 'ecr/i_repository.rb', line 64

def repository_name()
  jsii_get_property("repositoryName")
end

#repository_refAWSCDK::Interfaces::AWSECR::RepositoryReference

A reference to a Repository resource.



41
42
43
# File 'ecr/i_repository.rb', line 41

def repository_ref()
  jsii_get_property("repositoryRef")
end

#repository_uriString

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

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

Returns:

  • (String)


73
74
75
# File 'ecr/i_repository.rb', line 73

def repository_uri()
  jsii_get_property("repositoryUri")
end

#repository_uri_for_digest(digest = nil) ⇒ String

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

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

Parameters:

  • digest (String, nil) (defaults to: nil)

    Image digest to use (tools usually default to the image with the "latest" tag if omitted).

Returns:

  • (String)


229
230
231
232
# File 'ecr/i_repository.rb', line 229

def repository_uri_for_digest(digest = nil)
  Jsii::Type.check_type(digest, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "digest") unless digest.nil?
  jsii_call_method("repositoryUriForDigest", [digest])
end

#repository_uri_for_tag(tag = nil) ⇒ String

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 (String, nil) (defaults to: nil)

    Image tag to use (tools usually default to "latest" if omitted).

Returns:

  • (String)


240
241
242
243
# File 'ecr/i_repository.rb', line 240

def repository_uri_for_tag(tag = nil)
  Jsii::Type.check_type(tag, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "tag") unless tag.nil?
  jsii_call_method("repositoryUriForTag", [tag])
end

#repository_uri_for_tag_or_digest(tag_or_digest = nil) ⇒ String

Returns the URI of the repository for a certain tag or digest, inferring based on the syntax of the tag.

Can be used in docker push/pull.

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

Parameters:

  • tag_or_digest (String, nil) (defaults to: nil)

    Image tag or digest to use (tools usually default to the image with the "latest" tag if omitted).

Returns:

  • (String)


254
255
256
257
# File 'ecr/i_repository.rb', line 254

def repository_uri_for_tag_or_digest(tag_or_digest = nil)
  Jsii::Type.check_type(tag_or_digest, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "tagOrDigest") unless tag_or_digest.nil?
  jsii_call_method("repositoryUriForTagOrDigest", [tag_or_digest])
end

#stackAWSCDK::Stack

The stack in which this resource is defined.

Returns:



34
35
36
# File 'ecr/i_repository.rb', line 34

def stack()
  jsii_get_property("stack")
end

#with(*mixins) ⇒ Constructs::IConstruct

Applies one or more mixins to this construct.

Mixins are applied in order. The list of constructs is captured at the start of the call, so constructs added by a mixin will not be visited.

Parameters:

  • mixins (Array<Constructs::IMixin>)

    The mixins to apply.

Returns:

  • (Constructs::IConstruct)

    This construct for chaining



84
85
86
87
88
89
# File 'ecr/i_repository.rb', line 84

def with(*mixins)
  mixins.each_with_index do |item, index|
    Jsii::Type.check_type(item, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJjb25zdHJ1Y3RzLklNaXhpbiJ9")), "mixins[#{index}]")
  end
  jsii_call_method("with", [*mixins])
end