@Generated(value="jsii-pacmak/1.58.0 (build f8ba112)",
date="2022-05-13T01:13:40.838Z")
public abstract class DockerCredential
extends software.amazon.jsii.JsiiObject
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();
Modifier | Constructor and Description |
---|---|
protected |
DockerCredential() |
protected |
DockerCredential(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) |
protected |
DockerCredential(software.amazon.jsii.JsiiObjectRef objRef) |
Modifier and Type | Method and Description |
---|---|
static DockerCredential |
customRegistry(java.lang.String registryDomain,
ISecret secret)
Creates a DockerCredential for a registry, based on its domain name (e.g., 'www.example.com').
|
static DockerCredential |
customRegistry(java.lang.String registryDomain,
ISecret secret,
ExternalDockerCredentialOptions opts)
Creates a DockerCredential for a registry, based on its domain name (e.g., 'www.example.com').
|
static DockerCredential |
dockerHub(ISecret secret)
Creates a DockerCredential for DockerHub.
|
static DockerCredential |
dockerHub(ISecret secret,
ExternalDockerCredentialOptions opts)
Creates a DockerCredential for DockerHub.
|
static DockerCredential |
ecr(java.util.List<? extends IRepository> repositories)
Creates a DockerCredential for one or more ECR repositories.
|
static DockerCredential |
ecr(java.util.List<? extends IRepository> repositories,
EcrDockerCredentialOptions opts)
Creates a DockerCredential for one or more ECR repositories.
|
protected java.util.List<DockerCredentialUsage> |
getUsages() |
abstract void |
grantRead(IGrantable grantee,
DockerCredentialUsage usage)
Grant read-only access to the registry credentials.
|
protected DockerCredential(software.amazon.jsii.JsiiObjectRef objRef)
protected DockerCredential(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
protected DockerCredential()
public static DockerCredential customRegistry(java.lang.String registryDomain, ISecret secret, ExternalDockerCredentialOptions opts)
registryDomain
- This parameter is required.secret
- This parameter is required.opts
- public static DockerCredential customRegistry(java.lang.String registryDomain, ISecret secret)
registryDomain
- This parameter is required.secret
- This parameter is required.public static DockerCredential dockerHub(ISecret secret, ExternalDockerCredentialOptions opts)
Convenience method for customRegistry('https://index.docker.io/v1/', opts)
.
secret
- This parameter is required.opts
- public static DockerCredential dockerHub(ISecret secret)
Convenience method for customRegistry('https://index.docker.io/v1/', opts)
.
secret
- This parameter is required.public static DockerCredential ecr(java.util.List<? extends IRepository> repositories, EcrDockerCredentialOptions opts)
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.
repositories
- This parameter is required.opts
- public static DockerCredential ecr(java.util.List<? extends IRepository> 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.
repositories
- This parameter is required.public abstract void grantRead(IGrantable grantee, DockerCredentialUsage usage)
This grants read access to any secrets, and pull access to any repositories.
grantee
- This parameter is required.usage
- This parameter is required.protected java.util.List<DockerCredentialUsage> getUsages()