Class ContainerRegistryAuthSupplier.Builder
java.lang.Object
org.mandas.docker.client.auth.gcr.ContainerRegistryAuthSupplier.Builder
- Enclosing class:
- ContainerRegistryAuthSupplier
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 -
Method Summary
Modifier and TypeMethodDescriptionbuild()withMinimumExpiry(long duration, TimeUnit timeUnit) Changes the minimum expiry time used to refresh AccessTokens before they expire.withScopes(Collection<String> scopes) Changes the scopes used in fetching AccessTokens.
-
Constructor Details
-
Builder
public Builder(com.google.auth.oauth2.GoogleCredentials credentials)
-
-
Method Details
-
withScopes
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
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
-