Package ai.clarity.codeartifact
Class CodeArtifactToken
java.lang.Object
ai.clarity.codeartifact.CodeArtifactToken
- All Implemented Interfaces:
org.gradle.api.services.BuildService<org.gradle.api.services.BuildServiceParameters.None>
public class CodeArtifactToken
extends Object
implements org.gradle.api.services.BuildService<org.gradle.api.services.BuildServiceParameters.None>
Build service that fetches CodeArtifact authorization tokens and shares them across the whole build.
A token is requested once per authentication and repository url, and reused from an in-memory cache afterwards. Profile entries and service-credential entries never share a cache slot, and the credentials half of the key is a digest, so no secret is held in clear.
Gradle instantiates it through sharedServices.registerIfAbsent; there is no reason to construct one
directly.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.gradle.api.services.BuildServiceParameters.NonegetToken(String uri, CodeArtifactCredentials credentials) Returns the authorization token foruri, authenticating with the static credentials of a service account.Returns the authorization token foruri, authenticating with an AWS profile.getToken(URI uri, CodeArtifactCredentials credentials) Returns the authorization token foruri, authenticating with the static credentials of a service account.Returns the authorization token foruri, authenticating with an AWS profile.
-
Constructor Details
-
CodeArtifactToken
public CodeArtifactToken()Creates the service. Called by Gradle, which owns the single instance registered for the build.
-
-
Method Details
-
getToken
Returns the authorization token foruri, authenticating with an AWS profile.- Parameters:
uri- the CodeArtifact repository urlprofile- the AWS profile to authenticate with, ornullto let the AWS SDK resolve the credentials- Returns:
- the authorization token, from the cache when this authentication and url were already resolved
- Throws:
MalformedURLException- whenuriis not a valid CodeArtifact repository url
-
getToken
Returns the authorization token foruri, authenticating with an AWS profile.- Parameters:
uri- the CodeArtifact repository urlprofile- the AWS profile to authenticate with, ornullto let the AWS SDK resolve the credentials- Returns:
- the authorization token, from the cache when this authentication and url were already resolved
- Throws:
MalformedURLException- whenuriis not a valid CodeArtifact repository url
-
getToken
Returns the authorization token foruri, authenticating with the static credentials of a service account.- Parameters:
uri- the CodeArtifact repository urlcredentials- the service account credentials to authenticate with- Returns:
- the authorization token, from the cache when this authentication and url were already resolved
- Throws:
MalformedURLException- whenuriis not a valid CodeArtifact repository url
-
getToken
public String getToken(String uri, CodeArtifactCredentials credentials) throws MalformedURLException Returns the authorization token foruri, authenticating with the static credentials of a service account.- Parameters:
uri- the CodeArtifact repository urlcredentials- the service account credentials to authenticate with- Returns:
- the authorization token, from the cache when this authentication and url were already resolved
- Throws:
MalformedURLException- whenuriis not a valid CodeArtifact repository url
-
getParameters
public org.gradle.api.services.BuildServiceParameters.None getParameters()The service takes no parameters.
- Specified by:
getParametersin interfaceorg.gradle.api.services.BuildService<org.gradle.api.services.BuildServiceParameters.None>
-