Class Repository
Define an ECR repository.
Inherited Members
Namespace: Amazon.CDK.AWS.ECR
Assembly: Amazon.CDK.AWS.ECR.dll
Syntax (csharp)
public class Repository : RepositoryBase, IRepository, IResource, IConstruct, IDependable
Syntax (vb)
Public Class Repository
Inherits RepositoryBase
Implements IRepository, IResource, IConstruct, IDependable
Remarks
ExampleMetadata: infused
Examples
using Amazon.CDK.AWS.ECR;
new Service(this, "Service", new ServiceProps {
Source = Source.FromEcr(new EcrProps {
ImageConfiguration = new ImageConfiguration { Port = 80 },
Repository = Repository.FromRepositoryName(this, "NginxRepository", "nginx"),
TagOrDigest = "latest"
})
});
Synopsis
Constructors
Repository(ByRefValue) | Used by jsii to construct an instance of this class from a Javascript-owned object reference |
Repository(DeputyBase.DeputyProps) | Used by jsii to construct an instance of this class from DeputyProps |
Repository(Construct, String, IRepositoryProps) |
Properties
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. |
FromRepositoryArn(Construct, String, String) | |
FromRepositoryAttributes(Construct, String, IRepositoryAttributes) | Import a repository. |
FromRepositoryName(Construct, String, String) | |
Validate() | Validate the current construct. |
Constructors
Repository(ByRefValue)
Used by jsii to construct an instance of this class from a Javascript-owned object reference
protected Repository(ByRefValue reference)
Parameters
- reference Amazon.JSII.Runtime.Deputy.ByRefValue
The Javascript-owned object reference
Repository(DeputyBase.DeputyProps)
Used by jsii to construct an instance of this class from DeputyProps
protected Repository(DeputyBase.DeputyProps props)
Parameters
- props Amazon.JSII.Runtime.Deputy.DeputyBase.DeputyProps
The deputy props
Repository(Construct, String, IRepositoryProps)
public Repository(Construct scope, string id, IRepositoryProps props = null)
Parameters
- scope Constructs.Construct
- id System.String
- props IRepositoryProps
Properties
RepositoryArn
The ARN of the repository.
public override string RepositoryArn { get; }
Property Value
System.String
Overrides
RepositoryName
The name of the repository.
public override string RepositoryName { get; }
Property Value
System.String
Overrides
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
Overrides
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 System.String
- scope Constructs.IConstruct
- account System.String
Returns
System.String
FromRepositoryArn(Construct, String, String)
public static IRepository FromRepositoryArn(Construct scope, string id, string repositoryArn)
Parameters
- scope Constructs.Construct
- id System.String
- repositoryArn System.String
Returns
FromRepositoryAttributes(Construct, String, IRepositoryAttributes)
Import a repository.
public static IRepository FromRepositoryAttributes(Construct scope, string id, IRepositoryAttributes attrs)
Parameters
- scope Constructs.Construct
- id System.String
- attrs IRepositoryAttributes
Returns
FromRepositoryName(Construct, String, String)
public static IRepository FromRepositoryName(Construct scope, string id, string repositoryName)
Parameters
- scope Constructs.Construct
- id System.String
- repositoryName System.String
Returns
Validate()
Validate the current construct.
protected override string[] Validate()
Returns
System.String[]
Overrides
Remarks
This method can be implemented by derived constructs in order to perform validation logic. It is called on all constructs before synthesis.