Class Repository
java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
software.amazon.awscdk.Resource
software.amazon.awscdk.services.ecr.RepositoryBase
software.amazon.awscdk.services.ecr.Repository
- All Implemented Interfaces:
IEnvironmentAware,IResource,IRepository,software.amazon.jsii.JsiiSerializable,software.constructs.IConstruct,software.constructs.IDependable
@Generated(value="jsii-pacmak/1.119.0 (build 1634eac)",
date="2025-11-13T16:10:03.637Z")
@Stability(Stable)
public class Repository
extends RepositoryBase
Define an ECR repository.
Example:
Repository repository = Repository.Builder.create(this, "TestRepository")
.repositoryName("test-agent-runtime")
.build();
AgentRuntimeArtifact agentRuntimeArtifact = AgentRuntimeArtifact.fromEcrRepository(repository, "v1.0.0");
Runtime runtime = Runtime.Builder.create(this, "MyAgentRuntime")
.runtimeName("myAgent")
.agentRuntimeArtifact(agentRuntimeArtifact)
.authorizerConfiguration(RuntimeAuthorizerConfiguration.usingOAuth("https://github.com/.well-known/openid-configuration", "oauth_client_123"))
.build();
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationModeNested classes/interfaces inherited from interface software.constructs.IConstruct
software.constructs.IConstruct.Jsii$DefaultNested classes/interfaces inherited from interface software.amazon.awscdk.services.ecr.IRepository
IRepository.Jsii$DefaultNested classes/interfaces inherited from interface software.amazon.awscdk.IResource
IResource.Jsii$Default -
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedRepository(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protectedRepository(software.amazon.jsii.JsiiObjectRef objRef) Repository(software.constructs.Construct scope, String id) Repository(software.constructs.Construct scope, String id, RepositoryProps props) -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd a life cycle rule to the repository.addToResourcePolicy(PolicyStatement statement) Add a policy statement to the repository's resource policy.static StringarnForLocalRepository(String repositoryName, software.constructs.IConstruct scope) Returns an ECR ARN for a repository that resides in the same account/region as the current stack.static StringarnForLocalRepository(String repositoryName, software.constructs.IConstruct scope, String account) Returns an ECR ARN for a repository that resides in the same account/region as the current stack.static IRepositoryfromLookup(software.constructs.Construct scope, String id, RepositoryLookupOptions options) Lookup an existing repository.static IRepositoryfromRepositoryArn(software.constructs.Construct scope, String id, String repositoryArn) static IRepositoryfromRepositoryAttributes(software.constructs.Construct scope, String id, RepositoryAttributes attrs) Import a repository.static IRepositoryfromRepositoryName(software.constructs.Construct scope, String id, String repositoryName) The ARN of the repository.The name of the repository.Methods inherited from class software.amazon.awscdk.services.ecr.RepositoryBase
getRegistryUri, getRepositoryUri, grant, grantPull, grantPullPush, grantPush, grantRead, onCloudTrailEvent, onCloudTrailEvent, onCloudTrailImagePushed, onCloudTrailImagePushed, onEvent, onEvent, onImageScanCompleted, onImageScanCompleted, repositoryUriForDigest, repositoryUriForDigest, repositoryUriForTag, repositoryUriForTag, repositoryUriForTagOrDigest, repositoryUriForTagOrDigestMethods inherited from class software.amazon.awscdk.Resource
applyRemovalPolicy, generatePhysicalName, getEnv, getPhysicalName, getResourceArnAttribute, getResourceNameAttribute, getStack, isOwnedResource, isResourceMethods inherited from class software.constructs.Construct
getNode, isConstruct, toStringMethods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface software.constructs.IConstruct
getNodeMethods inherited from interface software.amazon.awscdk.interfaces.IEnvironmentAware
getEnvMethods inherited from interface software.amazon.awscdk.IResource
applyRemovalPolicy, getStackMethods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Field Details
-
PROPERTY_INJECTION_ID
Uniquely identifies this class.
-
-
Constructor Details
-
Repository
protected Repository(software.amazon.jsii.JsiiObjectRef objRef) -
Repository
protected Repository(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
Repository
@Stability(Stable) public Repository(@NotNull software.constructs.Construct scope, @NotNull String id, @Nullable RepositoryProps props) - Parameters:
scope- This parameter is required.id- This parameter is required.props-
-
Repository
@Stability(Stable) public Repository(@NotNull software.constructs.Construct scope, @NotNull String id) - Parameters:
scope- This parameter is required.id- This parameter is required.
-
-
Method Details
-
arnForLocalRepository
@Stability(Stable) @NotNull public static String arnForLocalRepository(@NotNull String repositoryName, @NotNull software.constructs.IConstruct scope, @Nullable String account) Returns an ECR ARN for a repository that resides in the same account/region as the current stack.- Parameters:
repositoryName- This parameter is required.scope- This parameter is required.account-
-
arnForLocalRepository
@Stability(Stable) @NotNull public static String arnForLocalRepository(@NotNull String repositoryName, @NotNull software.constructs.IConstruct scope) Returns an ECR ARN for a repository that resides in the same account/region as the current stack.- Parameters:
repositoryName- This parameter is required.scope- This parameter is required.
-
fromLookup
@Stability(Stable) @NotNull public static IRepository fromLookup(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull RepositoryLookupOptions options) Lookup an existing repository.- Parameters:
scope- This parameter is required.id- This parameter is required.options- This parameter is required.
-
fromRepositoryArn
@Stability(Stable) @NotNull public static IRepository fromRepositoryArn(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull String repositoryArn) - Parameters:
scope- This parameter is required.id- This parameter is required.repositoryArn- This parameter is required.
-
fromRepositoryAttributes
@Stability(Stable) @NotNull public static IRepository fromRepositoryAttributes(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull RepositoryAttributes attrs) Import a repository.- Parameters:
scope- This parameter is required.id- This parameter is required.attrs- This parameter is required.
-
fromRepositoryName
@Stability(Stable) @NotNull public static IRepository fromRepositoryName(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull String repositoryName) - Parameters:
scope- This parameter is required.id- This parameter is required.repositoryName- This parameter is required.
-
addLifecycleRule
Add a life cycle rule to the repository.Life cycle rules automatically expire images from the repository that match certain conditions.
- Parameters:
rule- This parameter is required.
-
addToResourcePolicy
@Stability(Stable) @NotNull public AddToResourcePolicyResult addToResourcePolicy(@NotNull PolicyStatement statement) Add a policy statement to the repository's resource policy.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.
- Specified by:
addToResourcePolicyin interfaceIRepository- Specified by:
addToResourcePolicyin classRepositoryBase- Parameters:
statement- This parameter is required.
-
getRepositoryArn
The ARN of the repository.- Specified by:
getRepositoryArnin interfaceIRepository- Specified by:
getRepositoryArnin classRepositoryBase
-
getRepositoryName
The name of the repository.- Specified by:
getRepositoryNamein interfaceIRepository- Specified by:
getRepositoryNamein classRepositoryBase
-