diff --git a/sdk/containerregistry/azure-containerregistry/azure/containerregistry/__init__.py b/sdk/containerregistry/azure-containerregistry/azure/containerregistry/__init__.py index d9f97e737ef0..1475e779c47b 100644 --- a/sdk/containerregistry/azure-containerregistry/azure/containerregistry/__init__.py +++ b/sdk/containerregistry/azure-containerregistry/azure/containerregistry/__init__.py @@ -9,8 +9,10 @@ from ._container_registry_client import ContainerRegistryClient from ._container_repository import ContainerRepository from ._models import ( - DeleteRepositoryResult, + ArtifactArchitecture, + ArtifactOperatingSystem, ContentProperties, + DeleteRepositoryResult, ManifestOrder, ArtifactManifestProperties, RepositoryProperties, @@ -23,6 +25,8 @@ __version__ = VERSION __all__ = [ + "ArtifactArchitecture", + "ArtifactOperatingSystem", "ContainerRegistryClient", "ContainerRepository", "ContentProperties", diff --git a/sdk/containerregistry/azure-containerregistry/azure/containerregistry/_container_registry_client.py b/sdk/containerregistry/azure-containerregistry/azure/containerregistry/_container_registry_client.py index f1caefa5e696..0fe150565f64 100644 --- a/sdk/containerregistry/azure-containerregistry/azure/containerregistry/_container_registry_client.py +++ b/sdk/containerregistry/azure-containerregistry/azure/containerregistry/_container_registry_client.py @@ -31,7 +31,6 @@ class ContainerRegistryClient(ContainerRegistryBaseClient): def __init__(self, endpoint, credential, **kwargs): # type: (str, TokenCredential, Dict[str, Any]) -> None """Create a ContainerRegistryClient from an ACR endpoint and a credential - :param str endpoint: An ACR endpoint :param credential: The credential with which to authenticate :type credential: :class:`~azure.core.credentials.TokenCredential` @@ -80,7 +79,6 @@ def delete_repository(self, repository_name, **kwargs): def list_repository_names(self, **kwargs): # type: (Dict[str, Any]) -> ItemPaged[str] """List all repositories - :keyword max: Maximum number of repositories to return :paramtype max: int :keyword last: Query parameter for the last item in the previous call. Ensuing @@ -95,8 +93,8 @@ def list_repository_names(self, **kwargs): .. admonition:: Example: .. literalinclude:: ../samples/sample_delete_old_tags.py - :start-after: [START list_repositories] - :end-before: [END list_repositories] + :start-after: [START list_repository_names] + :end-before: [END list_repository_names] :language: python :dedent: 8 :caption: List repositories in a container registry account @@ -204,13 +202,11 @@ def get_repository(self, repository_name, **kwargs): Example .. code-block:: python - from azure.containerregistry import ContainerRepositoryClient from azure.identity import DefaultAzureCredential - account_url = os.environ["CONTAINERREGISTRY_ENDPOINT"] client = ContainerRegistryClient(account_url, DefaultAzureCredential()) - repository_client = client.get_repository_client("my_repository") + repository_client = client.get_repository("my_repository") """ _pipeline = Pipeline( transport=TransportWrapper(self._client._client._pipeline._transport), # pylint: disable=protected-access diff --git a/sdk/containerregistry/azure-containerregistry/azure/containerregistry/_container_repository.py b/sdk/containerregistry/azure-containerregistry/azure/containerregistry/_container_repository.py index 8f2adfb1d5cd..11f75eae4e02 100644 --- a/sdk/containerregistry/azure-containerregistry/azure/containerregistry/_container_repository.py +++ b/sdk/containerregistry/azure-containerregistry/azure/containerregistry/_container_repository.py @@ -86,7 +86,7 @@ def list_manifests(self, **kwargs): call will return values after last lexically :paramtype last: str :keyword order_by: Query parameter for ordering by time ascending or descending - :paramtype order_by: :class:`~azure.containerregistry.ManifestOrder` + :paramtype order_by: :class:`~azure.containerregistry.ManifestOrder` or str :keyword results_per_page: Number of repositories to return per page :paramtype results_per_page: int :return: ItemPaged[:class:`ArtifactManifestProperties`] @@ -206,7 +206,9 @@ def set_properties(self, properties, **kwargs): """ return RepositoryProperties._from_generated( # pylint: disable=protected-access self._client.container_registry.set_properties( - self.name, properties._to_generated(), **kwargs # pylint: disable=protected-access + self.name, + properties._to_generated(), # pylint: disable=protected-access + **kwargs ) ) diff --git a/sdk/containerregistry/azure-containerregistry/azure/containerregistry/_models.py b/sdk/containerregistry/azure-containerregistry/azure/containerregistry/_models.py index 61716a694ec1..f0907c3018d7 100644 --- a/sdk/containerregistry/azure-containerregistry/azure/containerregistry/_models.py +++ b/sdk/containerregistry/azure-containerregistry/azure/containerregistry/_models.py @@ -6,8 +6,9 @@ from enum import Enum from typing import TYPE_CHECKING, Dict, Any -from ._generated.models import ContentProperties as GeneratedContentProperties + from ._generated.models import RepositoryProperties as GeneratedRepositoryProperties +from ._generated.models import ContentProperties as GeneratedContentProperties if TYPE_CHECKING: from ._generated.models import ManifestAttributesBase @@ -24,7 +25,7 @@ class ContentProperties(object): """ def __init__(self, **kwargs): - """Create ContentPermissions for an artifact, tag, or manifest + """Create ContentProperties for an artifact, tag, or manifest :keyword bool can_delete: Delete operation status for the object :keyword bool can_list: List operation status for the object @@ -78,26 +79,32 @@ def _from_generated(cls, gen): class ArtifactManifestProperties(object): """Represents properties of a registry artifact - :ivar str cpu_architecture: CPU Architecture of an artifact + :ivar architecture: CPU Architecture of an artifact + :vartype architecture: ~azure.containerregistry.ArtifactArchitecture :ivar created_on: Time and date an artifact was created - :vartype created_on: :class:`~datetime.datetime` + :vartype created_on: ~datetime.datetime :ivar str digest: Digest for the artifact :ivar last_updated_on: Time and date an artifact was last updated - :vartype last_updated_on: :class:`~datetime.datetime` - :ivar str operating_system: Operating system for the artifact + :vartype last_updated_on: datetime.datetime + :ivar operating_system: Operating system for the artifact + :vartype operating_system: ~azure.containerregistry.ArtifactOperatingSystem :ivar str repository_name: Repository name the artifact belongs to :ivar str size: Size of the artifact :ivar List[str] tags: Tags associated with a registry artifact :ivar writeable_properties: Permissions for an artifact - :vartype writeable_properties: :class:`~azure.containerregistry.ContentProperties` + :vartype writeable_properties: ~azure.containerregistry.ContentProperties """ def __init__(self, **kwargs): - self.cpu_architecture = kwargs.get("cpu_architecture", None) + self.architecture = kwargs.get("cpu_architecture", None) + if self.architecture is not None: + self.architecture = ArtifactArchitecture(self.architecture) self.created_on = kwargs.get("created_on", None) self.digest = kwargs.get("digest", None) self.last_updated_on = kwargs.get("last_updated_on", None) self.operating_system = kwargs.get("operating_system", None) + if self.operating_system is not None: + self.operating_system = ArtifactOperatingSystem(self.operating_system) self.repository_name = kwargs.get("repository_name", None) self.size = kwargs.get("size", None) self.tags = kwargs.get("tags", None) @@ -125,11 +132,11 @@ class RepositoryProperties(object): """Model for storing properties of a single repository :ivar writeable_properties: Read/Write/List/Delete permissions for the repository - :vartype writeable_properties: :class:`~azure.containerregistry.ContentProperties` + :vartype writeable_properties: ~azure.containerregistry.ContentProperties :ivar created_on: Time the repository was created - :vartype created_on: :class:`datetime.datetime` + :vartype created_on: datetime.datetime :ivar last_updated_on: Time the repository was last updated - :vartype last_updated_on: :class:`datetime.datetime` + :vartype last_updated_on: datetime.datetime :ivar int manifest_count: Number of manifest in the repository :ivar str name: Name of the repository :ivar int tag_count: Number of tags associated with the repository @@ -168,6 +175,17 @@ def _to_generated(self): writeable_properties=self.writeable_properties._to_generated(), # pylint: disable=protected-access ) + def _to_generated(self): + # type: () -> GeneratedRepositoryProperties + return GeneratedRepositoryProperties( + name=self.name, + created_on=self.created_on, + last_updated_on=self.last_updated_on, + manifest_count=self.manifest_count, + tag_count=self.tag_count, + writeable_properties=self.writeable_properties._to_generated(), # pylint: disable=protected-access + ) + class ManifestOrder(str, Enum): """Enum for ordering registry artifacts""" @@ -187,12 +205,12 @@ class ArtifactTagProperties(object): """Model for storing properties of a single tag :ivar writeable_properties: Read/Write/List/Delete permissions for the tag - :vartype writeable_properties: :class:`~azure.containerregistry.ContentProperties` + :vartype writeable_properties: ~azure.containerregistry.ContentProperties :ivar created_on: Time the tag was created - :vartype created_on: :class:`datetime.datetime` + :vartype created_on: datetime.datetime :ivar str digest: Digest for the tag :ivar last_updated_on: Time the tag was last updated - :vartype last_updated_on: :class:`datetime.datetime` + :vartype last_updated_on: datetime.datetime :ivar str name: Name of the image the tag corresponds to :ivar str repository: Repository the tag belongs to """ @@ -218,3 +236,38 @@ def _from_generated(cls, generated, **kwargs): writeable_properties=generated.writeable_properties, repository=kwargs.get("repository", None), ) + + +class ArtifactArchitecture(str, Enum): + + 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 ArtifactOperatingSystem(str, Enum): + + 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" diff --git a/sdk/containerregistry/azure-containerregistry/azure/containerregistry/_registry_artifact.py b/sdk/containerregistry/azure-containerregistry/azure/containerregistry/_registry_artifact.py index e47571b3c33b..809d4d27040c 100644 --- a/sdk/containerregistry/azure-containerregistry/azure/containerregistry/_registry_artifact.py +++ b/sdk/containerregistry/azure-containerregistry/azure/containerregistry/_registry_artifact.py @@ -74,7 +74,6 @@ def _get_digest_from_tag(self): def delete(self, **kwargs): # type: (Dict[str, Any]) -> None """Delete a repository - :returns: Object containing information about the deleted repository :rtype: :class:`~azure.containerregistry.DeleteRepositoryResult` :raises: :class:`~azure.core.exceptions.ResourceNotFoundError` @@ -82,10 +81,8 @@ def delete(self, **kwargs): Example .. code-block:: python - from azure.containerregistry import ContainerRepositoryClient from azure.identity import DefaultAzureCredential - account_url = os.environ["CONTAINERREGISTRY_ENDPOINT"] client = ContainerRepositoryClient(account_url, "my_repository", DefaultAzureCredential()) client.delete() @@ -98,7 +95,6 @@ def delete(self, **kwargs): def delete_tag(self, tag, **kwargs): # type: (str, Dict[str, Any]) -> None """Delete a tag from a repository - :param str tag: The tag to be deleted :returns: None :raises: :class:`~azure.core.exceptions.ResourceNotFoundError` @@ -106,10 +102,8 @@ def delete_tag(self, tag, **kwargs): Example .. code-block:: python - from azure.containerregistry import ContainerRepositoryClient from azure.identity import DefaultAzureCredential - account_url = os.environ["CONTAINERREGISTRY_ENDPOINT"] client = ContainerRepositoryClient(account_url, "my_repository", DefaultAzureCredential()) for artifact in client.list_tags(): @@ -128,13 +122,11 @@ def get_manifest_properties(self, **kwargs): Example .. code-block:: python - from azure.containerregistry import ContainerRepositoryClient from azure.identity import DefaultAzureCredential - account_url = os.environ["CONTAINERREGISTRY_ENDPOINT"] client = ContainerRepositoryClient(account_url, "my_repository", DefaultAzureCredential()) - for artifact in client.list_registry_artifacts(): + for artifact in client.list_manifests(): properties = client.get_registry_artifact_properties(artifact.digest) """ if not self._digest: @@ -149,7 +141,6 @@ def get_manifest_properties(self, **kwargs): def get_tag_properties(self, tag, **kwargs): # type: (str, Dict[str, Any]) -> ArtifactTagProperties """Get the properties for a tag - :param tag: The tag to get properties for :type tag: str :returns: :class:`~azure.containerregistry.ArtifactTagProperties` @@ -158,10 +149,8 @@ def get_tag_properties(self, tag, **kwargs): Example .. code-block:: python - from azure.containerregistry import ContainerRepositoryClient from azure.identity import DefaultAzureCredential - account_url = os.environ["CONTAINERREGISTRY_ENDPOINT"] client = ContainerRepositoryClient(account_url, "my_repository", DefaultAzureCredential()) for tag in client.list_tags(): @@ -176,7 +165,6 @@ def get_tag_properties(self, tag, **kwargs): def list_tags(self, **kwargs): # type: (Dict[str, Any]) -> ItemPaged[ArtifactTagProperties] """List the tags for a repository - :keyword last: Query parameter for the last item in the previous call. Ensuing call will return values after last lexically :paramtype last: str @@ -191,10 +179,8 @@ def list_tags(self, **kwargs): Example .. code-block:: python - from azure.containerregistry import ContainerRepositoryClient from azure.identity import DefaultAzureCredential - account_url = os.environ["CONTAINERREGISTRY_ENDPOINT"] client = ContainerRepositoryClient(account_url, "my_repository", DefaultAzureCredential()) for tag in client.list_tags(): @@ -319,16 +305,14 @@ def set_manifest_properties(self, permissions, **kwargs): Example .. code-block:: python - from azure.containerregistry import ContainerRepositoryClient from azure.identity import DefaultAzureCredential - account_url = os.environ["CONTAINERREGISTRY_ENDPOINT"] client = ContainerRepositoryClient(account_url, "my_repository", DefaultAzureCredential()) - for artifact in client.list_registry_artifacts(): + for artifact in client.list_manifests(): received_permissions = client.set_manifest_properties( artifact.digest, - ContentPermissions( + ContentProperties( can_delete=False, can_list=False, can_read=False, @@ -353,7 +337,6 @@ def set_manifest_properties(self, permissions, **kwargs): def set_tag_properties(self, tag, permissions, **kwargs): # type: (str, ContentProperties, Dict[str, Any]) -> ArtifactTagProperties """Set the properties for a tag - :param tag: Tag to set properties for :type tag: str :param permissions: The property's values to be set @@ -364,16 +347,14 @@ def set_tag_properties(self, tag, permissions, **kwargs): Example .. code-block:: python - from azure.containerregistry import ContainerRepositoryClient from azure.identity import DefaultAzureCredential - account_url = os.environ["CONTAINERREGISTRY_ENDPOINT"] client = ContainerRepositoryClient(account_url, "my_repository", DefaultAzureCredential()) tag_identifier = "latest" received = client.set_tag_properties( tag_identifier, - ContentPermissions( + ContentProperties( can_delete=False, can_list=False, can_read=False, diff --git a/sdk/containerregistry/azure-containerregistry/azure/containerregistry/aio/_async_container_registry_client.py b/sdk/containerregistry/azure-containerregistry/azure/containerregistry/aio/_async_container_registry_client.py index 86cf0ffc6ee4..89096e52f1a4 100644 --- a/sdk/containerregistry/azure-containerregistry/azure/containerregistry/aio/_async_container_registry_client.py +++ b/sdk/containerregistry/azure-containerregistry/azure/containerregistry/aio/_async_container_registry_client.py @@ -31,7 +31,6 @@ class ContainerRegistryClient(ContainerRegistryBaseClient): def __init__(self, endpoint: str, credential: "AsyncTokenCredential", **kwargs: Dict[str, Any]) -> None: """Create a ContainerRegistryClient from an endpoint and a credential - :param endpoint: An ACR endpoint :type endpoint: str :param credential: The credential with which to authenticate @@ -78,7 +77,6 @@ async def delete_repository(self, repository_name: str, **kwargs: Dict[str, Any] @distributed_trace def list_repository_names(self, **kwargs: Dict[str, Any]) -> AsyncItemPaged[str]: """List all repositories - :keyword last: Query parameter for the last item in the previous call. Ensuing call will return values after last lexicallyy :paramtype last: str @@ -93,8 +91,8 @@ def list_repository_names(self, **kwargs: Dict[str, Any]) -> AsyncItemPaged[str] .. admonition:: Example: .. literalinclude:: ../samples/async_samples/sample_delete_old_tags_async.py - :start-after: [START list_repositories] - :end-before: [END list_repositories] + :start-after: [START list_repository_names] + :end-before: [END list_repository_names] :language: python :dedent: 8 :caption: List repositories in a container registry account @@ -198,13 +196,11 @@ def get_repository(self, repository_name: str, **kwargs: Any) -> ContainerReposi Example .. code-block:: python - from azure.containerregistry.aio import ContainerRepositoryClient from azure.identity.aio import DefaultAzureCredential - account_url = os.environ["CONTAINERREGISTRY_ENDPOINT"] client = ContainerRegistryClient(account_url, DefaultAzureCredential()) - repository_client = client.get_repository_client("my_repository") + repository_client = client.get_repository("my_repository") """ _pipeline = AsyncPipeline( transport=AsyncTransportWrapper( diff --git a/sdk/containerregistry/azure-containerregistry/azure/containerregistry/aio/_async_container_repository.py b/sdk/containerregistry/azure-containerregistry/azure/containerregistry/aio/_async_container_repository.py index 96a863c92969..ad837eee9d61 100644 --- a/sdk/containerregistry/azure-containerregistry/azure/containerregistry/aio/_async_container_repository.py +++ b/sdk/containerregistry/azure-containerregistry/azure/containerregistry/aio/_async_container_repository.py @@ -85,7 +85,7 @@ def list_manifests(self, **kwargs: Dict[str, Any]) -> AsyncItemPaged[ArtifactMan call will return values after last lexically :paramtype last: str :keyword order_by: Query parameter for ordering by time ascending or descending - :paramtype order_by: :class:`~azure.containerregistry.ManifestOrder` + :paramtype order_by: :class:`~azure.containerregistry.ManifestOrder` or str :keyword results_per_page: Number of repositories to return per page :paramtype results_per_page: int :return: ItemPaged[:class:`~azure.containerregistry.ArtifactManifestProperties`] @@ -204,7 +204,9 @@ async def set_properties(self, properties: ContentProperties, **kwargs: Dict[str """ return RepositoryProperties._from_generated( # pylint: disable=protected-access await self._client.container_registry.set_properties( - self.name, properties._to_generated(), **kwargs # pylint: disable=protected-access + self.name, + properties._to_generated(), # pylint: disable=protected-access + **kwargs ) ) diff --git a/sdk/containerregistry/azure-containerregistry/azure/containerregistry/aio/_async_registry_artifact.py b/sdk/containerregistry/azure-containerregistry/azure/containerregistry/aio/_async_registry_artifact.py index d946628a2571..77c000a0ae67 100644 --- a/sdk/containerregistry/azure-containerregistry/azure/containerregistry/aio/_async_registry_artifact.py +++ b/sdk/containerregistry/azure-containerregistry/azure/containerregistry/aio/_async_registry_artifact.py @@ -79,7 +79,6 @@ async def _get_digest_from_tag(self) -> str: @distributed_trace_async async def delete(self, **kwargs: Dict[str, Any]) -> DeleteRepositoryResult: """Delete a repository - :returns: Object containing information about the deleted repository :rtype: :class:`~azure.containerregistry.DeleteRepositoryResult` :raises: :class:`~azure.core.exceptions.ResourceNotFoundError` @@ -87,10 +86,8 @@ async def delete(self, **kwargs: Dict[str, Any]) -> DeleteRepositoryResult: Example .. code-block:: python - from azure.containerregistry.aio import ContainerRepositoryClient from azure.identity.aio import DefaultAzureCredential - account_url = os.environ["CONTAINERREGISTRY_ENDPOINT"] client = ContainerRepositoryClient(account_url, "my_repository", DefaultAzureCredential()) await client.delete() @@ -102,7 +99,6 @@ async def delete(self, **kwargs: Dict[str, Any]) -> DeleteRepositoryResult: @distributed_trace_async async def delete_tag(self, tag: str, **kwargs: Dict[str, Any]) -> None: """Delete a tag from a repository - :param str tag: The tag to be deleted :returns: None :raises: :class:`~azure.core.exceptions.ResourceNotFoundError` @@ -110,10 +106,8 @@ async def delete_tag(self, tag: str, **kwargs: Dict[str, Any]) -> None: Example .. code-block:: python - from azure.containerregistry.aio import ContainerRepositoryClient from azure.identity.aio import DefaultAzureCredential - account_url = os.environ["CONTAINERREGISTRY_ENDPOINT"] client = ContainerRepositoryClient(account_url, "my_repository", DefaultAzureCredential()) async for artifact in client.list_tags(): @@ -131,13 +125,11 @@ async def get_manifest_properties(self, **kwargs: Dict[str, Any]) -> ArtifactMan Example .. code-block:: python - from azure.containerregistry.aio import ContainerRepositoryClient from azure.identity.aio import DefaultAzureCredential - account_url = os.environ["CONTAINERREGISTRY_ENDPOINT"] client = ContainerRepositoryClient(account_url, "my_repository", DefaultAzureCredential()) - async for artifact in client.list_registry_artifacts(): + async for artifact in client.list_manifests(): properties = await client.get_registry_artifact_properties(artifact.digest) """ if not self._digest: @@ -151,7 +143,6 @@ async def get_manifest_properties(self, **kwargs: Dict[str, Any]) -> ArtifactMan @distributed_trace_async async def get_tag_properties(self, tag: str, **kwargs: Dict[str, Any]) -> ArtifactTagProperties: """Get the properties for a tag - :param tag: The tag to get properties for :type tag: str :returns: :class:`~azure.containerregistry.ArtifactTagProperties` @@ -160,10 +151,8 @@ async def get_tag_properties(self, tag: str, **kwargs: Dict[str, Any]) -> Artifa Example .. code-block:: python - from azure.containerregistry.aio import ContainerRepositoryClient from azure.identity.aio import DefaultAzureCredential - account_url = os.environ["CONTAINERREGISTRY_ENDPOINT"] client = ContainerRepositoryClient(account_url, "my_repository", DefaultAzureCredential()) async for tag in client.list_tags(): @@ -176,7 +165,6 @@ async def get_tag_properties(self, tag: str, **kwargs: Dict[str, Any]) -> Artifa @distributed_trace def list_tags(self, **kwargs: Dict[str, Any]) -> AsyncItemPaged[ArtifactTagProperties]: """List the tags for a repository - :keyword last: Query parameter for the last item in the previous call. Ensuing call will return values after last lexically :paramtype last: str @@ -191,10 +179,8 @@ def list_tags(self, **kwargs: Dict[str, Any]) -> AsyncItemPaged[ArtifactTagPrope Example .. code-block:: python - from azure.containerregistry.aio import ContainerRepositoryClient from azure.identity.aio import DefaultAzureCredential - account_url = os.environ["CONTAINERREGISTRY_ENDPOINT"] client = ContainerRepositoryClient(account_url, "my_repository", DefaultAzureCredential()) async for tag in client.list_tags(): @@ -320,16 +306,14 @@ async def set_manifest_properties( Example .. code-block:: python - from azure.containerregistry.aio import ContainerRepositoryClient from azure.identity.aio import DefaultAzureCredential - account_url = os.environ["CONTAINERREGISTRY_ENDPOINT"] client = ContainerRepositoryClient(account_url, "my_repository", DefaultAzureCredential()) - async for artifact in client.list_registry_artifacts(): + async for artifact in client.list_manifests(): received_permissions = await client.set_manifest_properties( artifact.digest, - ContentPermissions( + ContentProperties( can_delete=False, can_list=False, can_read=False, @@ -355,7 +339,6 @@ async def set_tag_properties( self, tag: str, permissions: ContentProperties, **kwargs: Dict[str, Any] ) -> ArtifactTagProperties: """Set the properties for a tag - :param tag: Tag to set properties for :type tag: str :param permissions: The property's values to be set @@ -366,16 +349,14 @@ async def set_tag_properties( Example .. code-block:: python - from azure.containerregistry.aio import ContainerRepositoryClient from azure.identity.aio import DefaultAzureCredential - account_url = os.environ["CONTAINERREGISTRY_ENDPOINT"] client = ContainerRepositoryClient(account_url, "my_repository", DefaultAzureCredential()) tag_identifier = "latest" received = await client.set_tag_properties( tag_identifier, - ContentPermissions( + ContentProperties( can_delete=False, can_list=False, can_read=False, diff --git a/sdk/containerregistry/azure-containerregistry/samples/async_samples/sample_delete_old_tags_async.py b/sdk/containerregistry/azure-containerregistry/samples/async_samples/sample_delete_old_tags_async.py index c3f5a1e0653c..65b2d35f0e3f 100644 --- a/sdk/containerregistry/azure-containerregistry/samples/async_samples/sample_delete_old_tags_async.py +++ b/sdk/containerregistry/azure-containerregistry/samples/async_samples/sample_delete_old_tags_async.py @@ -37,14 +37,14 @@ async def delete_old_tags(self): ) from azure.identity.aio import DefaultAzureCredential - # [START list_repositories] + # [START list_repository_names] account_url = os.environ["CONTAINERREGISTRY_ENDPOINT"] credential = DefaultAzureCredential() client = ContainerRegistryClient(account_url, credential) - async for repository in client.list_repositories(): + async for repository in client.list_repository_names(): repository_client = ContainerRepositoryClient(account_url, repository, credential) - # [END list_repositories] + # [END list_repository_names] # [START list_tags] tag_count = 0 diff --git a/sdk/containerregistry/azure-containerregistry/samples/sample_delete_old_tags.py b/sdk/containerregistry/azure-containerregistry/samples/sample_delete_old_tags.py index 89e141f3a917..f35a1ed0e17d 100644 --- a/sdk/containerregistry/azure-containerregistry/samples/sample_delete_old_tags.py +++ b/sdk/containerregistry/azure-containerregistry/samples/sample_delete_old_tags.py @@ -36,14 +36,14 @@ def delete_old_tags(self): ) from azure.identity import DefaultAzureCredential - # [START list_repositories] + # [START list_repository_names] account_url = os.environ["CONTAINERREGISTRY_ENDPOINT"] credential = DefaultAzureCredential() client = ContainerRegistryClient(account_url, credential) - for repository in client.list_repositories(): + for repository in client.list_repository_names(): repository_client = ContainerRepositoryClient(account_url, repository, credential) - # [END list_repositories] + # [END list_repository_names] # [START list_tags] tag_count = 0 diff --git a/sdk/containerregistry/azure-containerregistry/tests/asynctestcase.py b/sdk/containerregistry/azure-containerregistry/tests/asynctestcase.py index a0c63deb6143..1e6091024de6 100644 --- a/sdk/containerregistry/azure-containerregistry/tests/asynctestcase.py +++ b/sdk/containerregistry/azure-containerregistry/tests/asynctestcase.py @@ -7,6 +7,11 @@ ContainerRepository, ContainerRegistryClient, ) +from azure.containerregistry import ( + ArtifactTagProperties, + ContentProperties, + ArtifactManifestProperties, +) from azure.core.credentials import AccessToken from azure.identity.aio import DefaultAzureCredential diff --git a/sdk/containerregistry/azure-containerregistry/tests/test_container_registry_client.py b/sdk/containerregistry/azure-containerregistry/tests/test_container_registry_client.py index ef0293170c4f..16ec4db973e1 100644 --- a/sdk/containerregistry/azure-containerregistry/tests/test_container_registry_client.py +++ b/sdk/containerregistry/azure-containerregistry/tests/test_container_registry_client.py @@ -6,9 +6,7 @@ import pytest import six -from azure.containerregistry import ( - DeleteRepositoryResult, -) +from azure.containerregistry import DeleteRepositoryResult from azure.core.exceptions import ResourceNotFoundError from azure.core.paging import ItemPaged from azure.core.pipeline.transport import RequestsTransport diff --git a/sdk/containerregistry/azure-containerregistry/tests/test_container_registry_client_async.py b/sdk/containerregistry/azure-containerregistry/tests/test_container_registry_client_async.py index dd71da9270b7..c777f35ea290 100644 --- a/sdk/containerregistry/azure-containerregistry/tests/test_container_registry_client_async.py +++ b/sdk/containerregistry/azure-containerregistry/tests/test_container_registry_client_async.py @@ -6,9 +6,7 @@ import pytest import six -from azure.containerregistry import ( - DeleteRepositoryResult, -) +from azure.containerregistry import DeleteRepositoryResult from azure.core.exceptions import ResourceNotFoundError from azure.core.pipeline.transport import AioHttpTransport diff --git a/sdk/containerregistry/azure-containerregistry/tests/test_container_repository.py b/sdk/containerregistry/azure-containerregistry/tests/test_container_repository.py index 6c8da138d7bc..fa011d384607 100644 --- a/sdk/containerregistry/azure-containerregistry/tests/test_container_repository.py +++ b/sdk/containerregistry/azure-containerregistry/tests/test_container_repository.py @@ -59,7 +59,7 @@ def test_set_properties(self, containerregistry_endpoint): assert c.can_write == new_properties.writeable_properties.can_write @acr_preparer() - def test_list_manifests(self, containerregistry_endpoint): + def test_list_registry_artifacts(self, containerregistry_endpoint): client = self.create_container_repository(containerregistry_endpoint, "library/busybox") count = 0 @@ -76,7 +76,7 @@ def test_list_manifests(self, containerregistry_endpoint): assert count > 0 @acr_preparer() - def test_list_manifests_by_page(self, containerregistry_endpoint): + def test_list_registry_artifacts_by_page(self, containerregistry_endpoint): client = self.create_container_repository(containerregistry_endpoint, "library/busybox") results_per_page = 2 @@ -92,7 +92,7 @@ def test_list_manifests_by_page(self, containerregistry_endpoint): assert page_count >= 1 @acr_preparer() - def test_list_manifests_descending(self, containerregistry_endpoint): + def test_list_registry_artifacts_descending(self, containerregistry_endpoint): client = self.create_container_repository(containerregistry_endpoint, "library/busybox") prev_last_updated_on = None @@ -106,7 +106,7 @@ def test_list_manifests_descending(self, containerregistry_endpoint): assert count > 0 @acr_preparer() - def test_list_manifests_ascending(self, containerregistry_endpoint): + def test_list_registry_artifacts_ascending(self, containerregistry_endpoint): client = self.create_container_repository(containerregistry_endpoint, "library/busybox") prev_last_updated_on = None diff --git a/sdk/containerregistry/azure-containerregistry/tests/test_container_repository_async.py b/sdk/containerregistry/azure-containerregistry/tests/test_container_repository_async.py index 08f76d70b3ad..a831ded5e2ea 100644 --- a/sdk/containerregistry/azure-containerregistry/tests/test_container_repository_async.py +++ b/sdk/containerregistry/azure-containerregistry/tests/test_container_repository_async.py @@ -52,7 +52,7 @@ async def test_delete_repository_doesnt_exist(self, containerregistry_endpoint): await repo_client.delete() @acr_preparer() - async def test_list_manifests(self, containerregistry_endpoint): + async def test_list_registry_artifacts(self, containerregistry_endpoint): client = self.create_container_repository(containerregistry_endpoint, "library/busybox") count = 0 @@ -69,7 +69,7 @@ async def test_list_manifests(self, containerregistry_endpoint): assert count > 0 @acr_preparer() - async def test_list_manifests_by_page(self, containerregistry_endpoint): + async def test_list_registry_artifacts_by_page(self, containerregistry_endpoint): client = self.create_container_repository(containerregistry_endpoint, "library/busybox") results_per_page = 2 @@ -85,7 +85,7 @@ async def test_list_manifests_by_page(self, containerregistry_endpoint): assert page_count >= 1 @acr_preparer() - async def test_list_manifests_descending(self, containerregistry_endpoint): + async def test_list_registry_artifacts_descending(self, containerregistry_endpoint): client = self.create_container_repository(containerregistry_endpoint, "library/busybox") prev_last_updated_on = None @@ -99,7 +99,7 @@ async def test_list_manifests_descending(self, containerregistry_endpoint): assert count > 0 @acr_preparer() - async def test_list_manifests_ascending(self, containerregistry_endpoint): + async def test_list_registry_artifacts_ascending(self, containerregistry_endpoint): client = self.create_container_repository(containerregistry_endpoint, "library/busybox") prev_last_updated_on = None diff --git a/sdk/containerregistry/azure-containerregistry/tests/test_registry_artifact.py b/sdk/containerregistry/azure-containerregistry/tests/test_registry_artifact.py index 6e12835b30d8..5b508453e524 100644 --- a/sdk/containerregistry/azure-containerregistry/tests/test_registry_artifact.py +++ b/sdk/containerregistry/azure-containerregistry/tests/test_registry_artifact.py @@ -6,8 +6,10 @@ import pytest from azure.containerregistry import ( - ContentProperties, + ArtifactArchitecture, ArtifactManifestProperties, + ArtifactOperatingSystem, + ContentProperties, ArtifactTagProperties, ) from azure.core.exceptions import ResourceNotFoundError @@ -36,6 +38,8 @@ def test_get_manifest_properties(self, containerregistry_endpoint): assert isinstance(properties, ArtifactManifestProperties) assert isinstance(properties.writeable_properties, ContentProperties) + assert isinstance(properties.architecture, ArtifactArchitecture) + assert isinstance(properties.operating_system, ArtifactOperatingSystem) assert properties.repository_name == repo @acr_preparer() diff --git a/sdk/containerregistry/azure-containerregistry/tests/test_registry_artifact_async.py b/sdk/containerregistry/azure-containerregistry/tests/test_registry_artifact_async.py index 14d1c49dd71a..b42bc00546bc 100644 --- a/sdk/containerregistry/azure-containerregistry/tests/test_registry_artifact_async.py +++ b/sdk/containerregistry/azure-containerregistry/tests/test_registry_artifact_async.py @@ -6,8 +6,10 @@ import pytest from azure.containerregistry import ( - ContentProperties, + ArtifactArchitecture, ArtifactManifestProperties, + ArtifactOperatingSystem, + ContentProperties, ArtifactTagProperties, ) from azure.core.exceptions import ResourceNotFoundError @@ -36,7 +38,9 @@ async def test_get_manifest_properties(self, containerregistry_endpoint): assert isinstance(properties, ArtifactManifestProperties) assert isinstance(properties.writeable_properties, ContentProperties) - assert properties.repository_name == repo + assert isinstance(properties.writeable_properties, ContentProperties) + assert isinstance(properties.architecture, ArtifactArchitecture) + assert isinstance(properties.operating_system, ArtifactOperatingSystem) @acr_preparer() async def test_get_manifest_properties_does_not_exist(self, containerregistry_endpoint): diff --git a/sdk/containerregistry/azure-containerregistry/tests/testcase.py b/sdk/containerregistry/azure-containerregistry/tests/testcase.py index 7c6d685e1f15..c3132a83d94e 100644 --- a/sdk/containerregistry/azure-containerregistry/tests/testcase.py +++ b/sdk/containerregistry/azure-containerregistry/tests/testcase.py @@ -24,9 +24,19 @@ from azure.core.credentials import AccessToken from azure.mgmt.containerregistry import ContainerRegistryManagementClient -from azure.mgmt.containerregistry.models import ImportImageParameters, ImportSource, ImportMode +from azure.mgmt.containerregistry.models import ( + ImportImageParameters, + ImportSource, + ImportMode +) from azure.identity import DefaultAzureCredential +from azure_devtools.scenario_tests import ( + GeneralNameReplacer, + RequestUrlNormalizer, + AuthenticationMetadataFilter, + RecordingProcessor, +) from devtools_testutils import AzureTestCase from azure_devtools.scenario_tests import ( GeneralNameReplacer,