azure.containerregistry package¶
-
class
azure.containerregistry.
ArtifactArchitecture
(value)[source]¶ An enumeration.
-
AMD64
= 'amd64'¶
-
ARM
= 'arm'¶
-
ARM64
= 'arm64'¶
-
I386
= '386'¶
-
MIPS
= 'mips'¶
-
MIPS64
= 'mips64'¶
-
MIPS64LE
= 'mips64le'¶
-
MIPSLE
= 'mipsle'¶
-
PPC64
= 'ppc64'¶
-
PPC64LE
= 'ppc64le'¶
-
RISCV64
= 'riscv64'¶
-
S390X
= 's390x'¶
-
WASM
= 'wasm'¶
-
-
class
azure.containerregistry.
ArtifactManifestOrder
(value)[source]¶ Sort options for ordering manifests in a collection.
-
LAST_UPDATED_ON_ASCENDING
= 'timeasc'¶ Order manifest by LastUpdatedOn field, from least recently updated to most recently updated.
-
LAST_UPDATED_ON_DESCENDING
= 'timedesc'¶ Order manifests by LastUpdatedOn field, from most recently updated to least recently updated.
-
NONE
= 'none'¶ Do not provide an orderby value in the request.
-
-
class
azure.containerregistry.
ArtifactManifestProperties
(**kwargs)[source]¶ Represents properties of a registry artifact.
- Variables
can_delete (bool) – Delete Permissions for an artifact.
can_write (bool) – Write Permissions for an artifact.
can_read (bool) – Read Permissions for an artifact.
can_list (bool) – List Permissions for an artifact.
architecture (ArtifactArchitecture) – CPU Architecture of an artifact.
created_on (datetime) – Time and date an artifact was created.
last_updated_on (datetime) – Time and date an artifact was last updated.
operating_system (ArtifactOperatingSystem) – Operating system for the artifact.
repository_name (str) – Repository name the artifact belongs to.
size_in_bytes (str) – Size of the artifact.
tags (List[str]) – Tags associated with a registry artifact.
-
property
architecture
¶
-
property
created_on
¶
-
property
digest
¶
-
property
fully_qualified_reference
¶
-
property
last_updated_on
¶
-
property
operating_system
¶
-
property
repository_name
¶
-
property
size_in_bytes
¶
-
class
azure.containerregistry.
ArtifactOperatingSystem
(value)[source]¶ An enumeration.
-
AIX
= 'aix'¶
-
ANDROID
= 'android'¶
-
DARWIN
= 'darwin'¶
-
DRAGONFLY
= 'dragonfly'¶
-
FREEBSD
= 'freebsd'¶
-
ILLUMOS
= 'illumos'¶
-
IOS
= 'ios'¶
-
JS
= 'js'¶
-
LINUX
= 'linux'¶
-
NETBSD
= 'netbsd'¶
-
OPENBSD
= 'openbsd'¶
-
PLAN9
= 'plan9'¶
-
SOLARIS
= 'solaris'¶
-
WINDOWS
= 'windows'¶
-
-
class
azure.containerregistry.
ArtifactTagOrder
(value)[source]¶ Sort options for ordering tags in a collection.
-
LAST_UPDATED_ON_ASCENDING
= 'timeasc'¶ Order tags by LastUpdatedOn field, from least recently updated to most recently updated.
-
LAST_UPDATED_ON_DESCENDING
= 'timedesc'¶ Order tags by LastUpdatedOn field, from most recently updated to least recently updated.
-
NONE
= 'none'¶ Do not provide an orderby value in the request.
-
-
class
azure.containerregistry.
ArtifactTagProperties
(**kwargs)[source]¶ Represents properties of a single tag
- Variables
can_delete (bool) – Delete Permissions for a tag.
can_write (bool) – Write Permissions for a tag.
can_read (bool) – Read Permissions for a tag.
can_list (bool) – List Permissions for a tag.
created_on (datetime) – Time the tag was created.
last_updated_on (datetime) – Time the tag was last updated.
repository (str) – Repository the tag belongs to.
-
property
created_on
¶
-
property
digest
¶
-
property
last_updated_on
¶
-
property
name
¶
-
property
repository_name
¶
-
class
azure.containerregistry.
ContainerRegistryClient
(endpoint: str, credential: Optional[TokenCredential] = None, **kwargs: Any)[source]¶ Create a ContainerRegistryClient from an ACR endpoint and a credential.
- Parameters
endpoint (str) – An ACR endpoint.
credential (TokenCredential) – The credential with which to authenticate.
- Keyword Arguments
api_version (str) – API Version. The default value is “2021-07-01”. Note that overriding this default value may result in unsupported behavior.
audience (str) – URL to use for credential authentication with AAD. Its value could be “https://management.azure.com”, “https://management.chinacloudapi.cn”, “https://management.microsoftazure.de” or “https://management.usgovcloudapi.net”.
- Returns
None
- Return type
- Raises
ValueError – If the provided api_version keyword-only argument isn’t supported or audience keyword-only argument isn’t provided.
Example:
audience = "https://management.azure.com" endpoint = os.environ["CONTAINERREGISTRY_ENDPOINT"] with ContainerRegistryClient(endpoint, DefaultAzureCredential(), audience=audience) as client:
-
close
() → None¶ Close sockets opened by the client. Calling this method is unnecessary when using the client as a context manager.
-
delete_blob
(repository: str, tag_or_digest: str, **kwargs: Any) → None[source]¶ Delete a blob. If the blob cannot be found or a response status code of 404 is returned an error will not be raised.
- Parameters
- Returns
None
- Raises
~azure.core.exceptions.HttpResponseError
Example
from azure.containerregistry import ContainerRegistryClient from azure.identity import DefaultAzureCredential endpoint = os.environ["CONTAINERREGISTRY_ENDPOINT"] client = ContainerRegistryClient(endpoint, DefaultAzureCredential(), audience="my_audience") client.delete_blob("my_repository", "my_tag_or_digest")
-
delete_manifest
(repository: str, tag_or_digest: str, **kwargs: Any) → None[source]¶ Delete a manifest. If the manifest cannot be found or a response status code of 404 is returned an error will not be raised.
- Parameters
- Returns
None
- Raises
~azure.core.exceptions.HttpResponseError
Example
from azure.containerregistry import ContainerRegistryClient from azure.identity import DefaultAzureCredential endpoint = os.environ["CONTAINERREGISTRY_ENDPOINT"] client = ContainerRegistryClient(endpoint, DefaultAzureCredential(), audience="my_audience") client.delete_manifest("my_repository", "my_tag_or_digest")
-
delete_repository
(repository: str, **kwargs: Any) → None[source]¶ Delete a repository. If the repository cannot be found or a response status code of 404 is returned an error will not be raised.
- Parameters
repository (str) – The repository to delete
- Returns
None
- Return type
- Raises
~azure.core.exceptions.HttpResponseError
Example:
client.delete_repository(repository_name, tag.name)
-
delete_tag
(repository: str, tag: str, **kwargs: Any) → None[source]¶ Delete a tag from a repository. If the tag cannot be found or a response status code of 404 is returned an error will not be raised.
- Parameters
- Returns
None
- Return type
- Raises
~azure.core.exceptions.HttpResponseError
Example
from azure.containerregistry import ContainerRegistryClient from azure.identity import DefaultAzureCredential endpoint = os.environ["CONTAINERREGISTRY_ENDPOINT"] client = ContainerRegistryClient(endpoint, DefaultAzureCredential(), audience="my_audience") for tag in client.list_tag_properties("my_repository"): client.delete_tag("my_repository", tag.name)
-
download_blob
(repository: str, digest: str, **kwargs: Any) → DownloadBlobResult | None[source]¶ Download a blob that is part of an artifact.
- Parameters
- Returns
DownloadBlobResult or None
- Return type
DownloadBlobResult or None
- Raises
ValueError – If the parameter repository or digest is None.
-
download_manifest
(repository: str, tag_or_digest: str, **kwargs: Any) → azure.containerregistry._models.DownloadManifestResult[source]¶ Download the manifest for an OCI artifact.
- Parameters
- Returns
DownloadManifestResult
- Return type
DownloadManifestResult
- Raises
ValueError – If the parameter repository or tag_or_digest is None.
HttpResponseError – If the requested digest does not match the digest of the received manifest.
-
get_manifest_properties
(repository: str, tag_or_digest: str, **kwargs: Any) → azure.containerregistry._models.ArtifactManifestProperties[source]¶ Get the properties of a registry artifact
- Parameters
- Return type
- Raises
~azure.core.exceptions.ResourceNotFoundError
Example
from azure.containerregistry import ContainerRegistryClient from azure.identity import DefaultAzureCredential endpoint = os.environ["CONTAINERREGISTRY_ENDPOINT"] client = ContainerRegistryClient(endpoint, DefaultAzureCredential(), audience="my_audience") for artifact in client.list_manifest_properties("my_repository"): properties = client.get_manifest_properties("my_repository", artifact.digest)
-
get_repository_properties
(repository: str, **kwargs: Any) → azure.containerregistry._models.RepositoryProperties[source]¶ Get the properties of a repository
- Parameters
repository (str) – Name of the repository
- Return type
- Raises
~azure.core.exceptions.ResourceNotFoundError
-
get_tag_properties
(repository: str, tag: str, **kwargs: Any) → azure.containerregistry._models.ArtifactTagProperties[source]¶ Get the properties for a tag
- Parameters
- Return type
- Raises
~azure.core.exceptions.ResourceNotFoundError
Example
from azure.containerregistry import ContainerRegistryClient from azure.identity import DefaultAzureCredential endpoint = os.environ["CONTAINERREGISTRY_ENDPOINT"] client = ContainerRegistryClient(endpoint, DefaultAzureCredential(), audience="my_audience") for tag in client.list_tag_properties("my_repository"): tag_properties = client.get_tag_properties("my_repository", tag.name)
-
list_manifest_properties
(repository: str, **kwargs: Any) → azure.core.paging.ItemPaged[azure.containerregistry._models.ArtifactManifestProperties][source]¶ List the artifacts for a repository
- Parameters
repository (str) – Name of the repository
- Keyword Arguments
order_by (ArtifactManifestOrder or str) – Query parameter for ordering by time ascending or descending
results_per_page (int) – Number of repositories to return per page
- Returns
An iterable of
ArtifactManifestProperties
- Return type
- Raises
~azure.core.exceptions.ResourceNotFoundError
-
list_repository_names
(**kwargs: Any) → azure.core.paging.ItemPaged[str][source]¶ List all repositories
- Keyword Arguments
results_per_page (int) – Number of repositories to return per page
- Returns
An iterable of strings
- Return type
- Raises
~azure.core.exceptions.HttpResponseError
Example:
audience = "https://management.azure.com" endpoint = os.environ["CONTAINERREGISTRY_ENDPOINT"] with ContainerRegistryClient(endpoint, DefaultAzureCredential(), audience=audience) as client: for repository in client.list_repository_names(): print(repository)
-
list_tag_properties
(repository: str, **kwargs: Any) → azure.core.paging.ItemPaged[azure.containerregistry._models.ArtifactTagProperties][source]¶ List the tags for a repository
- Parameters
repository (str) – Name of the repository
- Keyword Arguments
order_by (ArtifactTagOrder or str) – Query parameter for ordering by time ascending or descending
results_per_page (int) – Number of repositories to return per page
- Returns
An iterable of
ArtifactTagProperties
- Return type
- Raises
~azure.core.exceptions.ResourceNotFoundError
Example
from azure.containerregistry import ContainerRegistryClient from azure.identity import DefaultAzureCredential endpoint = os.environ["CONTAINERREGISTRY_ENDPOINT"] client = ContainerRegistryClient(endpoint, DefaultAzureCredential(), audience="my_audience") for tag in client.list_tag_properties("my_repository"): tag_properties = client.get_tag_properties("my_repository", tag.name)
-
update_manifest_properties
(repository, tag_or_digest, properties, **kwargs)[source]¶ -
update_manifest_properties
(repository, tag_or_digest, **kwargs) Set the permission properties for a manifest.
The updatable properties include: can_delete, can_list, can_read, and can_write.
- Parameters
repository (str) – Repository the manifest belongs to.
tag_or_digest (str) – Tag or digest of the manifest.
properties (ArtifactManifestProperties) – The property’s values to be set. This is a positional-only parameter. Please provide either this or individual keyword parameters.
- Keyword Arguments
- Return type
- Raises
~azure.core.exceptions.ResourceNotFoundError
Example
from azure.containerregistry import ContainerRegistryClient from azure.identity import DefaultAzureCredential endpoint = os.environ["CONTAINERREGISTRY_ENDPOINT"] client = ContainerRegistryClient(endpoint, DefaultAzureCredential(), audience="my_audience") for artifact in client.list_manifest_properties("my_repository"): received_properties = client.update_manifest_properties( "my_repository", artifact.digest, can_delete=False, can_list=False, can_read=False, can_write=False, )
-
update_repository_properties
(repository, properties, **kwargs)[source]¶ -
update_repository_properties
(repository, **kwargs) Set the permission properties of a repository.
The updatable properties include: can_delete, can_list, can_read, and can_write.
- Parameters
repository (str) – Name of the repository.
properties (RepositoryProperties) – Properties to set for the repository. This is a positional-only parameter. Please provide either this or individual keyword parameters.
- Keyword Arguments
- Return type
- Raises
~azure.core.exceptions.ResourceNotFoundError
-
update_tag_properties
(repository, tag, properties, **kwargs)[source]¶ -
update_tag_properties
(repository, tag, **kwargs) Set the permission properties for a tag.
The updatable properties include: can_delete, can_list, can_read, and can_write.
- Parameters
repository (str) – Repository the tag belongs to.
tag (str) – Tag to set properties for.
properties (ArtifactTagProperties) – The property’s values to be set. This is a positional-only parameter. Please provide either this or individual keyword parameters.
- Keyword Arguments
- Return type
- Raises
~azure.core.exceptions.ResourceNotFoundError
Example
from azure.containerregistry import ContainerRegistryClient from azure.identity import DefaultAzureCredential endpoint = os.environ["CONTAINERREGISTRY_ENDPOINT"] client = ContainerRegistryClient(endpoint, DefaultAzureCredential(), audience="my_audience") tag_identifier = "latest" received = client.update_tag_properties( "my_repository", tag_identifier, can_delete=False, can_list=False, can_read=False, can_write=False, )
-
upload_blob
(repository: str, data: IO, **kwargs: Any) → str[source]¶ Upload an artifact blob.
- Parameters
repository (str) – Name of the repository
data (IO) – The blob to upload. Note: This must be a seekable stream.
- Returns
The digest of the uploaded blob, calculated by the registry.
- Return type
- Raises
ValueError – If the parameter repository or data is None.
-
upload_manifest
(repository: str, manifest: Union[azure.containerregistry._generated.models._models_py3.OCIManifest, IO], *, tag: Optional[str] = None, **kwargs: Any) → str[source]¶ Upload a manifest for an OCI artifact.
- Parameters
repository (str) – Name of the repository
manifest (OCIManifest or IO) – The manifest to upload. Note: This must be a seekable stream.
- Keyword Arguments
- Returns
The digest of the uploaded manifest, calculated by the registry.
- Return type
- Raises
ValueError – If the parameter repository or manifest is None.
HttpResponseError – If the digest in the response does not match the digest of the uploaded manifest.
-
class
azure.containerregistry.
RepositoryProperties
(**kwargs)[source]¶ Represents properties of a single repository.
- Variables
can_delete (bool) – Delete Permissions for a repository.
can_write (bool) – Write Permissions for a repository.
can_read (bool) – Read Permissions for a repository.
can_list (bool) – List Permissions for a repository.
created_on (datetime) – Time the repository was created
last_updated_on (datetime) – Time the repository was last updated.
manifest_count (int) – Number of manifest in the repository.
tag_count (int) – Number of tags associated with the repository.
-
property
created_on
¶
-
property
last_updated_on
¶
-
property
manifest_count
¶
-
property
name
¶
-
property
tag_count
¶