Package ai.clarity.codeartifact
Class CodeArtifactCredentials
java.lang.Object
ai.clarity.codeartifact.CodeArtifactCredentials
Static AWS credentials of a service account, used to request the CodeArtifact authorization token without relying on
a local AWS profile.
A session token can be supplied for temporary credentials, and must be omitted for the long lived access keys of an IAM user.
-
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns the access key id in clear.The access key id with its middle section hidden, safe to write to the build log.inthashCode()static CodeArtifactCredentialsBuilds the long-lived credentials of an IAM user.static CodeArtifactCredentialsBuilds the credentials of an IAM user, or the temporary ones of an assumed role when a session token is given.static CodeArtifactCredentialsBuilds the credentials from a map, which is the shape the Groovy DSL passes them in, as incodeartifact(url, [accessKeyId: '...', secretAccessKey: '...']).toString()Redacted on purpose: these credentials end up in build logs and in Gradle error messages.
-
Method Details
-
of
Builds the long-lived credentials of an IAM user.- Parameters:
accessKeyId- the access key id, requiredsecretAccessKey- the secret access key, required- Returns:
- the credentials
- Throws:
IllegalArgumentException- when either value is missing or blank
-
of
public static CodeArtifactCredentials of(String accessKeyId, String secretAccessKey, String sessionToken) Builds the credentials of an IAM user, or the temporary ones of an assumed role when a session token is given.- Parameters:
accessKeyId- the access key id, requiredsecretAccessKey- the secret access key, requiredsessionToken- the session token of temporary credentials, ornullfor long-lived ones- Returns:
- the credentials
- Throws:
IllegalArgumentException- when the access key id or the secret access key is missing or blank
-
of
Builds the credentials from a map, which is the shape the Groovy DSL passes them in, as incodeartifact(url, [accessKeyId: '...', secretAccessKey: '...']).- Parameters:
values- the credentials keyed byaccessKeyId,secretAccessKeyand, optionally,sessionToken- Returns:
- the credentials
- Throws:
IllegalArgumentException- when the map carries an unsupported key, or the access key id or the secret access key is missing or blank
-
getAccessKeyId
Returns the access key id in clear. UsegetMaskedAccessKeyId()for anything that reaches a log.- Returns:
- the access key id
-
getMaskedAccessKeyId
The access key id with its middle section hidden, safe to write to the build log.- Returns:
- the access key id with all but its first and last four characters replaced by asterisks, or fully masked when it is eight characters or shorter
-
equals
-
hashCode
public int hashCode() -
toString
Redacted on purpose: these credentials end up in build logs and in Gradle error messages.
-