DockerSdk
the .NET SDK for Docker
Public Member Functions | Properties | List of all members
DockerSdk.Registries.RegistryAccess Class Reference

Caches credentials for Docker registries and provides a means to check the credentials against the registry. More...

Public Member Functions

void AddAnonymous (string registry)
 Specifies that you want to use anonymous access to the indicated registry. More...
 
void AddAnonymous (RegistryReference registry)
 Specifies that you want to use anonymous access to the indicated registry. More...
 
void AddBasicAuth (string registry, string username, string password)
 Specifies that you want to use basic authentication for access to the indicated registry. More...
 
void AddBasicAuth (RegistryReference registry, string username, string password)
 Specifies that you want to use basic authentication for access to the indicated registry. More...
 
void AddIdentityToken (string registry, string identityToken)
 Specifies that you want to use an identity token for authenticating with the indicated registry. More...
 
void AddIdentityToken (RegistryReference registry, string identityToken)
 Specifies that you want to use an identity token for authenticating with the indicated registry. More...
 
Task< bool > CheckAuthenticationAsync (string registry, CancellationToken ct=default)
 Tests whether the client can authenticate with the indicated registry. More...
 
async Task< bool > CheckAuthenticationAsync (RegistryReference registry, CancellationToken ct=default)
 Tests whether the client can authenticate with the indicated registry. More...
 
void Clear ()
 Removes all custom registry entries. More...
 
RegistryReference GetRegistryName (string imageName)
 Parses an image's name to determine which registry the image is associated with. More...
 
bool Remove (string registry)
 Removes an entry from the cache. More...
 
bool Remove (RegistryReference registry)
 Removes an entry from the cache. More...
 

Properties

IEnumerable< RegistryReferenceRegistries [get]
 Gets the Docker registries that have cache entries. More...
 

Detailed Description

Caches credentials for Docker registries and provides a means to check the credentials against the registry.

Member Function Documentation

◆ AddAnonymous() [1/2]

void DockerSdk.Registries.RegistryAccess.AddAnonymous ( RegistryReference  registry)
inline

Specifies that you want to use anonymous access to the indicated registry.

Parameters
registryThe name of the registry, as used in image names.
Exceptions
ArgumentExceptionThe input is null or empty.

◆ AddAnonymous() [2/2]

void DockerSdk.Registries.RegistryAccess.AddAnonymous ( string  registry)

Specifies that you want to use anonymous access to the indicated registry.

Parameters
registryThe name of the registry, as used in image names.
Exceptions
ArgumentExceptionThe input is null or empty.
MalformedReferenceExceptionThe input is not a well-formed registry access reference.

◆ AddBasicAuth() [1/2]

void DockerSdk.Registries.RegistryAccess.AddBasicAuth ( RegistryReference  registry,
string  username,
string  password 
)
inline

Specifies that you want to use basic authentication for access to the indicated registry.

Parameters
registryThe name of the registry, as used in image names.
usernameThe username to use for the registry.
passwordThe password to use for the registry.
Exceptions
ArgumentExceptionOne or more of the inputs are null or the empty string.

◆ AddBasicAuth() [2/2]

void DockerSdk.Registries.RegistryAccess.AddBasicAuth ( string  registry,
string  username,
string  password 
)

Specifies that you want to use basic authentication for access to the indicated registry.

Parameters
registryThe name of the registry, as used in image names.
usernameThe username to use for the registry.
passwordThe password to use for the registry.
Exceptions
ArgumentExceptionThe input is null or empty.
MalformedReferenceExceptionThe input is not a well-formed registry access reference.

◆ AddIdentityToken() [1/2]

void DockerSdk.Registries.RegistryAccess.AddIdentityToken ( RegistryReference  registry,
string  identityToken 
)
inline

Specifies that you want to use an identity token for authenticating with the indicated registry.

Parameters
registryThe name of the registry, as used in image names.
identityTokenAn identity token granted by the registry.
Exceptions
ArgumentExceptionOne or more of the inputs are null or the empty string.

◆ AddIdentityToken() [2/2]

void DockerSdk.Registries.RegistryAccess.AddIdentityToken ( string  registry,
string  identityToken 
)

Specifies that you want to use an identity token for authenticating with the indicated registry.

Parameters
registryThe name of the registry, as used in image names.
identityTokenAn identity token granted by the registry.
Exceptions
ArgumentExceptionOne or more of the inputs are null or the empty string.
MalformedReferenceExceptionThe input is not a well-formed registry access reference.

◆ CheckAuthenticationAsync() [1/2]

async Task<bool> DockerSdk.Registries.RegistryAccess.CheckAuthenticationAsync ( RegistryReference  registry,
CancellationToken  ct = default 
)
inline

Tests whether the client can authenticate with the indicated registry.

Parameters
registry
ct
Returns

Use the various Add* methods to supply authentication instructions. If no such instructions are provided, this method will try anonymous access.

Exceptions
ArgumentExceptionThe input is null or empty.
System.Net.Http.HttpRequestExceptionThe request failed due to an underlying issue such as network connectivity, DNS failure, server certificate validation, or timeout.

◆ CheckAuthenticationAsync() [2/2]

Task<bool> DockerSdk.Registries.RegistryAccess.CheckAuthenticationAsync ( string  registry,
CancellationToken  ct = default 
)

Tests whether the client can authenticate with the indicated registry.

Parameters
registry
ct
Returns

Use the various Add* methods to supply authentication instructions. If no such instructions are provided, this method will try anonymous access.

Exceptions
ArgumentExceptionThe input is null or empty.
MalformedReferenceExceptionThe input is not a well-formed registry access reference.
System.Net.Http.HttpRequestExceptionThe request failed due to an underlying issue such as network connectivity, DNS failure, server certificate validation, or timeout.

◆ Clear()

void DockerSdk.Registries.RegistryAccess.Clear ( )
inline

Removes all custom registry entries.

◆ GetRegistryName()

RegistryReference DockerSdk.Registries.RegistryAccess.GetRegistryName ( string  imageName)

Parses an image's name to determine which registry the image is associated with.

Parameters
imageNameThe name of image. (Not the ID.)
Returns
A reference to the registry.
Exceptions
ArgumentExceptionimageName is null or empty.
MalformedReferenceExceptionThe input could not be parsed as an image name.

◆ Remove() [1/2]

bool DockerSdk.Registries.RegistryAccess.Remove ( RegistryReference  registry)

Removes an entry from the cache.

Parameters
registryThe host name of the registry to remove.
Returns
True if the entry was removed, or false if the entry was not present.

This method is equivalent to docker logout.

Exceptions
ArgumentExceptionThe input is null.

◆ Remove() [2/2]

bool DockerSdk.Registries.RegistryAccess.Remove ( string  registry)

Removes an entry from the cache.

Parameters
registryThe host name of the registry to remove.
Returns
True if the entry was removed, or false if the entry was not present.

This method is equivalent to docker logout.

Exceptions
ArgumentExceptionThe input is null or empty.

Property Documentation

◆ Registries

IEnumerable<RegistryReference> DockerSdk.Registries.RegistryAccess.Registries
get

Gets the Docker registries that have cache entries.


The documentation for this class was generated from the following file: