Class ContainerRegistryAuthSupplier.Builder
- java.lang.Object
-
- org.mandas.docker.client.auth.gcr.ContainerRegistryAuthSupplier.Builder
-
- Enclosing class:
- ContainerRegistryAuthSupplier
public static class ContainerRegistryAuthSupplier.Builder extends Object
A Builder of ContainerRegistryAuthSupplier.The access tokens returned by the ContainerRegistryAuthSupplier are scoped to devstorage.read_write by default, these can be customized with
withScopes(Collection)
.The default value for the minimum expiry time of an access token is one minute. When the ContainerRegistryAuthSupplier is asked for a RegistryAuth, it will check if the existing AccessToken for the GoogleCredentials expires within this amount of time. If it does, then the AccessToken is refreshed before being returned.
-
-
Constructor Summary
Constructors Constructor Description Builder(com.google.auth.oauth2.GoogleCredentials credentials)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ContainerRegistryAuthSupplier
build()
ContainerRegistryAuthSupplier.Builder
withMinimumExpiry(long duration, TimeUnit timeUnit)
Changes the minimum expiry time used to refresh AccessTokens before they expire.ContainerRegistryAuthSupplier.Builder
withScopes(Collection<String> scopes)
Changes the scopes used in fetching AccessTokens.
-
-
-
Method Detail
-
withScopes
public ContainerRegistryAuthSupplier.Builder withScopes(Collection<String> scopes)
Changes the scopes used in fetching AccessTokens.The default is devstorage.read_write, which allows pulling and pushing of images. To allow the application using ContainerRegistryAuthSupplier to pull but not push images, change the scope to contain only devstorage.read_only. only
- Parameters:
scopes
- a list of scopes- Returns:
- this
-
withMinimumExpiry
public ContainerRegistryAuthSupplier.Builder withMinimumExpiry(long duration, TimeUnit timeUnit)
Changes the minimum expiry time used to refresh AccessTokens before they expire. The default value is one minute.- Parameters:
duration
- the expiry duration valuetimeUnit
- the expiry duration time unit- Returns:
- this
-
build
public ContainerRegistryAuthSupplier build()
-
-