Show / Hide Table of Contents

Class Repository

Define an ECR repository.

Inheritance
object
Resource
RepositoryBase
Repository
Implements
IRepository
IResource
IRepositoryRef
IConstruct
IDependable
IEnvironmentAware
Inherited Members
RepositoryBase.Grant(IGrantable, params string[])
RepositoryBase.GrantPull(IGrantable)
RepositoryBase.GrantPullPush(IGrantable)
RepositoryBase.GrantPush(IGrantable)
RepositoryBase.GrantRead(IGrantable)
RepositoryBase.OnCloudTrailEvent(string, IOnEventOptions)
RepositoryBase.OnCloudTrailImagePushed(string, IOnCloudTrailImagePushedOptions)
RepositoryBase.OnEvent(string, IOnEventOptions)
RepositoryBase.OnImageScanCompleted(string, IOnImageScanCompletedOptions)
RepositoryBase.RepositoryUriForDigest(string)
RepositoryBase.RepositoryUriForTag(string)
RepositoryBase.RepositoryUriForTagOrDigest(string)
RepositoryBase.RegistryUri
RepositoryBase.RepositoryRef
RepositoryBase.RepositoryUri
Resource.IsOwnedResource(IConstruct)
Resource.IsResource(IConstruct)
Resource.ApplyCrossStackReferenceStrength(ReferenceStrength)
Resource.ApplyRemovalPolicy(RemovalPolicy)
Resource.GeneratePhysicalName()
Resource.GetResourceArnAttribute(string, IArnComponents)
Resource.GetResourceNameAttribute(string)
Resource.With(params IMixin[])
Resource.Env
Resource.PhysicalName
Resource.Stack
Namespace: Amazon.CDK.AWS.ECR
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class Repository : RepositoryBase, IRepository, IResource, IRepositoryRef, IConstruct, IDependable, IEnvironmentAware
Syntax (vb)
Public Class Repository Inherits RepositoryBase Implements IRepository, IResource, IRepositoryRef, IConstruct, IDependable, IEnvironmentAware
Remarks

ExampleMetadata: fixture=default infused

Examples
var repository = new Repository(this, "TestRepository");

            var runtime = new Runtime(this, "Runtime", new RuntimeProps {
                AgentRuntimeArtifact = AgentRuntimeArtifact.FromEcrRepository(repository, "v1.0.0")
            });

            new MetricFilter(this, "ToolErrors", new MetricFilterProps {
                LogGroup = runtime.ApplicationLogGroup,
                FilterPattern = FilterPattern.StringValue("$.tool_status", "=", "error"),
                MetricNamespace = "MyApp",
                MetricName = "ToolExecutionErrors"
            });

Synopsis

Constructors

Repository(Construct, string, IRepositoryProps?)

Define an ECR repository.

Properties

PROPERTY_INJECTION_ID

Uniquely identifies this class.

RepositoryArn

The ARN of the repository.

RepositoryName

The name of the repository.

Methods

AddLifecycleRule(ILifecycleRule)

Add a life cycle rule to the repository.

AddToResourcePolicy(PolicyStatement)

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

ArnForLocalRepository(string, IConstruct, string?)

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

FromLookup(Construct, string, IRepositoryLookupOptions)

Lookup an existing repository.

FromRepositoryArn(Construct, string, string)

Define an ECR repository.

FromRepositoryAttributes(Construct, string, IRepositoryAttributes)

Import a repository.

FromRepositoryName(Construct, string, string)

Define an ECR repository.

Constructors

Repository(Construct, string, IRepositoryProps?)

Define an ECR repository.

public Repository(Construct scope, string id, IRepositoryProps? props = null)
Parameters
scope Construct
id string
props IRepositoryProps
Remarks

ExampleMetadata: fixture=default infused

Examples
var repository = new Repository(this, "TestRepository");

            var runtime = new Runtime(this, "Runtime", new RuntimeProps {
                AgentRuntimeArtifact = AgentRuntimeArtifact.FromEcrRepository(repository, "v1.0.0")
            });

            new MetricFilter(this, "ToolErrors", new MetricFilterProps {
                LogGroup = runtime.ApplicationLogGroup,
                FilterPattern = FilterPattern.StringValue("$.tool_status", "=", "error"),
                MetricNamespace = "MyApp",
                MetricName = "ToolExecutionErrors"
            });

