Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
d7bcfe6
changing ContainerRepositoryClient to ContainerRepository
seankane-msft Apr 27, 2021
7a0b598
renaming files
seankane-msft Apr 27, 2021
15bbaaf
re-recording, commenting out tests that are not necessary
seankane-msft Apr 27, 2021
b91302c
working sync registry artifact class
seankane-msft Apr 28, 2021
6f7c55c
async registry artifact
seankane-msft Apr 28, 2021
22ecb18
issue with recording infra that is removing an acr specific oauth path
seankane-msft Apr 28, 2021
d5986dd
pylint issues
seankane-msft Apr 28, 2021
1287136
recording and processors
seankane-msft Apr 28, 2021
145949b
removing commented out code
seankane-msft Apr 28, 2021
09f3636
undoing changes to cache
seankane-msft Apr 28, 2021
6e38bf1
more lint fixes
seankane-msft Apr 28, 2021
d9659c0
help with logging output
seankane-msft Apr 28, 2021
941473a
change to list_repository_names
seankane-msft Apr 28, 2021
44ceace
renaming for consistency
seankane-msft Apr 28, 2021
4e5dbc8
all changes made, plus recordings
seankane-msft Apr 28, 2021
f7caebd
fixing up more tests again!
seankane-msft Apr 28, 2021
6ced986
formatting
seankane-msft Apr 28, 2021
5417f1d
merge conflicts
seankane-msft Apr 29, 2021
83c0d90
fixing up merge issues
seankane-msft May 3, 2021
c0ed9ff
merge conflicts
seankane-msft May 3, 2021
ed3f937
more conflicts
seankane-msft May 3, 2021
ccec23b
undoing changes to gen code
seankane-msft May 3, 2021
afa0c1b
pylint issues
seankane-msft May 4, 2021
0e2e335
consistent naming
seankane-msft May 4, 2021
24cb3a0
changes
seankane-msft May 4, 2021
0dcd6cd
anon test
seankane-msft May 4, 2021
62964e8
small changes to generated, eventually will be reflected in the swagger
seankane-msft May 5, 2021
64937b8
adding basics for anon
seankane-msft May 5, 2021
315c9f8
adding test infra
seankane-msft May 5, 2021
abd4e4e
adding async tests
seankane-msft May 5, 2021
119575e
adding more tests for anon container repo and reg artifact
seankane-msft May 5, 2021
7c31693
added async anon client
seankane-msft May 6, 2021
0c9e77a
asserting credential is false
seankane-msft May 6, 2021
7f57d03
fixing scrubber
seankane-msft May 6, 2021
d260ff9
new swagger
seankane-msft May 6, 2021
8fbf308
merge conflicts
seankane-msft May 6, 2021
dc033e9
merge conflicts reflected in tests
seankane-msft May 6, 2021
9a93a9c
lint
seankane-msft May 6, 2021
c06fecd
updating tests and resource for anonymous access
seankane-msft May 6, 2021
2b78a40
updating generated code
seankane-msft May 7, 2021
77aed4b
merge conflicts
seankane-msft May 9, 2021
67887d6
undoing generated code changes
seankane-msft May 9, 2021
4e7c9b6
shouldnt have done that oops
seankane-msft May 9, 2021
86f86aa
undoing unnecessary changes to recordings
seankane-msft May 9, 2021
87b1928
changelog
seankane-msft May 9, 2021
3255a2d
merge conflicts
seankane-msft May 11, 2021
68f7bfd
anna and mccoys comments
seankane-msft May 11, 2021
8a254ab
lint fixes
seankane-msft May 11, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
removing commented out code
  • Loading branch information
seankane-msft committed Apr 28, 2021
commit 145949b1a2bf0b81fdf702d4f9fa9d079b5d45b8
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class ContainerRegistryApiVersion(str, Enum):


class ContainerRegistryBaseClient(object):
"""Base class for ContainerRegistryClient and ContainerRepository
"""Base class for ContainerRegistryClient, ContainerRepository, and RegistryArtifact

:param str endpoint: Azure Container Registry endpoint
:param credential: AAD Token for authenticating requests with Azure
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,6 @@ def __init__(self, endpoint, repository, credential, **kwargs):
self._credential = credential
super(ContainerRepository, self).__init__(endpoint=self._endpoint, credential=credential, **kwargs)

# def _get_digest_from_tag(self, tag):
# # type: (str) -> str
# tag_props = self.get_tag_properties(tag)
# return tag_props.digest

@distributed_trace
def delete(self, **kwargs):
# type: (Dict[str, Any]) -> None
Expand All @@ -70,29 +65,6 @@ def delete(self, **kwargs):
self._client.container_registry.delete_repository(self.repository, **kwargs)
)

