Class DockerCredential
- All Implemented Interfaces:
software.amazon.jsii.JsiiSerializable
Example:
ISecret dockerHubSecret = Secret.fromSecretCompleteArn(this, "DHSecret", "arn:aws:..."); ISecret customRegSecret = Secret.fromSecretCompleteArn(this, "CRSecret", "arn:aws:..."); IRepository repo1 = Repository.fromRepositoryArn(this, "Repo", "arn:aws:ecr:eu-west-1:0123456789012:repository/Repo1"); IRepository repo2 = Repository.fromRepositoryArn(this, "Repo", "arn:aws:ecr:eu-west-1:0123456789012:repository/Repo2"); CodePipeline pipeline = CodePipeline.Builder.create(this, "Pipeline") .dockerCredentials(List.of(DockerCredential.dockerHub(dockerHubSecret), DockerCredential.customRegistry("dockerregistry.example.com", customRegSecret), DockerCredential.ecr(List.of(repo1, repo2)))) .synth(ShellStep.Builder.create("Synth") .input(CodePipelineSource.connection("my-org/my-app", "main", ConnectionSourceOptions.builder() .connectionArn("arn:aws:codestar-connections:us-east-1:222222222222:connection/7d2469ff-514a-4e4f-9003-5ca4a43cdc41") .build())) .commands(List.of("npm ci", "npm run build", "npx cdk synth")) .build()) .build();
-
Nested Class Summary
Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationMode
-
Constructor Summary
ModifierConstructorDescriptionprotected
protected
DockerCredential
(List<DockerCredentialUsage> usages) protected
DockerCredential
(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protected
DockerCredential
(software.amazon.jsii.JsiiObjectRef objRef) -
Method Summary
Modifier and TypeMethodDescriptionstatic DockerCredential
customRegistry
(String registryDomain, ISecret secret) Creates a DockerCredential for a registry, based on its domain name (e.g., 'www.example.com').static DockerCredential
customRegistry
(String registryDomain, ISecret secret, ExternalDockerCredentialOptions opts) Creates a DockerCredential for a registry, based on its domain name (e.g., 'www.example.com').static DockerCredential
Creates a DockerCredential for DockerHub.static DockerCredential
dockerHub
(ISecret secret, ExternalDockerCredentialOptions opts) Creates a DockerCredential for DockerHub.static DockerCredential
ecr
(List<? extends IRepository> repositories) Creates a DockerCredential for one or more ECR repositories.static DockerCredential
ecr
(List<? extends IRepository> repositories, EcrDockerCredentialOptions opts) Creates a DockerCredential for one or more ECR repositories.protected List<DockerCredentialUsage>
abstract void
grantRead
(IGrantable grantee, DockerCredentialUsage usage) Grant read-only access to the registry credentials.Methods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSet
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Constructor Details
-
DockerCredential
protected DockerCredential(software.amazon.jsii.JsiiObjectRef objRef) -
DockerCredential
protected DockerCredential(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
DockerCredential
- Parameters:
usages
-
-
DockerCredential
@Stability(Stable) protected DockerCredential()
-
-
Method Details
-
customRegistry
@Stability(Stable) @NotNull public static DockerCredential customRegistry(@NotNull String registryDomain, @NotNull ISecret secret, @Nullable ExternalDockerCredentialOptions opts) Creates a DockerCredential for a registry, based on its domain name (e.g., 'www.example.com').- Parameters:
registryDomain
- This parameter is required.secret
- This parameter is required.opts
-
-
customRegistry
@Stability(Stable) @NotNull public static DockerCredential customRegistry(@NotNull String registryDomain, @NotNull ISecret secret) Creates a DockerCredential for a registry, based on its domain name (e.g., 'www.example.com').- Parameters:
registryDomain
- This parameter is required.secret
- This parameter is required.
-
dockerHub
@Stability(Stable) @NotNull public static DockerCredential dockerHub(@NotNull ISecret secret, @Nullable ExternalDockerCredentialOptions opts) Creates a DockerCredential for DockerHub.Convenience method for
customRegistry('https://index.docker.io/v1/', opts)
.- Parameters:
secret
- This parameter is required.opts
-
-
dockerHub
Creates a DockerCredential for DockerHub.Convenience method for
customRegistry('https://index.docker.io/v1/', opts)
.- Parameters:
secret
- This parameter is required.
-
ecr
@Stability(Stable) @NotNull public static DockerCredential ecr(@NotNull List<? extends IRepository> repositories, @Nullable EcrDockerCredentialOptions opts) Creates a DockerCredential for one or more ECR repositories.NOTE - All ECR repositories in the same account and region share a domain name (e.g., 0123456789012.dkr.ecr.eu-west-1.amazonaws.com), and can only have one associated set of credentials (and DockerCredential). Attempting to associate one set of credentials with one ECR repo and another with another ECR repo in the same account and region will result in failures when using these credentials in the pipeline.
- Parameters:
repositories
- This parameter is required.opts
-
-
ecr
@Stability(Stable) @NotNull public static DockerCredential ecr(@NotNull List<? extends IRepository> repositories) Creates a DockerCredential for one or more ECR repositories.NOTE - All ECR repositories in the same account and region share a domain name (e.g., 0123456789012.dkr.ecr.eu-west-1.amazonaws.com), and can only have one associated set of credentials (and DockerCredential). Attempting to associate one set of credentials with one ECR repo and another with another ECR repo in the same account and region will result in failures when using these credentials in the pipeline.
- Parameters:
repositories
- This parameter is required.
-
grantRead
@Stability(Stable) public abstract void grantRead(@NotNull IGrantable grantee, @NotNull DockerCredentialUsage usage) Grant read-only access to the registry credentials.This grants read access to any secrets, and pull access to any repositories.
- Parameters:
grantee
- This parameter is required.usage
- This parameter is required.
-
getUsages
-