Properties

PROPERTY_INJECTION_ID

Uniquely identifies this class.

public static string PROPERTY_INJECTION_ID { get; }
Property Value

string

Remarks

ExampleMetadata: fixture=default infused

RepositoryArn

The ARN of the repository.

public override string RepositoryArn { get; }
Property Value

string

Overrides
RepositoryBase.RepositoryArn
Remarks

ExampleMetadata: fixture=default infused

RepositoryName

The name of the repository.

public override string RepositoryName { get; }
Property Value

string

Overrides
RepositoryBase.RepositoryName
Remarks

ExampleMetadata: fixture=default infused

Methods

AddLifecycleRule(ILifecycleRule)

Add a life cycle rule to the repository.

public virtual void AddLifecycleRule(ILifecycleRule rule)
Parameters
rule ILifecycleRule
Remarks

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

AddToResourcePolicy(PolicyStatement)

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

public override IAddToResourcePolicyResult AddToResourcePolicy(PolicyStatement statement)
Parameters
statement PolicyStatement
Returns

IAddToResourcePolicyResult

Overrides
RepositoryBase.AddToResourcePolicy(PolicyStatement)
Remarks

While other resources policies in AWS either require or accept a resource section, Cfn for ECR does not allow us to specify a resource policy. It will fail if a resource section is present at all.

ArnForLocalRepository(string, IConstruct, string?)

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

public static string ArnForLocalRepository(string repositoryName, IConstruct scope, string? account = null)
Parameters
repositoryName string
scope IConstruct
account string
Returns

string

Remarks

ExampleMetadata: fixture=default infused

FromLookup(Construct, string, IRepositoryLookupOptions)

Lookup an existing repository.

public static IRepository FromLookup(Construct scope, string id, IRepositoryLookupOptions options)
Parameters
scope Construct
id string
options IRepositoryLookupOptions
Returns

IRepository

Remarks

ExampleMetadata: fixture=default infused

FromRepositoryArn(Construct, string, string)

Define an ECR repository.

public static IRepository FromRepositoryArn(Construct scope, string id, string repositoryArn)
Parameters
scope Construct
id string
repositoryArn string
Returns

IRepository

Remarks

ExampleMetadata: fixture=default infused

Examples
var repository = new Repository(this, "TestRepository");

            var runtime = new Runtime(this, "Runtime", new RuntimeProps {
                AgentRuntimeArtifact = AgentRuntimeArtifact.FromEcrRepository(repository, "v1.0.0")
            });

            new MetricFilter(this, "ToolErrors", new MetricFilterProps {
                LogGroup = runtime.ApplicationLogGroup,
                FilterPattern = FilterPattern.StringValue("$.tool_status", "=", "error"),
                MetricNamespace = "MyApp",
                MetricName = "ToolExecutionErrors"
            });

FromRepositoryAttributes(Construct, string, IRepositoryAttributes)

Import a repository.

public static IRepository FromRepositoryAttributes(Construct scope, string id, IRepositoryAttributes attrs)
Parameters
scope Construct
id string
attrs IRepositoryAttributes
Returns

IRepository

Remarks

ExampleMetadata: fixture=default infused

FromRepositoryName(Construct, string, string)

Define an ECR repository.

public static IRepository FromRepositoryName(Construct scope, string id, string repositoryName)
Parameters
scope Construct
id string
repositoryName string
Returns

IRepository

Remarks

ExampleMetadata: fixture=default infused

Examples
var repository = new Repository(this, "TestRepository");

            var runtime = new Runtime(this, "Runtime", new RuntimeProps {
                AgentRuntimeArtifact = AgentRuntimeArtifact.FromEcrRepository(repository, "v1.0.0")
            });

            new MetricFilter(this, "ToolErrors", new MetricFilterProps {
                LogGroup = runtime.ApplicationLogGroup,
                FilterPattern = FilterPattern.StringValue("$.tool_status", "=", "error"),
                MetricNamespace = "MyApp",
                MetricName = "ToolExecutionErrors"
            });

Implements

IRepository
IResource
IRepositoryRef
Constructs.IConstruct
Constructs.IDependable
IEnvironmentAware
Back to top Generated by DocFX