# @distributed_trace
# def delete_registry_artifact(self, digest, **kwargs):
# # type: (str, Dict[str, Any]) -> None
# """Delete a registry artifact

# :param digest: The digest of the artifact to be deleted
# :type digest: str
# :returns: None
# :raises: :class:`~azure.core.exceptions.ResourceNotFoundError`
# """
# self._client.container_registry.delete_manifest(self.repository, digest, **kwargs)

# @distributed_trace
# 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`
# """
# self._client.container_registry.delete_tag(self.repository, tag, **kwargs)

@distributed_trace
def get_properties(self, **kwargs):
# type: (Dict[str, Any]) -> RepositoryProperties
Expand All @@ -105,39 +77,6 @@ def get_properties(self, **kwargs):
self._client.container_registry.get_properties(self.repository, **kwargs)
)

# @distributed_trace
# def get_registry_artifact_properties(self, tag_or_digest, **kwargs):
# # type: (str, Dict[str, Any]) -> ArtifactManifestProperties
# """Get the properties of a registry artifact

# :param tag_or_digest: The tag/digest of a registry artifact
# :type tag_or_digest: str
# :returns: :class:`~azure.containerregistry.ArtifactManifestProperties`
# :raises: :class:`~azure.core.exceptions.ResourceNotFoundError`
# """
# if _is_tag(tag_or_digest):
# tag_or_digest = self._get_digest_from_tag(tag_or_digest)

# return ArtifactManifestProperties._from_generated( # pylint: disable=protected-access
# self._client.container_registry.get_manifest_properties(
# self.repository, tag_or_digest, **kwargs
# )
# )

# @distributed_trace
# def get_tag_properties(self, tag, **kwargs):
# # type: (str, Dict[str, Any]) -> TagProperties
# """Get the properties for a tag

# :param tag: The tag to get properties for
# :type tag: str
# :returns: :class:`~azure.containerregistry.TagProperties`
# :raises: :class:`~azure.core.exceptions.ResourceNotFoundError`
# """
# return TagProperties._from_generated( # pylint: disable=protected-access
# self._client.container_registry.get_tag_properties(self.repository, tag, **kwargs)
# )

@distributed_trace
def list_registry_artifacts(self, **kwargs):
# type: (Dict[str, Any]) -> ItemPaged[ArtifactManifestProperties]
Expand Down Expand Up @@ -256,160 +195,6 @@ def get_next(next_link=None):

return ItemPaged(get_next, extract_data)

# @distributed_trace
# def list_tags(self, **kwargs):
# # type: (Dict[str, Any]) -> ItemPaged[TagProperties]
# """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
# :keyword order_by: Query parameter for ordering by time ascending or descending
# :paramtype order_by: :class:`~azure.containerregistry.TagOrderBy`
# :keyword results_per_page: Number of repositories to return per page
# :paramtype results_per_page: int
# :return: ItemPaged[:class:`~azure.containerregistry.TagProperties`]
# :rtype: :class:`~azure.core.paging.ItemPaged`
# :raises: :class:`~azure.core.exceptions.ResourceNotFoundError`
# """
# name = self.repository
# last = kwargs.pop("last", None)
# n = kwargs.pop("results_per_page", None)
# orderby = kwargs.pop("order_by", None)
# digest = kwargs.pop("digest", None)
# cls = kwargs.pop(
# "cls", lambda objs: [TagProperties._from_generated(o) for o in objs] # pylint: disable=protected-access
# )

# error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError}
# error_map.update(kwargs.pop("error_map", {}))
# accept = "application/json"

# def prepare_request(next_link=None):
# # Construct headers
# header_parameters = {} # type: Dict[str, Any]
# header_parameters["Accept"] = self._client._serialize.header( # pylint: disable=protected-access
# "accept", accept, "str"
# )

# if not next_link:
# # Construct URL
# url = "/acr/v1/{name}/_tags"
# path_format_arguments = {
# "url": self._client._serialize.url( # pylint: disable=protected-access
# "self._config.url",
# self._client._config.url, # pylint: disable=protected-access
# "str",
# skip_quote=True,
# ),
# "name": self._client._serialize.url("name", name, "str"), # pylint: disable=protected-access
# }
# url = self._client._client.format_url(url, **path_format_arguments) # pylint: disable=protected-access
# # Construct parameters
# query_parameters = {} # type: Dict[str, Any]
# if last is not None:
# query_parameters["last"] = self._client._serialize.query( # pylint: disable=protected-access
# "last", last, "str"
# )
# if n is not None:
# query_parameters["n"] = self._client._serialize.query( # pylint: disable=protected-access
# "n", n, "int"
# )
# if orderby is not None:
# query_parameters["orderby"] = self._client._serialize.query( # pylint: disable=protected-access
# "orderby", orderby, "str"
# )
# if digest is not None:
# query_parameters["digest"] = self._client._serialize.query( # pylint: disable=protected-access
# "digest", digest, "str"
# )

