Package land.oras
Class Registry.Builder
java.lang.Object
land.oras.Registry.Builder
- Enclosing class:
- Registry
Builder for the registry
-
Method Summary
Modifier and TypeMethodDescriptionbuild()Build the registrystatic Registry.Builderbuilder()Return a new builderdefaults()Return a new builder with default authentication using existing host authReturn a new builder with default authentication using existing host auth and registry urlSet username and password authenticationSet username and password authenticationReturn a new builder with the same configuration as the given registryinsecure()Set insecure communication and no authentificationSet insecure communication and no authentificationReturn a new insecure builder with username and password authenticationwithAuthProvider(AuthProvider authProvider) Set the auth providerwithAuthToken(String authToken) Use given auth token for the registry.withCaContent(String caContent) Set the CA certificates from PEM-encoded contentwithCaFile(String caFilePath) Set the CA file for TLS verificationwithCaFile(Path caFilePath) Set the CA file for TLS verificationwithExecutorService(ExecutorService executorService) Set the executor service to use for parallel uploads/downloads.withInsecure(boolean insecure) Set the insecure flagwithMaxRetries(int maxRetries) Set the maximum number of attempts for retryable requests (default: 3).withMaxRetryDelay(long maxRetryDelayMs) Set the upper bound on retry delay in milliseconds (default: 30 000).withMeterRegistry(io.micrometer.core.instrument.MeterRegistry meterRegistry) Set the meter registry for metrics.withParallelism(int parallelism) Set the maximum number of concurrent downloads when pulling an artifact with multiple layers.withPolicy(Path policyPath) Load and set the containers trust policy from the given path.withPolicy(ContainersPolicy policy) Set the containers trust policy to enforce during pull operations.withReferrerListMaxPages(int referrerListMaxPages) Set the maximum number of pages fetched during a full referrer listing (0 = unlimited).withRegistry(String registry) Set the registry URLwithRetryDelay(long retryDelayMs) Set the initial delay before the first retry in milliseconds (default: 500).withSkipTlsVerify(boolean skipTlsVerify) Set the skip TLS verify flagwithTagListMaxPages(int tagListMaxPages) Set the maximum number of pages fetched during a full tag listing (0 = unlimited, not recommanded).
-
Method Details
-
defaults
Return a new builder with default authentication using existing host auth- Returns:
- The builder
-
defaults
Return a new builder with default authentication using existing host auth and registry url- Parameters:
registry- The registry URL (ex: localhost:5000)- Returns:
- The builder
-
from
Return a new builder with the same configuration as the given registry- Parameters:
registry- The registry to copy the configuration from- Returns:
- The builder
-
defaults
Set username and password authentication- Parameters:
username- The usernamepassword- The password- Returns:
- The builder
-
defaults
Set username and password authentication- Parameters:
registry- The registry URL (ex: localhost:5000)username- The usernamepassword- The password- Returns:
- The builder
-
insecure
Set insecure communication and no authentification- Returns:
- The builder
-
insecure
Set insecure communication and no authentification- Parameters:
registry- The registry (ex: localhost:5000)- Returns:
- The builder
-
insecure
Return a new insecure builder with username and password authentication- Parameters:
registry- The registry (ex: localhost:5000)username- The usernamepassword- The password- Returns:
- The builder
-
withRegistry
Set the registry URL- Parameters:
registry- The registry URL- Returns:
- The builder
-
withAuthProvider
Set the auth provider- Parameters:
authProvider- The auth provider- Returns:
- The builder
-
withAuthToken
Use given auth token for the registry. Useful when the auth token is obtained by other mean (like a token exchange). Caller are responsible to handle token expiration if any- Parameters:
authToken- The auth token- Returns:
- The builder
-
withParallelism
Set the maximum number of concurrent downloads when pulling an artifact with multiple layers. Default is 4.- Parameters:
parallelism- The maximum number of parallel uploads/download- Returns:
- The builder
-
withExecutorService
Set the executor service to use for parallel uploads/downloads. By default it uses a parallelism level given by withParallelism() and a fixed thread pool. Only uses for layers upload/download, not for manifest or index upload/download.- Parameters:
executorService- The executor service- Returns:
- The builder
-
withInsecure
Set the insecure flag- Parameters:
insecure- Insecure- Returns:
- The builder
-
withSkipTlsVerify
Set the skip TLS verify flag- Parameters:
skipTlsVerify- Skip TLS verify- Returns:
- The builder
-
withCaFile
Set the CA file for TLS verification- Parameters:
caFilePath- The path to a PEM-encoded CA certificate or bundle- Returns:
- The builder
-
withCaFile
Set the CA file for TLS verification- Parameters:
caFilePath- The path to a PEM-encoded CA certificate or bundle- Returns:
- The builder
-
withCaContent
Set the CA certificates from PEM-encoded content- Parameters:
caContent- The PEM-encoded CA certificate or bundle content- Returns:
- The builder
-
withMeterRegistry
public Registry.Builder withMeterRegistry(io.micrometer.core.instrument.MeterRegistry meterRegistry) Set the meter registry for metrics. Following Micrometer best practices for libraries, aSimpleMeterRegistryis used by default when no registry is provided.- Parameters:
meterRegistry- The meter registry- Returns:
- The builder
-
withMaxRetries
Set the maximum number of attempts for retryable requests (default: 3). A value of 1 disables retries entirely. Retryable conditions: HTTP 429, HTTP 5xx, network errors (IOException / timeout). Token-refresh requests are never retried regardless of this setting.- Parameters:
maxRetries- Maximum attempts (must be >= 1)- Returns:
- The builder
-
withRetryDelay
Set the initial delay before the first retry in milliseconds (default: 500). Subsequent delays are doubled up to the limit set bywithMaxRetryDelay(long).- Parameters:
retryDelayMs- Initial delay in milliseconds (must be >= 0)- Returns:
- The builder
-
withMaxRetryDelay
Set the upper bound on retry delay in milliseconds (default: 30 000).- Parameters:
maxRetryDelayMs- Maximum delay cap in milliseconds (must be >= 0)- Returns:
- The builder
-
withTagListMaxPages
Set the maximum number of pages fetched during a full tag listing (0 = unlimited, not recommanded).- Parameters:
tagListMaxPages- maximum number of pages (0 means unlimited)- Returns:
- The builder
-
withReferrerListMaxPages
Set the maximum number of pages fetched during a full referrer listing (0 = unlimited).- Parameters:
referrerListMaxPages- maximum number of pages (0 means unlimited)- Returns:
- The builder
-
withPolicy
Set the containers trust policy to enforce during pull operations.When set, all image manifest pulls will be evaluated against the policy before being returned. The
insecureAcceptAnything,reject, andsigstoreSigned(keyed verification of attached Sigstore bundles) requirements are enforced. ThesignedBy(GPG simple signing) requirement is not implemented and will log a warning and accept the image without verification.By default, the policy is loaded from standard locations (
$HOME/.config/containers/policy.jsonor/etc/containers/policy.json). If no policy file is found, an accept-all policy is used.- Parameters:
policy- the containers policy to enforce.- Returns:
- the builder
- See Also:
-
withPolicy
Load and set the containers trust policy from the given path.- Parameters:
policyPath- the path to the policy.json file.- Returns:
- the builder
- Throws:
OrasException- if the file cannot be read or parsed.- See Also:
-
builder
Return a new builder- Returns:
- The builder
-
build
Build the registry- Returns:
- The registry
-