# request = self._client._client.get( # pylint: disable=protected-access
# url, query_parameters, header_parameters
# )
# else:
# url = next_link
# query_parameters = {} # type: Dict[str, Any]
# path_format_arguments = {
# "url": self._client._serialize.url( # pylint: disable=protected-access
# "self._client._config.url",
# self._client._config.url, # pylint: disable=protected-access
# "str",
# skip_quote=True,
# ),
# "name": self._client._serialize.url("name", name, "str"), # pylint: disable=protected-access
# }
# url = self._client._client.format_url(url, **path_format_arguments) # pylint: disable=protected-access
# request = self._client._client.get( # pylint: disable=protected-access
# url, query_parameters, header_parameters
# )
# return request

# def extract_data(pipeline_response):
# deserialized = self._client._deserialize("TagList", pipeline_response) # pylint: disable=protected-access
# list_of_elem = deserialized.tag_attribute_bases
# if cls:
# list_of_elem = cls(list_of_elem)
# link = None
# if "Link" in pipeline_response.http_response.headers.keys():
# link = _parse_next_link(pipeline_response.http_response.headers["Link"])
# return link, iter(list_of_elem)

# def get_next(next_link=None):
# request = prepare_request(next_link)

# pipeline_response = self._client._client._pipeline.run( # pylint: disable=protected-access
# request, stream=False, **kwargs
# )
# response = pipeline_response.http_response

# if response.status_code not in [200]:
# error = self._client._deserialize.failsafe_deserialize( # pylint: disable=protected-access
# AcrErrors, response
# )
# map_error(status_code=response.status_code, response=response, error_map=error_map)
# raise HttpResponseError(response=response, model=error)

# return pipeline_response

# return ItemPaged(get_next, extract_data)

# @distributed_trace
# def set_manifest_properties(self, digest, permissions, **kwargs):
# # type: (str, ContentPermissions, Dict[str, Any]) -> ArtifactManifestProperties
# """Set the properties for a manifest

# :param digest: Digest of a manifest
# :type digest: str
# :param permissions: The property's values to be set
# :type permissions: ContentPermissions
# :returns: :class:`~azure.containerregistry.ArtifactManifestProperties`
# :raises: :class:`~azure.core.exceptions.ResourceNotFoundError`
# """
# return ArtifactManifestProperties._from_generated( # pylint: disable=protected-access
# self._client.container_registry.update_manifest_properties(
# self.repository, digest, value=permissions._to_generated(), **kwargs # pylint: disable=protected-access
# )
# )

# @distributed_trace
# def set_tag_properties(self, tag, permissions, **kwargs):
# # type: (str, ContentPermissions, Dict[str, Any]) -> TagProperties
# """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
# :type permissions: ContentPermissions
# :returns: :class:`~azure.containerregistry.TagProperties`
# :raises: :class:`~azure.core.exceptions.ResourceNotFoundError`
# """
# return TagProperties._from_generated( # pylint: disable=protected-access
# self._client.container_registry.update_tag_attributes(
# self.repository, tag, value=permissions._to_generated(), **kwargs # pylint: disable=protected-access
# )
# )

@distributed_trace
def set_properties(self, properties, **kwargs):
# type: (RepositoryProperties, Dict[str, Any]) -> RepositoryProperties
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class ContainerRegistryApiVersion(str, Enum):


class ContainerRegistryBaseClient(object):
"""Base class for ContainerRegistryClient and ContainerRepository
"""Base class for ContainerRegistryClient, ContainerRepository, and RegistryArtifact

:param endpoint: Azure Container Registry endpoint
:type endpoint: str
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,7 @@ def get_repository_client(self, repository: str, **kwargs: Dict[str, Any]) -> Co
)

@distributed_trace
def get_artifact(self, repository_name, tag_or_digest, **kwargs):
# type: (str, str, Dict[str, Any]) -> RegistryArtifact
def get_artifact(self, repository_name: str, tag_or_digest: str, **kwargs: Dict[str, Any]) -> RegistryArtifact:
"""Get a Registry Artifact object

:param str repository_name: Name of the repository
Expand Down
Loading