diff --git a/sdk/containerregistry/azure-containerregistry/HISTORY.rst b/sdk/containerregistry/azure-containerregistry/HISTORY.rst new file mode 100644 index 000000000000..8924d5d6c445 --- /dev/null +++ b/sdk/containerregistry/azure-containerregistry/HISTORY.rst @@ -0,0 +1,9 @@ +.. :changelog: + +Release History +=============== + +0.1.0 (1970-01-01) +++++++++++++++++++ + +* Initial Release diff --git a/sdk/containerregistry/azure-containerregistry/MANIFEST.in b/sdk/containerregistry/azure-containerregistry/MANIFEST.in new file mode 100644 index 000000000000..74c0ac7e42a1 --- /dev/null +++ b/sdk/containerregistry/azure-containerregistry/MANIFEST.in @@ -0,0 +1,4 @@ +recursive-include tests *.py *.yaml +include *.rst +include azure/__init__.py + diff --git a/sdk/containerregistry/azure-containerregistry/README.rst b/sdk/containerregistry/azure-containerregistry/README.rst new file mode 100644 index 000000000000..93cf9a30d38d --- /dev/null +++ b/sdk/containerregistry/azure-containerregistry/README.rst @@ -0,0 +1,33 @@ +Microsoft Azure SDK for Python +============================== + +This is the Microsoft Azure MyService Management Client Library. + +Azure Resource Manager (ARM) is the next generation of management APIs that +replace the old Azure Service Management (ASM). + +This package has been tested with Python 2.7, 3.5, 3.6 and 3.7. + +For the older Azure Service Management (ASM) libraries, see +`azure-servicemanagement-legacy `__ library. + +For a more complete set of Azure libraries, see the `azure `__ bundle package. + + +Usage +===== + +For code examples, see `MyService Management +`__ +on docs.microsoft.com. + + +Provide Feedback +================ + +If you encounter any bugs or have suggestions, please file an issue in the +`Issues `__ +section of the project. + + +.. image:: https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fazure-containerregistry%2FREADME.png diff --git a/sdk/containerregistry/azure-containerregistry/azure/__init__.py b/sdk/containerregistry/azure-containerregistry/azure/__init__.py new file mode 100644 index 000000000000..0260537a02bb --- /dev/null +++ b/sdk/containerregistry/azure-containerregistry/azure/__init__.py @@ -0,0 +1 @@ +__path__ = __import__('pkgutil').extend_path(__path__, __name__) \ No newline at end of file diff --git a/sdk/containerregistry/azure-containerregistry/azure/containerregistry/__init__.py b/sdk/containerregistry/azure-containerregistry/azure/containerregistry/__init__.py new file mode 100644 index 000000000000..20154e7e65a6 --- /dev/null +++ b/sdk/containerregistry/azure-containerregistry/azure/containerregistry/__init__.py @@ -0,0 +1,19 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from ._configuration import AzureContainerRegistryConfiguration +from ._azure_container_registry import AzureContainerRegistry +__all__ = ['AzureContainerRegistry', 'AzureContainerRegistryConfiguration'] + +from .version import VERSION + +__version__ = VERSION + diff --git a/sdk/containerregistry/azure-containerregistry/azure/containerregistry/_azure_container_registry.py b/sdk/containerregistry/azure-containerregistry/azure/containerregistry/_azure_container_registry.py new file mode 100644 index 000000000000..79c7794ccc05 --- /dev/null +++ b/sdk/containerregistry/azure-containerregistry/azure/containerregistry/_azure_container_registry.py @@ -0,0 +1,79 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.service_client import SDKClient +from msrest import Serializer, Deserializer + +from ._configuration import AzureContainerRegistryConfiguration +from msrest.exceptions import HttpOperationError +from .operations import V2SupportOperations +from .operations import ManifestsOperations +from .operations import BlobOperations +from .operations import RepositoryOperations +from .operations import TagOperations +from .operations import RefreshTokensOperations +from .operations import AccessTokensOperations +from . import models + + +class AzureContainerRegistry(SDKClient): + """Metadata API definition for the Azure Container Registry runtime + + :ivar config: Configuration for client. + :vartype config: AzureContainerRegistryConfiguration + + :ivar v2_support: V2Support operations + :vartype v2_support: azure.containerregistry.operations.V2SupportOperations + :ivar manifests: Manifests operations + :vartype manifests: azure.containerregistry.operations.ManifestsOperations + :ivar blob: Blob operations + :vartype blob: azure.containerregistry.operations.BlobOperations + :ivar repository: Repository operations + :vartype repository: azure.containerregistry.operations.RepositoryOperations + :ivar tag: Tag operations + :vartype tag: azure.containerregistry.operations.TagOperations + :ivar refresh_tokens: RefreshTokens operations + :vartype refresh_tokens: azure.containerregistry.operations.RefreshTokensOperations + :ivar access_tokens: AccessTokens operations + :vartype access_tokens: azure.containerregistry.operations.AccessTokensOperations + + :param login_uri: Registry login URL + :type login_uri: str + :param credentials: Subscription credentials which uniquely identify + client subscription. + :type credentials: None + """ + + def __init__( + self, login_uri, credentials): + + self.config = AzureContainerRegistryConfiguration(login_uri, credentials) + super(AzureContainerRegistry, self).__init__(self.config.credentials, self.config) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self.api_version = '2019-08-15-preview' + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + + self.v2_support = V2SupportOperations( + self._client, self.config, self._serialize, self._deserialize) + self.manifests = ManifestsOperations( + self._client, self.config, self._serialize, self._deserialize) + self.blob = BlobOperations( + self._client, self.config, self._serialize, self._deserialize) + self.repository = RepositoryOperations( + self._client, self.config, self._serialize, self._deserialize) + self.tag = TagOperations( + self._client, self.config, self._serialize, self._deserialize) + self.refresh_tokens = RefreshTokensOperations( + self._client, self.config, self._serialize, self._deserialize) + self.access_tokens = AccessTokensOperations( + self._client, self.config, self._serialize, self._deserialize) diff --git a/sdk/containerregistry/azure-containerregistry/azure/containerregistry/_configuration.py b/sdk/containerregistry/azure-containerregistry/azure/containerregistry/_configuration.py new file mode 100644 index 000000000000..d839ba991f8f --- /dev/null +++ b/sdk/containerregistry/azure-containerregistry/azure/containerregistry/_configuration.py @@ -0,0 +1,46 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest import Configuration + +from .version import VERSION + + +class AzureContainerRegistryConfiguration(Configuration): + """Configuration for AzureContainerRegistry + Note that all parameters used to create this instance are saved as instance + attributes. + + :param login_uri: Registry login URL + :type login_uri: str + :param credentials: Subscription credentials which uniquely identify + client subscription. + :type credentials: None + """ + + def __init__( + self, login_uri, credentials): + + if login_uri is None: + raise ValueError("Parameter 'login_uri' must not be None.") + if credentials is None: + raise ValueError("Parameter 'credentials' must not be None.") + base_url = '{url}' + + super(AzureContainerRegistryConfiguration, self).__init__(base_url) + + # Starting Autorest.Python 4.0.64, make connection pool activated by default + self.keep_alive = True + + self.add_user_agent('azure-containerregistry/{}'.format(VERSION)) + + self.login_uri = login_uri + self.credentials = credentials diff --git a/sdk/containerregistry/azure-containerregistry/azure/containerregistry/models/__init__.py b/sdk/containerregistry/azure-containerregistry/azure/containerregistry/models/__init__.py new file mode 100644 index 000000000000..9e359f9055c5 --- /dev/null +++ b/sdk/containerregistry/azure-containerregistry/azure/containerregistry/models/__init__.py @@ -0,0 +1,121 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +try: + from ._models_py3 import AccessToken + from ._models_py3 import AcrErrorInfo + from ._models_py3 import AcrErrors, AcrErrorsException + from ._models_py3 import AcrManifests + from ._models_py3 import Annotations + from ._models_py3 import ChangeableAttributes + from ._models_py3 import DeletedRepository + from ._models_py3 import Descriptor + from ._models_py3 import FsLayer + from ._models_py3 import History + from ._models_py3 import ImageSignature + from ._models_py3 import JWK + from ._models_py3 import JWKHeader + from ._models_py3 import Manifest + from ._models_py3 import ManifestAttributes + from ._models_py3 import ManifestAttributesBase + from ._models_py3 import ManifestAttributesManifest + from ._models_py3 import ManifestAttributesManifestReferences + from ._models_py3 import ManifestChangeableAttributes + from ._models_py3 import ManifestList + from ._models_py3 import ManifestListAttributes + from ._models_py3 import ManifestWrapper + from ._models_py3 import OCIIndex + from ._models_py3 import OCIManifest + from ._models_py3 import Platform + from ._models_py3 import RefreshToken + from ._models_py3 import Repositories + from ._models_py3 import RepositoryAttributes + from ._models_py3 import RepositoryTags + from ._models_py3 import TagAttributes + from ._models_py3 import TagAttributesBase + from ._models_py3 import TagAttributesTag + from ._models_py3 import TagList + from ._models_py3 import V1Manifest + from ._models_py3 import V2Manifest +except (SyntaxError, ImportError): + from ._models import AccessToken + from ._models import AcrErrorInfo + from ._models import AcrErrors, AcrErrorsException + from ._models import AcrManifests + from ._models import Annotations + from ._models import ChangeableAttributes + from ._models import DeletedRepository + from ._models import Descriptor + from ._models import FsLayer + from ._models import History + from ._models import ImageSignature + from ._models import JWK + from ._models import JWKHeader + from ._models import Manifest + from ._models import ManifestAttributes + from ._models import ManifestAttributesBase + from ._models import ManifestAttributesManifest + from ._models import ManifestAttributesManifestReferences + from ._models import ManifestChangeableAttributes + from ._models import ManifestList + from ._models import ManifestListAttributes + from ._models import ManifestWrapper + from ._models import OCIIndex + from ._models import OCIManifest + from ._models import Platform + from ._models import RefreshToken + from ._models import Repositories + from ._models import RepositoryAttributes + from ._models import RepositoryTags + from ._models import TagAttributes + from ._models import TagAttributesBase + from ._models import TagAttributesTag + from ._models import TagList + from ._models import V1Manifest + from ._models import V2Manifest + +__all__ = [ + 'AccessToken', + 'AcrErrorInfo', + 'AcrErrors', 'AcrErrorsException', + 'AcrManifests', + 'Annotations', + 'ChangeableAttributes', + 'DeletedRepository', + 'Descriptor', + 'FsLayer', + 'History', + 'ImageSignature', + 'JWK', + 'JWKHeader', + 'Manifest', + 'ManifestAttributes', + 'ManifestAttributesBase', + 'ManifestAttributesManifest', + 'ManifestAttributesManifestReferences', + 'ManifestChangeableAttributes', + 'ManifestList', + 'ManifestListAttributes', + 'ManifestWrapper', + 'OCIIndex', + 'OCIManifest', + 'Platform', + 'RefreshToken', + 'Repositories', + 'RepositoryAttributes', + 'RepositoryTags', + 'TagAttributes', + 'TagAttributesBase', + 'TagAttributesTag', + 'TagList', + 'V1Manifest', + 'V2Manifest', +] diff --git a/sdk/containerregistry/azure-containerregistry/azure/containerregistry/models/_models.py b/sdk/containerregistry/azure-containerregistry/azure/containerregistry/models/_models.py new file mode 100644 index 000000000000..6ff0345e7a42 --- /dev/null +++ b/sdk/containerregistry/azure-containerregistry/azure/containerregistry/models/_models.py @@ -0,0 +1,1016 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model +from msrest.exceptions import HttpOperationError + + +class AccessToken(Model): + """AccessToken. + + :param access_token: The access token for performing authenticated + requests + :type access_token: str + """ + + _attribute_map = { + 'access_token': {'key': 'access_token', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(AccessToken, self).__init__(**kwargs) + self.access_token = kwargs.get('access_token', None) + + +class AcrErrorInfo(Model): + """Error information. + + :param code: Error code + :type code: str + :param message: Error message + :type message: str + :param detail: Error details + :type detail: object + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'detail': {'key': 'detail', 'type': 'object'}, + } + + def __init__(self, **kwargs): + super(AcrErrorInfo, self).__init__(**kwargs) + self.code = kwargs.get('code', None) + self.message = kwargs.get('message', None) + self.detail = kwargs.get('detail', None) + + +class AcrErrors(Model): + """Acr error response describing why the operation failed. + + :param errors: Array of detailed error + :type errors: list[~azure.containerregistry.models.AcrErrorInfo] + """ + + _attribute_map = { + 'errors': {'key': 'errors', 'type': '[AcrErrorInfo]'}, + } + + def __init__(self, **kwargs): + super(AcrErrors, self).__init__(**kwargs) + self.errors = kwargs.get('errors', None) + + +class AcrErrorsException(HttpOperationError): + """Server responsed with exception of type: 'AcrErrors'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(AcrErrorsException, self).__init__(deserialize, response, 'AcrErrors', *args) + + +class AcrManifests(Model): + """Manifest attributes. + + :param registry: Registry name + :type registry: str + :param image_name: Image name + :type image_name: str + :param manifests_attributes: List of manifests + :type manifests_attributes: + list[~azure.containerregistry.models.ManifestAttributesBase] + """ + + _attribute_map = { + 'registry': {'key': 'registry', 'type': 'str'}, + 'image_name': {'key': 'imageName', 'type': 'str'}, + 'manifests_attributes': {'key': 'manifests', 'type': '[ManifestAttributesBase]'}, + } + + def __init__(self, **kwargs): + super(AcrManifests, self).__init__(**kwargs) + self.registry = kwargs.get('registry', None) + self.image_name = kwargs.get('image_name', None) + self.manifests_attributes = kwargs.get('manifests_attributes', None) + + +class Annotations(Model): + """Additional information provided through arbitrary metadata. + + :param additional_properties: Unmatched properties from the message are + deserialized this collection + :type additional_properties: dict[str, object] + :param created: Date and time on which the image was built (string, + date-time as defined by https://tools.ietf.org/html/rfc3339#section-5.6) + :type created: datetime + :param authors: Contact details of the people or organization responsible + for the image. + :type authors: str + :param url: URL to find more information on the image. + :type url: str + :param documentation: URL to get documentation on the image. + :type documentation: str + :param source: URL to get source code for building the image. + :type source: str + :param version: Version of the packaged software. The version MAY match a + label or tag in the source code repository, may also be Semantic + versioning-compatible + :type version: str + :param revision: Source control revision identifier for the packaged + software. + :type revision: str + :param vendor: Name of the distributing entity, organization or + individual. + :type vendor: str + :param licenses: License(s) under which contained software is distributed + as an SPDX License Expression. + :type licenses: str + :param name: Name of the reference for a target. + :type name: str + :param title: Human-readable title of the image + :type title: str + :param description: Human-readable description of the software packaged in + the image + :type description: str + """ + + _attribute_map = { + 'additional_properties': {'key': '', 'type': '{object}'}, + 'created': {'key': 'org\\.opencontainers\\.image\\.created', 'type': 'iso-8601'}, + 'authors': {'key': 'org\\.opencontainers\\.image\\.authors', 'type': 'str'}, + 'url': {'key': 'org\\.opencontainers\\.image\\.url', 'type': 'str'}, + 'documentation': {'key': 'org\\.opencontainers\\.image\\.documentation', 'type': 'str'}, + 'source': {'key': 'org\\.opencontainers\\.image\\.source', 'type': 'str'}, + 'version': {'key': 'org\\.opencontainers\\.image\\.version', 'type': 'str'}, + 'revision': {'key': 'org\\.opencontainers\\.image\\.revision', 'type': 'str'}, + 'vendor': {'key': 'org\\.opencontainers\\.image\\.vendor', 'type': 'str'}, + 'licenses': {'key': 'org\\.opencontainers\\.image\\.licenses', 'type': 'str'}, + 'name': {'key': 'org\\.opencontainers\\.image\\.ref\\.name', 'type': 'str'}, + 'title': {'key': 'org\\.opencontainers\\.image\\.title', 'type': 'str'}, + 'description': {'key': 'org\\.opencontainers\\.image\\.description', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(Annotations, self).__init__(**kwargs) + self.additional_properties = kwargs.get('additional_properties', None) + self.created = kwargs.get('created', None) + self.authors = kwargs.get('authors', None) + self.url = kwargs.get('url', None) + self.documentation = kwargs.get('documentation', None) + self.source = kwargs.get('source', None) + self.version = kwargs.get('version', None) + self.revision = kwargs.get('revision', None) + self.vendor = kwargs.get('vendor', None) + self.licenses = kwargs.get('licenses', None) + self.name = kwargs.get('name', None) + self.title = kwargs.get('title', None) + self.description = kwargs.get('description', None) + + +class ChangeableAttributes(Model): + """ChangeableAttributes. + + :param delete_enabled: Delete enabled + :type delete_enabled: bool + :param write_enabled: Write enabled + :type write_enabled: bool + :param list_enabled: List enabled + :type list_enabled: bool + :param read_enabled: Read enabled + :type read_enabled: bool + """ + + _attribute_map = { + 'delete_enabled': {'key': 'deleteEnabled', 'type': 'bool'}, + 'write_enabled': {'key': 'writeEnabled', 'type': 'bool'}, + 'list_enabled': {'key': 'listEnabled', 'type': 'bool'}, + 'read_enabled': {'key': 'readEnabled', 'type': 'bool'}, + } + + def __init__(self, **kwargs): + super(ChangeableAttributes, self).__init__(**kwargs) + self.delete_enabled = kwargs.get('delete_enabled', None) + self.write_enabled = kwargs.get('write_enabled', None) + self.list_enabled = kwargs.get('list_enabled', None) + self.read_enabled = kwargs.get('read_enabled', None) + + +class DeletedRepository(Model): + """Deleted repository. + + :param manifests_deleted: SHA of the deleted image + :type manifests_deleted: list[str] + :param tags_deleted: Tag of the deleted image + :type tags_deleted: list[str] + """ + + _attribute_map = { + 'manifests_deleted': {'key': 'manifestsDeleted', 'type': '[str]'}, + 'tags_deleted': {'key': 'tagsDeleted', 'type': '[str]'}, + } + + def __init__(self, **kwargs): + super(DeletedRepository, self).__init__(**kwargs) + self.manifests_deleted = kwargs.get('manifests_deleted', None) + self.tags_deleted = kwargs.get('tags_deleted', None) + + +class Descriptor(Model): + """Docker V2 image layer descriptor including config and layers. + + :param media_type: Layer media type + :type media_type: str + :param size: Layer size + :type size: long + :param digest: Layer digest + :type digest: str + :param urls: Specifies a list of URIs from which this object may be + downloaded. + :type urls: list[str] + :param annotations: + :type annotations: ~azure.containerregistry.models.Annotations + """ + + _attribute_map = { + 'media_type': {'key': 'mediaType', 'type': 'str'}, + 'size': {'key': 'size', 'type': 'long'}, + 'digest': {'key': 'digest', 'type': 'str'}, + 'urls': {'key': 'urls', 'type': '[str]'}, + 'annotations': {'key': 'annotations', 'type': 'Annotations'}, + } + + def __init__(self, **kwargs): + super(Descriptor, self).__init__(**kwargs) + self.media_type = kwargs.get('media_type', None) + self.size = kwargs.get('size', None) + self.digest = kwargs.get('digest', None) + self.urls = kwargs.get('urls', None) + self.annotations = kwargs.get('annotations', None) + + +class FsLayer(Model): + """Image layer information. + + :param blob_sum: SHA of an image layer + :type blob_sum: str + """ + + _attribute_map = { + 'blob_sum': {'key': 'blobSum', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(FsLayer, self).__init__(**kwargs) + self.blob_sum = kwargs.get('blob_sum', None) + + +class History(Model): + """A list of unstructured historical data for v1 compatibility. + + :param v1_compatibility: The raw v1 compatibility information + :type v1_compatibility: str + """ + + _attribute_map = { + 'v1_compatibility': {'key': 'v1Compatibility', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(History, self).__init__(**kwargs) + self.v1_compatibility = kwargs.get('v1_compatibility', None) + + +class ImageSignature(Model): + """Signature of a signed manifest. + + :param header: A JSON web signature + :type header: ~azure.containerregistry.models.JWK + :param signature: A signature for the image manifest, signed by a libtrust + private key + :type signature: str + :param protected: The signed protected header + :type protected: str + """ + + _attribute_map = { + 'header': {'key': 'header', 'type': 'JWK'}, + 'signature': {'key': 'signature', 'type': 'str'}, + 'protected': {'key': 'protected', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ImageSignature, self).__init__(**kwargs) + self.header = kwargs.get('header', None) + self.signature = kwargs.get('signature', None) + self.protected = kwargs.get('protected', None) + + +class JWK(Model): + """A JSON web signature. + + :param jwk: + :type jwk: ~azure.containerregistry.models.JWKHeader + :param alg: The algorithm used to sign or encrypt the JWT + :type alg: str + """ + + _attribute_map = { + 'jwk': {'key': 'jwk', 'type': 'JWKHeader'}, + 'alg': {'key': 'alg', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(JWK, self).__init__(**kwargs) + self.jwk = kwargs.get('jwk', None) + self.alg = kwargs.get('alg', None) + + +class JWKHeader(Model): + """JSON web key parameter. + + :param crv: crv value + :type crv: str + :param kid: kid value + :type kid: str + :param kty: kty value + :type kty: str + :param x: x value + :type x: str + :param y: y value + :type y: str + """ + + _attribute_map = { + 'crv': {'key': 'crv', 'type': 'str'}, + 'kid': {'key': 'kid', 'type': 'str'}, + 'kty': {'key': 'kty', 'type': 'str'}, + 'x': {'key': 'x', 'type': 'str'}, + 'y': {'key': 'y', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(JWKHeader, self).__init__(**kwargs) + self.crv = kwargs.get('crv', None) + self.kid = kwargs.get('kid', None) + self.kty = kwargs.get('kty', None) + self.x = kwargs.get('x', None) + self.y = kwargs.get('y', None) + + +class Manifest(Model): + """Returns the requested manifest file. + + :param schema_version: Schema version + :type schema_version: int + """ + + _attribute_map = { + 'schema_version': {'key': 'schemaVersion', 'type': 'int'}, + } + + def __init__(self, **kwargs): + super(Manifest, self).__init__(**kwargs) + self.schema_version = kwargs.get('schema_version', None) + + +class ManifestAttributes(Model): + """Manifest attributes details. + + :param registry: Registry name + :type registry: str + :param image_name: Image name + :type image_name: str + :param attributes: Manifest attributes + :type attributes: ~azure.containerregistry.models.ManifestAttributesBase + """ + + _attribute_map = { + 'registry': {'key': 'registry', 'type': 'str'}, + 'image_name': {'key': 'imageName', 'type': 'str'}, + 'attributes': {'key': 'manifest', 'type': 'ManifestAttributesBase'}, + } + + def __init__(self, **kwargs): + super(ManifestAttributes, self).__init__(**kwargs) + self.registry = kwargs.get('registry', None) + self.image_name = kwargs.get('image_name', None) + self.attributes = kwargs.get('attributes', None) + + +class ManifestAttributesBase(Model): + """Manifest details. + + :param digest: Manifest + :type digest: str + :param image_size: Image size + :type image_size: long + :param created_time: Created time + :type created_time: str + :param last_update_time: Last update time + :type last_update_time: str + :param architecture: CPU architecture + :type architecture: str + :param os: Operating system + :type os: str + :param media_type: Media type + :type media_type: str + :param config_media_type: Config blob media type + :type config_media_type: str + :param tags: List of tags + :type tags: list[str] + :param changeable_attributes: Changeable attributes + :type changeable_attributes: + ~azure.containerregistry.models.ChangeableAttributes + """ + + _attribute_map = { + 'digest': {'key': 'digest', 'type': 'str'}, + 'image_size': {'key': 'imageSize', 'type': 'long'}, + 'created_time': {'key': 'createdTime', 'type': 'str'}, + 'last_update_time': {'key': 'lastUpdateTime', 'type': 'str'}, + 'architecture': {'key': 'architecture', 'type': 'str'}, + 'os': {'key': 'os', 'type': 'str'}, + 'media_type': {'key': 'mediaType', 'type': 'str'}, + 'config_media_type': {'key': 'configMediaType', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '[str]'}, + 'changeable_attributes': {'key': 'changeableAttributes', 'type': 'ChangeableAttributes'}, + } + + def __init__(self, **kwargs): + super(ManifestAttributesBase, self).__init__(**kwargs) + self.digest = kwargs.get('digest', None) + self.image_size = kwargs.get('image_size', None) + self.created_time = kwargs.get('created_time', None) + self.last_update_time = kwargs.get('last_update_time', None) + self.architecture = kwargs.get('architecture', None) + self.os = kwargs.get('os', None) + self.media_type = kwargs.get('media_type', None) + self.config_media_type = kwargs.get('config_media_type', None) + self.tags = kwargs.get('tags', None) + self.changeable_attributes = kwargs.get('changeable_attributes', None) + + +class ManifestAttributesManifest(Model): + """List of manifest attributes. + + :param references: List of manifest attributes details + :type references: + list[~azure.containerregistry.models.ManifestAttributesManifestReferences] + :param quarantine_tag: Quarantine tag name + :type quarantine_tag: str + """ + + _attribute_map = { + 'references': {'key': 'references', 'type': '[ManifestAttributesManifestReferences]'}, + 'quarantine_tag': {'key': 'quarantineTag', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ManifestAttributesManifest, self).__init__(**kwargs) + self.references = kwargs.get('references', None) + self.quarantine_tag = kwargs.get('quarantine_tag', None) + + +class ManifestAttributesManifestReferences(Model): + """Manifest attributes details. + + :param digest: Manifest digest + :type digest: str + :param architecture: CPU architecture + :type architecture: str + :param os: Operating system + :type os: str + """ + + _attribute_map = { + 'digest': {'key': 'digest', 'type': 'str'}, + 'architecture': {'key': 'architecture', 'type': 'str'}, + 'os': {'key': 'os', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ManifestAttributesManifestReferences, self).__init__(**kwargs) + self.digest = kwargs.get('digest', None) + self.architecture = kwargs.get('architecture', None) + self.os = kwargs.get('os', None) + + +class ManifestChangeableAttributes(Model): + """Changeable attributes. + + :param delete_enabled: Delete enabled + :type delete_enabled: bool + :param write_enabled: Write enabled + :type write_enabled: bool + :param list_enabled: List enabled + :type list_enabled: bool + :param read_enabled: Read enabled + :type read_enabled: bool + :param quarantine_state: Quarantine state + :type quarantine_state: str + :param quarantine_details: Quarantine details + :type quarantine_details: str + """ + + _attribute_map = { + 'delete_enabled': {'key': 'deleteEnabled', 'type': 'bool'}, + 'write_enabled': {'key': 'writeEnabled', 'type': 'bool'}, + 'list_enabled': {'key': 'listEnabled', 'type': 'bool'}, + 'read_enabled': {'key': 'readEnabled', 'type': 'bool'}, + 'quarantine_state': {'key': 'quarantineState', 'type': 'str'}, + 'quarantine_details': {'key': 'quarantineDetails', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ManifestChangeableAttributes, self).__init__(**kwargs) + self.delete_enabled = kwargs.get('delete_enabled', None) + self.write_enabled = kwargs.get('write_enabled', None) + self.list_enabled = kwargs.get('list_enabled', None) + self.read_enabled = kwargs.get('read_enabled', None) + self.quarantine_state = kwargs.get('quarantine_state', None) + self.quarantine_details = kwargs.get('quarantine_details', None) + + +class ManifestList(Manifest): + """Returns the requested Docker multi-arch-manifest file. + + :param schema_version: Schema version + :type schema_version: int + :param media_type: Media type for this Manifest + :type media_type: str + :param manifests: List of V2 image layer information + :type manifests: + list[~azure.containerregistry.models.ManifestListAttributes] + """ + + _attribute_map = { + 'schema_version': {'key': 'schemaVersion', 'type': 'int'}, + 'media_type': {'key': 'mediaType', 'type': 'str'}, + 'manifests': {'key': 'manifests', 'type': '[ManifestListAttributes]'}, + } + + def __init__(self, **kwargs): + super(ManifestList, self).__init__(**kwargs) + self.media_type = kwargs.get('media_type', None) + self.manifests = kwargs.get('manifests', None) + + +class ManifestListAttributes(Model): + """ManifestListAttributes. + + :param media_type: The MIME type of the referenced object. This will + generally be application/vnd.docker.image.manifest.v2+json, but it could + also be application/vnd.docker.image.manifest.v1+json + :type media_type: str + :param size: The size in bytes of the object + :type size: long + :param digest: The digest of the content, as defined by the Registry V2 + HTTP API Specification + :type digest: str + :param platform: + :type platform: ~azure.containerregistry.models.Platform + """ + + _attribute_map = { + 'media_type': {'key': 'mediaType', 'type': 'str'}, + 'size': {'key': 'size', 'type': 'long'}, + 'digest': {'key': 'digest', 'type': 'str'}, + 'platform': {'key': 'platform', 'type': 'Platform'}, + } + + def __init__(self, **kwargs): + super(ManifestListAttributes, self).__init__(**kwargs) + self.media_type = kwargs.get('media_type', None) + self.size = kwargs.get('size', None) + self.digest = kwargs.get('digest', None) + self.platform = kwargs.get('platform', None) + + +class ManifestWrapper(Manifest): + """Returns the requested manifest file. + + :param schema_version: Schema version + :type schema_version: int + :param media_type: Media type for this Manifest + :type media_type: str + :param manifests: (ManifestList, OCIIndex) List of V2 image layer + information + :type manifests: + list[~azure.containerregistry.models.ManifestListAttributes] + :param config: (V2, OCI) Image config descriptor + :type config: ~azure.containerregistry.models.Descriptor + :param layers: (V2, OCI) List of V2 image layer information + :type layers: list[~azure.containerregistry.models.Descriptor] + :param annotations: (OCI, OCIIndex) Additional metadata + :type annotations: ~azure.containerregistry.models.Annotations + :param architecture: (V1) CPU architecture + :type architecture: str + :param name: (V1) Image name + :type name: str + :param tag: (V1) Image tag + :type tag: str + :param fs_layers: (V1) List of layer information + :type fs_layers: list[~azure.containerregistry.models.FsLayer] + :param history: (V1) Image history + :type history: list[~azure.containerregistry.models.History] + :param signatures: (V1) Image signature + :type signatures: list[~azure.containerregistry.models.ImageSignature] + """ + + _attribute_map = { + 'schema_version': {'key': 'schemaVersion', 'type': 'int'}, + 'media_type': {'key': 'mediaType', 'type': 'str'}, + 'manifests': {'key': 'manifests', 'type': '[ManifestListAttributes]'}, + 'config': {'key': 'config', 'type': 'Descriptor'}, + 'layers': {'key': 'layers', 'type': '[Descriptor]'}, + 'annotations': {'key': 'annotations', 'type': 'Annotations'}, + 'architecture': {'key': 'architecture', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'tag': {'key': 'tag', 'type': 'str'}, + 'fs_layers': {'key': 'fsLayers', 'type': '[FsLayer]'}, + 'history': {'key': 'history', 'type': '[History]'}, + 'signatures': {'key': 'signatures', 'type': '[ImageSignature]'}, + } + + def __init__(self, **kwargs): + super(ManifestWrapper, self).__init__(**kwargs) + self.media_type = kwargs.get('media_type', None) + self.manifests = kwargs.get('manifests', None) + self.config = kwargs.get('config', None) + self.layers = kwargs.get('layers', None) + self.annotations = kwargs.get('annotations', None) + self.architecture = kwargs.get('architecture', None) + self.name = kwargs.get('name', None) + self.tag = kwargs.get('tag', None) + self.fs_layers = kwargs.get('fs_layers', None) + self.history = kwargs.get('history', None) + self.signatures = kwargs.get('signatures', None) + + +class OCIIndex(Manifest): + """Returns the requested OCI index file. + + :param schema_version: Schema version + :type schema_version: int + :param manifests: List of OCI image layer information + :type manifests: + list[~azure.containerregistry.models.ManifestListAttributes] + :param annotations: + :type annotations: ~azure.containerregistry.models.Annotations + """ + + _attribute_map = { + 'schema_version': {'key': 'schemaVersion', 'type': 'int'}, + 'manifests': {'key': 'manifests', 'type': '[ManifestListAttributes]'}, + 'annotations': {'key': 'annotations', 'type': 'Annotations'}, + } + + def __init__(self, **kwargs): + super(OCIIndex, self).__init__(**kwargs) + self.manifests = kwargs.get('manifests', None) + self.annotations = kwargs.get('annotations', None) + + +class OCIManifest(Manifest): + """Returns the requested OCI Manifest file. + + :param schema_version: Schema version + :type schema_version: int + :param config: V2 image config descriptor + :type config: ~azure.containerregistry.models.Descriptor + :param layers: List of V2 image layer information + :type layers: list[~azure.containerregistry.models.Descriptor] + :param annotations: + :type annotations: ~azure.containerregistry.models.Annotations + """ + + _attribute_map = { + 'schema_version': {'key': 'schemaVersion', 'type': 'int'}, + 'config': {'key': 'config', 'type': 'Descriptor'}, + 'layers': {'key': 'layers', 'type': '[Descriptor]'}, + 'annotations': {'key': 'annotations', 'type': 'Annotations'}, + } + + def __init__(self, **kwargs): + super(OCIManifest, self).__init__(**kwargs) + self.config = kwargs.get('config', None) + self.layers = kwargs.get('layers', None) + self.annotations = kwargs.get('annotations', None) + + +class Platform(Model): + """The platform object describes the platform which the image in the manifest + runs on. A full list of valid operating system and architecture values are + listed in the Go language documentation for $GOOS and $GOARCH. + + :param architecture: Specifies the CPU architecture, for example amd64 or + ppc64le. + :type architecture: str + :param os: The os field specifies the operating system, for example linux + or windows. + :type os: str + :param osversion: The optional os.version field specifies the operating + system version, for example 10.0.10586. + :type osversion: str + :param osfeatures: The optional os.features field specifies an array of + strings, each listing a required OS feature (for example on Windows win32k + :type osfeatures: list[str] + :param variant: The optional variant field specifies a variant of the CPU, + for example armv6l to specify a particular CPU variant of the ARM CPU. + :type variant: str + :param features: The optional features field specifies an array of + strings, each listing a required CPU feature (for example sse4 or aes + :type features: list[str] + """ + + _attribute_map = { + 'architecture': {'key': 'architecture', 'type': 'str'}, + 'os': {'key': 'os', 'type': 'str'}, + 'osversion': {'key': 'os\\.version', 'type': 'str'}, + 'osfeatures': {'key': 'os\\.features', 'type': '[str]'}, + 'variant': {'key': 'variant', 'type': 'str'}, + 'features': {'key': 'features', 'type': '[str]'}, + } + + def __init__(self, **kwargs): + super(Platform, self).__init__(**kwargs) + self.architecture = kwargs.get('architecture', None) + self.os = kwargs.get('os', None) + self.osversion = kwargs.get('osversion', None) + self.osfeatures = kwargs.get('osfeatures', None) + self.variant = kwargs.get('variant', None) + self.features = kwargs.get('features', None) + + +class RefreshToken(Model): + """RefreshToken. + + :param refresh_token: The refresh token to be used for generating access + tokens + :type refresh_token: str + """ + + _attribute_map = { + 'refresh_token': {'key': 'refresh_token', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(RefreshToken, self).__init__(**kwargs) + self.refresh_token = kwargs.get('refresh_token', None) + + +class Repositories(Model): + """List of repositories. + + :param names: Repository names + :type names: list[str] + """ + + _attribute_map = { + 'names': {'key': 'repositories', 'type': '[str]'}, + } + + def __init__(self, **kwargs): + super(Repositories, self).__init__(**kwargs) + self.names = kwargs.get('names', None) + + +class RepositoryAttributes(Model): + """Repository attributes. + + :param registry: Registry name + :type registry: str + :param image_name: Image name + :type image_name: str + :param created_time: Image created time + :type created_time: str + :param last_update_time: Image last update time + :type last_update_time: str + :param manifest_count: Number of the manifests + :type manifest_count: int + :param tag_count: Number of the tags + :type tag_count: int + :param changeable_attributes: Changeable attributes + :type changeable_attributes: + ~azure.containerregistry.models.ChangeableAttributes + """ + + _attribute_map = { + 'registry': {'key': 'registry', 'type': 'str'}, + 'image_name': {'key': 'imageName', 'type': 'str'}, + 'created_time': {'key': 'createdTime', 'type': 'str'}, + 'last_update_time': {'key': 'lastUpdateTime', 'type': 'str'}, + 'manifest_count': {'key': 'manifestCount', 'type': 'int'}, + 'tag_count': {'key': 'tagCount', 'type': 'int'}, + 'changeable_attributes': {'key': 'changeableAttributes', 'type': 'ChangeableAttributes'}, + } + + def __init__(self, **kwargs): + super(RepositoryAttributes, self).__init__(**kwargs) + self.registry = kwargs.get('registry', None) + self.image_name = kwargs.get('image_name', None) + self.created_time = kwargs.get('created_time', None) + self.last_update_time = kwargs.get('last_update_time', None) + self.manifest_count = kwargs.get('manifest_count', None) + self.tag_count = kwargs.get('tag_count', None) + self.changeable_attributes = kwargs.get('changeable_attributes', None) + + +class RepositoryTags(Model): + """Result of the request to list tags of the image. + + :param name: Name of the image + :type name: str + :param tags: List of tags + :type tags: list[str] + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '[str]'}, + } + + def __init__(self, **kwargs): + super(RepositoryTags, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.tags = kwargs.get('tags', None) + + +class TagAttributes(Model): + """Tag attributes. + + :param registry: Registry name + :type registry: str + :param image_name: Image name + :type image_name: str + :param attributes: List of tag attribute details + :type attributes: ~azure.containerregistry.models.TagAttributesBase + """ + + _attribute_map = { + 'registry': {'key': 'registry', 'type': 'str'}, + 'image_name': {'key': 'imageName', 'type': 'str'}, + 'attributes': {'key': 'tag', 'type': 'TagAttributesBase'}, + } + + def __init__(self, **kwargs): + super(TagAttributes, self).__init__(**kwargs) + self.registry = kwargs.get('registry', None) + self.image_name = kwargs.get('image_name', None) + self.attributes = kwargs.get('attributes', None) + + +class TagAttributesBase(Model): + """Tag attribute details. + + :param name: Tag name + :type name: str + :param digest: Tag digest + :type digest: str + :param created_time: Tag created time + :type created_time: str + :param last_update_time: Tag last update time + :type last_update_time: str + :param signed: Is signed + :type signed: bool + :param changeable_attributes: Changeable attributes + :type changeable_attributes: + ~azure.containerregistry.models.ChangeableAttributes + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'digest': {'key': 'digest', 'type': 'str'}, + 'created_time': {'key': 'createdTime', 'type': 'str'}, + 'last_update_time': {'key': 'lastUpdateTime', 'type': 'str'}, + 'signed': {'key': 'signed', 'type': 'bool'}, + 'changeable_attributes': {'key': 'changeableAttributes', 'type': 'ChangeableAttributes'}, + } + + def __init__(self, **kwargs): + super(TagAttributesBase, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.digest = kwargs.get('digest', None) + self.created_time = kwargs.get('created_time', None) + self.last_update_time = kwargs.get('last_update_time', None) + self.signed = kwargs.get('signed', None) + self.changeable_attributes = kwargs.get('changeable_attributes', None) + + +class TagAttributesTag(Model): + """Tag. + + :param signature_record: SignatureRecord value + :type signature_record: str + """ + + _attribute_map = { + 'signature_record': {'key': 'signatureRecord', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(TagAttributesTag, self).__init__(**kwargs) + self.signature_record = kwargs.get('signature_record', None) + + +class TagList(Model): + """List of tag details. + + :param registry: Registry name + :type registry: str + :param image_name: Image name + :type image_name: str + :param tags: List of tag attribute details + :type tags: list[~azure.containerregistry.models.TagAttributesBase] + """ + + _attribute_map = { + 'registry': {'key': 'registry', 'type': 'str'}, + 'image_name': {'key': 'imageName', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '[TagAttributesBase]'}, + } + + def __init__(self, **kwargs): + super(TagList, self).__init__(**kwargs) + self.registry = kwargs.get('registry', None) + self.image_name = kwargs.get('image_name', None) + self.tags = kwargs.get('tags', None) + + +class V1Manifest(Manifest): + """Returns the requested V1 manifest file. + + :param schema_version: Schema version + :type schema_version: int + :param architecture: CPU architecture + :type architecture: str + :param name: Image name + :type name: str + :param tag: Image tag + :type tag: str + :param fs_layers: List of layer information + :type fs_layers: list[~azure.containerregistry.models.FsLayer] + :param history: Image history + :type history: list[~azure.containerregistry.models.History] + :param signatures: Image signature + :type signatures: list[~azure.containerregistry.models.ImageSignature] + """ + + _attribute_map = { + 'schema_version': {'key': 'schemaVersion', 'type': 'int'}, + 'architecture': {'key': 'architecture', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'tag': {'key': 'tag', 'type': 'str'}, + 'fs_layers': {'key': 'fsLayers', 'type': '[FsLayer]'}, + 'history': {'key': 'history', 'type': '[History]'}, + 'signatures': {'key': 'signatures', 'type': '[ImageSignature]'}, + } + + def __init__(self, **kwargs): + super(V1Manifest, self).__init__(**kwargs) + self.architecture = kwargs.get('architecture', None) + self.name = kwargs.get('name', None) + self.tag = kwargs.get('tag', None) + self.fs_layers = kwargs.get('fs_layers', None) + self.history = kwargs.get('history', None) + self.signatures = kwargs.get('signatures', None) + + +class V2Manifest(Manifest): + """Returns the requested Docker V2 Manifest file. + + :param schema_version: Schema version + :type schema_version: int + :param media_type: Media type for this Manifest + :type media_type: str + :param config: V2 image config descriptor + :type config: ~azure.containerregistry.models.Descriptor + :param layers: List of V2 image layer information + :type layers: list[~azure.containerregistry.models.Descriptor] + """ + + _attribute_map = { + 'schema_version': {'key': 'schemaVersion', 'type': 'int'}, + 'media_type': {'key': 'mediaType', 'type': 'str'}, + 'config': {'key': 'config', 'type': 'Descriptor'}, + 'layers': {'key': 'layers', 'type': '[Descriptor]'}, + } + + def __init__(self, **kwargs): + super(V2Manifest, self).__init__(**kwargs) + self.media_type = kwargs.get('media_type', None) + self.config = kwargs.get('config', None) + self.layers = kwargs.get('layers', None) diff --git a/sdk/containerregistry/azure-containerregistry/azure/containerregistry/models/_models_py3.py b/sdk/containerregistry/azure-containerregistry/azure/containerregistry/models/_models_py3.py new file mode 100644 index 000000000000..a6be006cd493 --- /dev/null +++ b/sdk/containerregistry/azure-containerregistry/azure/containerregistry/models/_models_py3.py @@ -0,0 +1,1016 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model +from msrest.exceptions import HttpOperationError + + +class AccessToken(Model): + """AccessToken. + + :param access_token: The access token for performing authenticated + requests + :type access_token: str + """ + + _attribute_map = { + 'access_token': {'key': 'access_token', 'type': 'str'}, + } + + def __init__(self, *, access_token: str=None, **kwargs) -> None: + super(AccessToken, self).__init__(**kwargs) + self.access_token = access_token + + +class AcrErrorInfo(Model): + """Error information. + + :param code: Error code + :type code: str + :param message: Error message + :type message: str + :param detail: Error details + :type detail: object + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'detail': {'key': 'detail', 'type': 'object'}, + } + + def __init__(self, *, code: str=None, message: str=None, detail=None, **kwargs) -> None: + super(AcrErrorInfo, self).__init__(**kwargs) + self.code = code + self.message = message + self.detail = detail + + +class AcrErrors(Model): + """Acr error response describing why the operation failed. + + :param errors: Array of detailed error + :type errors: list[~azure.containerregistry.models.AcrErrorInfo] + """ + + _attribute_map = { + 'errors': {'key': 'errors', 'type': '[AcrErrorInfo]'}, + } + + def __init__(self, *, errors=None, **kwargs) -> None: + super(AcrErrors, self).__init__(**kwargs) + self.errors = errors + + +class AcrErrorsException(HttpOperationError): + """Server responsed with exception of type: 'AcrErrors'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(AcrErrorsException, self).__init__(deserialize, response, 'AcrErrors', *args) + + +class AcrManifests(Model): + """Manifest attributes. + + :param registry: Registry name + :type registry: str + :param image_name: Image name + :type image_name: str + :param manifests_attributes: List of manifests + :type manifests_attributes: + list[~azure.containerregistry.models.ManifestAttributesBase] + """ + + _attribute_map = { + 'registry': {'key': 'registry', 'type': 'str'}, + 'image_name': {'key': 'imageName', 'type': 'str'}, + 'manifests_attributes': {'key': 'manifests', 'type': '[ManifestAttributesBase]'}, + } + + def __init__(self, *, registry: str=None, image_name: str=None, manifests_attributes=None, **kwargs) -> None: + super(AcrManifests, self).__init__(**kwargs) + self.registry = registry + self.image_name = image_name + self.manifests_attributes = manifests_attributes + + +class Annotations(Model): + """Additional information provided through arbitrary metadata. + + :param additional_properties: Unmatched properties from the message are + deserialized this collection + :type additional_properties: dict[str, object] + :param created: Date and time on which the image was built (string, + date-time as defined by https://tools.ietf.org/html/rfc3339#section-5.6) + :type created: datetime + :param authors: Contact details of the people or organization responsible + for the image. + :type authors: str + :param url: URL to find more information on the image. + :type url: str + :param documentation: URL to get documentation on the image. + :type documentation: str + :param source: URL to get source code for building the image. + :type source: str + :param version: Version of the packaged software. The version MAY match a + label or tag in the source code repository, may also be Semantic + versioning-compatible + :type version: str + :param revision: Source control revision identifier for the packaged + software. + :type revision: str + :param vendor: Name of the distributing entity, organization or + individual. + :type vendor: str + :param licenses: License(s) under which contained software is distributed + as an SPDX License Expression. + :type licenses: str + :param name: Name of the reference for a target. + :type name: str + :param title: Human-readable title of the image + :type title: str + :param description: Human-readable description of the software packaged in + the image + :type description: str + """ + + _attribute_map = { + 'additional_properties': {'key': '', 'type': '{object}'}, + 'created': {'key': 'org\\.opencontainers\\.image\\.created', 'type': 'iso-8601'}, + 'authors': {'key': 'org\\.opencontainers\\.image\\.authors', 'type': 'str'}, + 'url': {'key': 'org\\.opencontainers\\.image\\.url', 'type': 'str'}, + 'documentation': {'key': 'org\\.opencontainers\\.image\\.documentation', 'type': 'str'}, + 'source': {'key': 'org\\.opencontainers\\.image\\.source', 'type': 'str'}, + 'version': {'key': 'org\\.opencontainers\\.image\\.version', 'type': 'str'}, + 'revision': {'key': 'org\\.opencontainers\\.image\\.revision', 'type': 'str'}, + 'vendor': {'key': 'org\\.opencontainers\\.image\\.vendor', 'type': 'str'}, + 'licenses': {'key': 'org\\.opencontainers\\.image\\.licenses', 'type': 'str'}, + 'name': {'key': 'org\\.opencontainers\\.image\\.ref\\.name', 'type': 'str'}, + 'title': {'key': 'org\\.opencontainers\\.image\\.title', 'type': 'str'}, + 'description': {'key': 'org\\.opencontainers\\.image\\.description', 'type': 'str'}, + } + + def __init__(self, *, additional_properties=None, created=None, authors: str=None, url: str=None, documentation: str=None, source: str=None, version: str=None, revision: str=None, vendor: str=None, licenses: str=None, name: str=None, title: str=None, description: str=None, **kwargs) -> None: + super(Annotations, self).__init__(**kwargs) + self.additional_properties = additional_properties + self.created = created + self.authors = authors + self.url = url + self.documentation = documentation + self.source = source + self.version = version + self.revision = revision + self.vendor = vendor + self.licenses = licenses + self.name = name + self.title = title + self.description = description + + +class ChangeableAttributes(Model): + """ChangeableAttributes. + + :param delete_enabled: Delete enabled + :type delete_enabled: bool + :param write_enabled: Write enabled + :type write_enabled: bool + :param list_enabled: List enabled + :type list_enabled: bool + :param read_enabled: Read enabled + :type read_enabled: bool + """ + + _attribute_map = { + 'delete_enabled': {'key': 'deleteEnabled', 'type': 'bool'}, + 'write_enabled': {'key': 'writeEnabled', 'type': 'bool'}, + 'list_enabled': {'key': 'listEnabled', 'type': 'bool'}, + 'read_enabled': {'key': 'readEnabled', 'type': 'bool'}, + } + + def __init__(self, *, delete_enabled: bool=None, write_enabled: bool=None, list_enabled: bool=None, read_enabled: bool=None, **kwargs) -> None: + super(ChangeableAttributes, self).__init__(**kwargs) + self.delete_enabled = delete_enabled + self.write_enabled = write_enabled + self.list_enabled = list_enabled + self.read_enabled = read_enabled + + +class DeletedRepository(Model): + """Deleted repository. + + :param manifests_deleted: SHA of the deleted image + :type manifests_deleted: list[str] + :param tags_deleted: Tag of the deleted image + :type tags_deleted: list[str] + """ + + _attribute_map = { + 'manifests_deleted': {'key': 'manifestsDeleted', 'type': '[str]'}, + 'tags_deleted': {'key': 'tagsDeleted', 'type': '[str]'}, + } + + def __init__(self, *, manifests_deleted=None, tags_deleted=None, **kwargs) -> None: + super(DeletedRepository, self).__init__(**kwargs) + self.manifests_deleted = manifests_deleted + self.tags_deleted = tags_deleted + + +class Descriptor(Model): + """Docker V2 image layer descriptor including config and layers. + + :param media_type: Layer media type + :type media_type: str + :param size: Layer size + :type size: long + :param digest: Layer digest + :type digest: str + :param urls: Specifies a list of URIs from which this object may be + downloaded. + :type urls: list[str] + :param annotations: + :type annotations: ~azure.containerregistry.models.Annotations + """ + + _attribute_map = { + 'media_type': {'key': 'mediaType', 'type': 'str'}, + 'size': {'key': 'size', 'type': 'long'}, + 'digest': {'key': 'digest', 'type': 'str'}, + 'urls': {'key': 'urls', 'type': '[str]'}, + 'annotations': {'key': 'annotations', 'type': 'Annotations'}, + } + + def __init__(self, *, media_type: str=None, size: int=None, digest: str=None, urls=None, annotations=None, **kwargs) -> None: + super(Descriptor, self).__init__(**kwargs) + self.media_type = media_type + self.size = size + self.digest = digest + self.urls = urls + self.annotations = annotations + + +class FsLayer(Model): + """Image layer information. + + :param blob_sum: SHA of an image layer + :type blob_sum: str + """ + + _attribute_map = { + 'blob_sum': {'key': 'blobSum', 'type': 'str'}, + } + + def __init__(self, *, blob_sum: str=None, **kwargs) -> None: + super(FsLayer, self).__init__(**kwargs) + self.blob_sum = blob_sum + + +class History(Model): + """A list of unstructured historical data for v1 compatibility. + + :param v1_compatibility: The raw v1 compatibility information + :type v1_compatibility: str + """ + + _attribute_map = { + 'v1_compatibility': {'key': 'v1Compatibility', 'type': 'str'}, + } + + def __init__(self, *, v1_compatibility: str=None, **kwargs) -> None: + super(History, self).__init__(**kwargs) + self.v1_compatibility = v1_compatibility + + +class ImageSignature(Model): + """Signature of a signed manifest. + + :param header: A JSON web signature + :type header: ~azure.containerregistry.models.JWK + :param signature: A signature for the image manifest, signed by a libtrust + private key + :type signature: str + :param protected: The signed protected header + :type protected: str + """ + + _attribute_map = { + 'header': {'key': 'header', 'type': 'JWK'}, + 'signature': {'key': 'signature', 'type': 'str'}, + 'protected': {'key': 'protected', 'type': 'str'}, + } + + def __init__(self, *, header=None, signature: str=None, protected: str=None, **kwargs) -> None: + super(ImageSignature, self).__init__(**kwargs) + self.header = header + self.signature = signature + self.protected = protected + + +class JWK(Model): + """A JSON web signature. + + :param jwk: + :type jwk: ~azure.containerregistry.models.JWKHeader + :param alg: The algorithm used to sign or encrypt the JWT + :type alg: str + """ + + _attribute_map = { + 'jwk': {'key': 'jwk', 'type': 'JWKHeader'}, + 'alg': {'key': 'alg', 'type': 'str'}, + } + + def __init__(self, *, jwk=None, alg: str=None, **kwargs) -> None: + super(JWK, self).__init__(**kwargs) + self.jwk = jwk + self.alg = alg + + +class JWKHeader(Model): + """JSON web key parameter. + + :param crv: crv value + :type crv: str + :param kid: kid value + :type kid: str + :param kty: kty value + :type kty: str + :param x: x value + :type x: str + :param y: y value + :type y: str + """ + + _attribute_map = { + 'crv': {'key': 'crv', 'type': 'str'}, + 'kid': {'key': 'kid', 'type': 'str'}, + 'kty': {'key': 'kty', 'type': 'str'}, + 'x': {'key': 'x', 'type': 'str'}, + 'y': {'key': 'y', 'type': 'str'}, + } + + def __init__(self, *, crv: str=None, kid: str=None, kty: str=None, x: str=None, y: str=None, **kwargs) -> None: + super(JWKHeader, self).__init__(**kwargs) + self.crv = crv + self.kid = kid + self.kty = kty + self.x = x + self.y = y + + +class Manifest(Model): + """Returns the requested manifest file. + + :param schema_version: Schema version + :type schema_version: int + """ + + _attribute_map = { + 'schema_version': {'key': 'schemaVersion', 'type': 'int'}, + } + + def __init__(self, *, schema_version: int=None, **kwargs) -> None: + super(Manifest, self).__init__(**kwargs) + self.schema_version = schema_version + + +class ManifestAttributes(Model): + """Manifest attributes details. + + :param registry: Registry name + :type registry: str + :param image_name: Image name + :type image_name: str + :param attributes: Manifest attributes + :type attributes: ~azure.containerregistry.models.ManifestAttributesBase + """ + + _attribute_map = { + 'registry': {'key': 'registry', 'type': 'str'}, + 'image_name': {'key': 'imageName', 'type': 'str'}, + 'attributes': {'key': 'manifest', 'type': 'ManifestAttributesBase'}, + } + + def __init__(self, *, registry: str=None, image_name: str=None, attributes=None, **kwargs) -> None: + super(ManifestAttributes, self).__init__(**kwargs) + self.registry = registry + self.image_name = image_name + self.attributes = attributes + + +class ManifestAttributesBase(Model): + """Manifest details. + + :param digest: Manifest + :type digest: str + :param image_size: Image size + :type image_size: long + :param created_time: Created time + :type created_time: str + :param last_update_time: Last update time + :type last_update_time: str + :param architecture: CPU architecture + :type architecture: str + :param os: Operating system + :type os: str + :param media_type: Media type + :type media_type: str + :param config_media_type: Config blob media type + :type config_media_type: str + :param tags: List of tags + :type tags: list[str] + :param changeable_attributes: Changeable attributes + :type changeable_attributes: + ~azure.containerregistry.models.ChangeableAttributes + """ + + _attribute_map = { + 'digest': {'key': 'digest', 'type': 'str'}, + 'image_size': {'key': 'imageSize', 'type': 'long'}, + 'created_time': {'key': 'createdTime', 'type': 'str'}, + 'last_update_time': {'key': 'lastUpdateTime', 'type': 'str'}, + 'architecture': {'key': 'architecture', 'type': 'str'}, + 'os': {'key': 'os', 'type': 'str'}, + 'media_type': {'key': 'mediaType', 'type': 'str'}, + 'config_media_type': {'key': 'configMediaType', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '[str]'}, + 'changeable_attributes': {'key': 'changeableAttributes', 'type': 'ChangeableAttributes'}, + } + + def __init__(self, *, digest: str=None, image_size: int=None, created_time: str=None, last_update_time: str=None, architecture: str=None, os: str=None, media_type: str=None, config_media_type: str=None, tags=None, changeable_attributes=None, **kwargs) -> None: + super(ManifestAttributesBase, self).__init__(**kwargs) + self.digest = digest + self.image_size = image_size + self.created_time = created_time + self.last_update_time = last_update_time + self.architecture = architecture + self.os = os + self.media_type = media_type + self.config_media_type = config_media_type + self.tags = tags + self.changeable_attributes = changeable_attributes + + +class ManifestAttributesManifest(Model): + """List of manifest attributes. + + :param references: List of manifest attributes details + :type references: + list[~azure.containerregistry.models.ManifestAttributesManifestReferences] + :param quarantine_tag: Quarantine tag name + :type quarantine_tag: str + """ + + _attribute_map = { + 'references': {'key': 'references', 'type': '[ManifestAttributesManifestReferences]'}, + 'quarantine_tag': {'key': 'quarantineTag', 'type': 'str'}, + } + + def __init__(self, *, references=None, quarantine_tag: str=None, **kwargs) -> None: + super(ManifestAttributesManifest, self).__init__(**kwargs) + self.references = references + self.quarantine_tag = quarantine_tag + + +class ManifestAttributesManifestReferences(Model): + """Manifest attributes details. + + :param digest: Manifest digest + :type digest: str + :param architecture: CPU architecture + :type architecture: str + :param os: Operating system + :type os: str + """ + + _attribute_map = { + 'digest': {'key': 'digest', 'type': 'str'}, + 'architecture': {'key': 'architecture', 'type': 'str'}, + 'os': {'key': 'os', 'type': 'str'}, + } + + def __init__(self, *, digest: str=None, architecture: str=None, os: str=None, **kwargs) -> None: + super(ManifestAttributesManifestReferences, self).__init__(**kwargs) + self.digest = digest + self.architecture = architecture + self.os = os + + +class ManifestChangeableAttributes(Model): + """Changeable attributes. + + :param delete_enabled: Delete enabled + :type delete_enabled: bool + :param write_enabled: Write enabled + :type write_enabled: bool + :param list_enabled: List enabled + :type list_enabled: bool + :param read_enabled: Read enabled + :type read_enabled: bool + :param quarantine_state: Quarantine state + :type quarantine_state: str + :param quarantine_details: Quarantine details + :type quarantine_details: str + """ + + _attribute_map = { + 'delete_enabled': {'key': 'deleteEnabled', 'type': 'bool'}, + 'write_enabled': {'key': 'writeEnabled', 'type': 'bool'}, + 'list_enabled': {'key': 'listEnabled', 'type': 'bool'}, + 'read_enabled': {'key': 'readEnabled', 'type': 'bool'}, + 'quarantine_state': {'key': 'quarantineState', 'type': 'str'}, + 'quarantine_details': {'key': 'quarantineDetails', 'type': 'str'}, + } + + def __init__(self, *, delete_enabled: bool=None, write_enabled: bool=None, list_enabled: bool=None, read_enabled: bool=None, quarantine_state: str=None, quarantine_details: str=None, **kwargs) -> None: + super(ManifestChangeableAttributes, self).__init__(**kwargs) + self.delete_enabled = delete_enabled + self.write_enabled = write_enabled + self.list_enabled = list_enabled + self.read_enabled = read_enabled + self.quarantine_state = quarantine_state + self.quarantine_details = quarantine_details + + +class ManifestList(Manifest): + """Returns the requested Docker multi-arch-manifest file. + + :param schema_version: Schema version + :type schema_version: int + :param media_type: Media type for this Manifest + :type media_type: str + :param manifests: List of V2 image layer information + :type manifests: + list[~azure.containerregistry.models.ManifestListAttributes] + """ + + _attribute_map = { + 'schema_version': {'key': 'schemaVersion', 'type': 'int'}, + 'media_type': {'key': 'mediaType', 'type': 'str'}, + 'manifests': {'key': 'manifests', 'type': '[ManifestListAttributes]'}, + } + + def __init__(self, *, schema_version: int=None, media_type: str=None, manifests=None, **kwargs) -> None: + super(ManifestList, self).__init__(schema_version=schema_version, **kwargs) + self.media_type = media_type + self.manifests = manifests + + +class ManifestListAttributes(Model): + """ManifestListAttributes. + + :param media_type: The MIME type of the referenced object. This will + generally be application/vnd.docker.image.manifest.v2+json, but it could + also be application/vnd.docker.image.manifest.v1+json + :type media_type: str + :param size: The size in bytes of the object + :type size: long + :param digest: The digest of the content, as defined by the Registry V2 + HTTP API Specification + :type digest: str + :param platform: + :type platform: ~azure.containerregistry.models.Platform + """ + + _attribute_map = { + 'media_type': {'key': 'mediaType', 'type': 'str'}, + 'size': {'key': 'size', 'type': 'long'}, + 'digest': {'key': 'digest', 'type': 'str'}, + 'platform': {'key': 'platform', 'type': 'Platform'}, + } + + def __init__(self, *, media_type: str=None, size: int=None, digest: str=None, platform=None, **kwargs) -> None: + super(ManifestListAttributes, self).__init__(**kwargs) + self.media_type = media_type + self.size = size + self.digest = digest + self.platform = platform + + +class ManifestWrapper(Manifest): + """Returns the requested manifest file. + + :param schema_version: Schema version + :type schema_version: int + :param media_type: Media type for this Manifest + :type media_type: str + :param manifests: (ManifestList, OCIIndex) List of V2 image layer + information + :type manifests: + list[~azure.containerregistry.models.ManifestListAttributes] + :param config: (V2, OCI) Image config descriptor + :type config: ~azure.containerregistry.models.Descriptor + :param layers: (V2, OCI) List of V2 image layer information + :type layers: list[~azure.containerregistry.models.Descriptor] + :param annotations: (OCI, OCIIndex) Additional metadata + :type annotations: ~azure.containerregistry.models.Annotations + :param architecture: (V1) CPU architecture + :type architecture: str + :param name: (V1) Image name + :type name: str + :param tag: (V1) Image tag + :type tag: str + :param fs_layers: (V1) List of layer information + :type fs_layers: list[~azure.containerregistry.models.FsLayer] + :param history: (V1) Image history + :type history: list[~azure.containerregistry.models.History] + :param signatures: (V1) Image signature + :type signatures: list[~azure.containerregistry.models.ImageSignature] + """ + + _attribute_map = { + 'schema_version': {'key': 'schemaVersion', 'type': 'int'}, + 'media_type': {'key': 'mediaType', 'type': 'str'}, + 'manifests': {'key': 'manifests', 'type': '[ManifestListAttributes]'}, + 'config': {'key': 'config', 'type': 'Descriptor'}, + 'layers': {'key': 'layers', 'type': '[Descriptor]'}, + 'annotations': {'key': 'annotations', 'type': 'Annotations'}, + 'architecture': {'key': 'architecture', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'tag': {'key': 'tag', 'type': 'str'}, + 'fs_layers': {'key': 'fsLayers', 'type': '[FsLayer]'}, + 'history': {'key': 'history', 'type': '[History]'}, + 'signatures': {'key': 'signatures', 'type': '[ImageSignature]'}, + } + + def __init__(self, *, schema_version: int=None, media_type: str=None, manifests=None, config=None, layers=None, annotations=None, architecture: str=None, name: str=None, tag: str=None, fs_layers=None, history=None, signatures=None, **kwargs) -> None: + super(ManifestWrapper, self).__init__(schema_version=schema_version, **kwargs) + self.media_type = media_type + self.manifests = manifests + self.config = config + self.layers = layers + self.annotations = annotations + self.architecture = architecture + self.name = name + self.tag = tag + self.fs_layers = fs_layers + self.history = history + self.signatures = signatures + + +class OCIIndex(Manifest): + """Returns the requested OCI index file. + + :param schema_version: Schema version + :type schema_version: int + :param manifests: List of OCI image layer information + :type manifests: + list[~azure.containerregistry.models.ManifestListAttributes] + :param annotations: + :type annotations: ~azure.containerregistry.models.Annotations + """ + + _attribute_map = { + 'schema_version': {'key': 'schemaVersion', 'type': 'int'}, + 'manifests': {'key': 'manifests', 'type': '[ManifestListAttributes]'}, + 'annotations': {'key': 'annotations', 'type': 'Annotations'}, + } + + def __init__(self, *, schema_version: int=None, manifests=None, annotations=None, **kwargs) -> None: + super(OCIIndex, self).__init__(schema_version=schema_version, **kwargs) + self.manifests = manifests + self.annotations = annotations + + +class OCIManifest(Manifest): + """Returns the requested OCI Manifest file. + + :param schema_version: Schema version + :type schema_version: int + :param config: V2 image config descriptor + :type config: ~azure.containerregistry.models.Descriptor + :param layers: List of V2 image layer information + :type layers: list[~azure.containerregistry.models.Descriptor] + :param annotations: + :type annotations: ~azure.containerregistry.models.Annotations + """ + + _attribute_map = { + 'schema_version': {'key': 'schemaVersion', 'type': 'int'}, + 'config': {'key': 'config', 'type': 'Descriptor'}, + 'layers': {'key': 'layers', 'type': '[Descriptor]'}, + 'annotations': {'key': 'annotations', 'type': 'Annotations'}, + } + + def __init__(self, *, schema_version: int=None, config=None, layers=None, annotations=None, **kwargs) -> None: + super(OCIManifest, self).__init__(schema_version=schema_version, **kwargs) + self.config = config + self.layers = layers + self.annotations = annotations + + +class Platform(Model): + """The platform object describes the platform which the image in the manifest + runs on. A full list of valid operating system and architecture values are + listed in the Go language documentation for $GOOS and $GOARCH. + + :param architecture: Specifies the CPU architecture, for example amd64 or + ppc64le. + :type architecture: str + :param os: The os field specifies the operating system, for example linux + or windows. + :type os: str + :param osversion: The optional os.version field specifies the operating + system version, for example 10.0.10586. + :type osversion: str + :param osfeatures: The optional os.features field specifies an array of + strings, each listing a required OS feature (for example on Windows win32k + :type osfeatures: list[str] + :param variant: The optional variant field specifies a variant of the CPU, + for example armv6l to specify a particular CPU variant of the ARM CPU. + :type variant: str + :param features: The optional features field specifies an array of + strings, each listing a required CPU feature (for example sse4 or aes + :type features: list[str] + """ + + _attribute_map = { + 'architecture': {'key': 'architecture', 'type': 'str'}, + 'os': {'key': 'os', 'type': 'str'}, + 'osversion': {'key': 'os\\.version', 'type': 'str'}, + 'osfeatures': {'key': 'os\\.features', 'type': '[str]'}, + 'variant': {'key': 'variant', 'type': 'str'}, + 'features': {'key': 'features', 'type': '[str]'}, + } + + def __init__(self, *, architecture: str=None, os: str=None, osversion: str=None, osfeatures=None, variant: str=None, features=None, **kwargs) -> None: + super(Platform, self).__init__(**kwargs) + self.architecture = architecture + self.os = os + self.osversion = osversion + self.osfeatures = osfeatures + self.variant = variant + self.features = features + + +class RefreshToken(Model): + """RefreshToken. + + :param refresh_token: The refresh token to be used for generating access + tokens + :type refresh_token: str + """ + + _attribute_map = { + 'refresh_token': {'key': 'refresh_token', 'type': 'str'}, + } + + def __init__(self, *, refresh_token: str=None, **kwargs) -> None: + super(RefreshToken, self).__init__(**kwargs) + self.refresh_token = refresh_token + + +class Repositories(Model): + """List of repositories. + + :param names: Repository names + :type names: list[str] + """ + + _attribute_map = { + 'names': {'key': 'repositories', 'type': '[str]'}, + } + + def __init__(self, *, names=None, **kwargs) -> None: + super(Repositories, self).__init__(**kwargs) + self.names = names + + +class RepositoryAttributes(Model): + """Repository attributes. + + :param registry: Registry name + :type registry: str + :param image_name: Image name + :type image_name: str + :param created_time: Image created time + :type created_time: str + :param last_update_time: Image last update time + :type last_update_time: str + :param manifest_count: Number of the manifests + :type manifest_count: int + :param tag_count: Number of the tags + :type tag_count: int + :param changeable_attributes: Changeable attributes + :type changeable_attributes: + ~azure.containerregistry.models.ChangeableAttributes + """ + + _attribute_map = { + 'registry': {'key': 'registry', 'type': 'str'}, + 'image_name': {'key': 'imageName', 'type': 'str'}, + 'created_time': {'key': 'createdTime', 'type': 'str'}, + 'last_update_time': {'key': 'lastUpdateTime', 'type': 'str'}, + 'manifest_count': {'key': 'manifestCount', 'type': 'int'}, + 'tag_count': {'key': 'tagCount', 'type': 'int'}, + 'changeable_attributes': {'key': 'changeableAttributes', 'type': 'ChangeableAttributes'}, + } + + def __init__(self, *, registry: str=None, image_name: str=None, created_time: str=None, last_update_time: str=None, manifest_count: int=None, tag_count: int=None, changeable_attributes=None, **kwargs) -> None: + super(RepositoryAttributes, self).__init__(**kwargs) + self.registry = registry + self.image_name = image_name + self.created_time = created_time + self.last_update_time = last_update_time + self.manifest_count = manifest_count + self.tag_count = tag_count + self.changeable_attributes = changeable_attributes + + +class RepositoryTags(Model): + """Result of the request to list tags of the image. + + :param name: Name of the image + :type name: str + :param tags: List of tags + :type tags: list[str] + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '[str]'}, + } + + def __init__(self, *, name: str=None, tags=None, **kwargs) -> None: + super(RepositoryTags, self).__init__(**kwargs) + self.name = name + self.tags = tags + + +class TagAttributes(Model): + """Tag attributes. + + :param registry: Registry name + :type registry: str + :param image_name: Image name + :type image_name: str + :param attributes: List of tag attribute details + :type attributes: ~azure.containerregistry.models.TagAttributesBase + """ + + _attribute_map = { + 'registry': {'key': 'registry', 'type': 'str'}, + 'image_name': {'key': 'imageName', 'type': 'str'}, + 'attributes': {'key': 'tag', 'type': 'TagAttributesBase'}, + } + + def __init__(self, *, registry: str=None, image_name: str=None, attributes=None, **kwargs) -> None: + super(TagAttributes, self).__init__(**kwargs) + self.registry = registry + self.image_name = image_name + self.attributes = attributes + + +class TagAttributesBase(Model): + """Tag attribute details. + + :param name: Tag name + :type name: str + :param digest: Tag digest + :type digest: str + :param created_time: Tag created time + :type created_time: str + :param last_update_time: Tag last update time + :type last_update_time: str + :param signed: Is signed + :type signed: bool + :param changeable_attributes: Changeable attributes + :type changeable_attributes: + ~azure.containerregistry.models.ChangeableAttributes + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'digest': {'key': 'digest', 'type': 'str'}, + 'created_time': {'key': 'createdTime', 'type': 'str'}, + 'last_update_time': {'key': 'lastUpdateTime', 'type': 'str'}, + 'signed': {'key': 'signed', 'type': 'bool'}, + 'changeable_attributes': {'key': 'changeableAttributes', 'type': 'ChangeableAttributes'}, + } + + def __init__(self, *, name: str=None, digest: str=None, created_time: str=None, last_update_time: str=None, signed: bool=None, changeable_attributes=None, **kwargs) -> None: + super(TagAttributesBase, self).__init__(**kwargs) + self.name = name + self.digest = digest + self.created_time = created_time + self.last_update_time = last_update_time + self.signed = signed + self.changeable_attributes = changeable_attributes + + +class TagAttributesTag(Model): + """Tag. + + :param signature_record: SignatureRecord value + :type signature_record: str + """ + + _attribute_map = { + 'signature_record': {'key': 'signatureRecord', 'type': 'str'}, + } + + def __init__(self, *, signature_record: str=None, **kwargs) -> None: + super(TagAttributesTag, self).__init__(**kwargs) + self.signature_record = signature_record + + +class TagList(Model): + """List of tag details. + + :param registry: Registry name + :type registry: str + :param image_name: Image name + :type image_name: str + :param tags: List of tag attribute details + :type tags: list[~azure.containerregistry.models.TagAttributesBase] + """ + + _attribute_map = { + 'registry': {'key': 'registry', 'type': 'str'}, + 'image_name': {'key': 'imageName', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '[TagAttributesBase]'}, + } + + def __init__(self, *, registry: str=None, image_name: str=None, tags=None, **kwargs) -> None: + super(TagList, self).__init__(**kwargs) + self.registry = registry + self.image_name = image_name + self.tags = tags + + +class V1Manifest(Manifest): + """Returns the requested V1 manifest file. + + :param schema_version: Schema version + :type schema_version: int + :param architecture: CPU architecture + :type architecture: str + :param name: Image name + :type name: str + :param tag: Image tag + :type tag: str + :param fs_layers: List of layer information + :type fs_layers: list[~azure.containerregistry.models.FsLayer] + :param history: Image history + :type history: list[~azure.containerregistry.models.History] + :param signatures: Image signature + :type signatures: list[~azure.containerregistry.models.ImageSignature] + """ + + _attribute_map = { + 'schema_version': {'key': 'schemaVersion', 'type': 'int'}, + 'architecture': {'key': 'architecture', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'tag': {'key': 'tag', 'type': 'str'}, + 'fs_layers': {'key': 'fsLayers', 'type': '[FsLayer]'}, + 'history': {'key': 'history', 'type': '[History]'}, + 'signatures': {'key': 'signatures', 'type': '[ImageSignature]'}, + } + + def __init__(self, *, schema_version: int=None, architecture: str=None, name: str=None, tag: str=None, fs_layers=None, history=None, signatures=None, **kwargs) -> None: + super(V1Manifest, self).__init__(schema_version=schema_version, **kwargs) + self.architecture = architecture + self.name = name + self.tag = tag + self.fs_layers = fs_layers + self.history = history + self.signatures = signatures + + +class V2Manifest(Manifest): + """Returns the requested Docker V2 Manifest file. + + :param schema_version: Schema version + :type schema_version: int + :param media_type: Media type for this Manifest + :type media_type: str + :param config: V2 image config descriptor + :type config: ~azure.containerregistry.models.Descriptor + :param layers: List of V2 image layer information + :type layers: list[~azure.containerregistry.models.Descriptor] + """ + + _attribute_map = { + 'schema_version': {'key': 'schemaVersion', 'type': 'int'}, + 'media_type': {'key': 'mediaType', 'type': 'str'}, + 'config': {'key': 'config', 'type': 'Descriptor'}, + 'layers': {'key': 'layers', 'type': '[Descriptor]'}, + } + + def __init__(self, *, schema_version: int=None, media_type: str=None, config=None, layers=None, **kwargs) -> None: + super(V2Manifest, self).__init__(schema_version=schema_version, **kwargs) + self.media_type = media_type + self.config = config + self.layers = layers diff --git a/sdk/containerregistry/azure-containerregistry/azure/containerregistry/operations/__init__.py b/sdk/containerregistry/azure-containerregistry/azure/containerregistry/operations/__init__.py new file mode 100644 index 000000000000..f2d0a934adc3 --- /dev/null +++ b/sdk/containerregistry/azure-containerregistry/azure/containerregistry/operations/__init__.py @@ -0,0 +1,28 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from ._v2_support_operations import V2SupportOperations +from ._manifests_operations import ManifestsOperations +from ._blob_operations import BlobOperations +from ._repository_operations import RepositoryOperations +from ._tag_operations import TagOperations +from ._refresh_tokens_operations import RefreshTokensOperations +from ._access_tokens_operations import AccessTokensOperations + +__all__ = [ + 'V2SupportOperations', + 'ManifestsOperations', + 'BlobOperations', + 'RepositoryOperations', + 'TagOperations', + 'RefreshTokensOperations', + 'AccessTokensOperations', +] diff --git a/sdk/containerregistry/azure-containerregistry/azure/containerregistry/operations/_access_tokens_operations.py b/sdk/containerregistry/azure-containerregistry/azure/containerregistry/operations/_access_tokens_operations.py new file mode 100644 index 000000000000..ffeb07b22bdd --- /dev/null +++ b/sdk/containerregistry/azure-containerregistry/azure/containerregistry/operations/_access_tokens_operations.py @@ -0,0 +1,161 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.pipeline import ClientRawResponse + +from .. import models + + +class AccessTokensOperations(object): + """AccessTokensOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar grant_type: Grant type is expected to be refresh_token. Constant value: "refresh_token". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + + self.config = config + self.grant_type = "refresh_token" + + def get( + self, service, scope, refresh_token, custom_headers=None, raw=False, **operation_config): + """Exchange ACR Refresh token for an ACR Access Token. + + :param service: Indicates the name of your Azure container registry. + :type service: str + :param scope: Which is expected to be a valid scope, and can be + specified more than once for multiple scope requests. You obtained + this from the Www-Authenticate response header from the challenge. + :type scope: str + :param refresh_token: Must be a valid ACR refresh token + :type refresh_token: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: AccessToken or ClientRawResponse if raw=true + :rtype: ~azure.containerregistry.models.AccessToken or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`AcrErrorsException` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'url': self._serialize.url("self.config.login_uri", self.config.login_uri, 'str', skip_quote=True) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/x-www-form-urlencoded' + if custom_headers: + header_parameters.update(custom_headers) + + # Construct form data + form_data_content = { + 'grant_type': grant_type, + 'service': service, + 'scope': scope, + 'refresh_token': refresh_token, + } + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters, form_content=form_data_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.AcrErrorsException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('AccessToken', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/oauth2/token'} + + def get_from_login( + self, service, scope, custom_headers=None, raw=False, **operation_config): + """Exchange Username, Password and Scope an ACR Access Token. + + :param service: Indicates the name of your Azure container registry. + :type service: str + :param scope: Expected to be a valid scope, and can be specified more + than once for multiple scope requests. You can obtain this from the + Www-Authenticate response header from the challenge. + :type scope: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: AccessToken or ClientRawResponse if raw=true + :rtype: ~azure.containerregistry.models.AccessToken or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`AcrErrorsException` + """ + # Construct URL + url = self.get_from_login.metadata['url'] + path_format_arguments = { + 'url': self._serialize.url("self.config.login_uri", self.config.login_uri, 'str', skip_quote=True) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['service'] = self._serialize.query("service", service, 'str') + query_parameters['scope'] = self._serialize.query("scope", scope, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if custom_headers: + header_parameters.update(custom_headers) + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.AcrErrorsException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('AccessToken', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_from_login.metadata = {'url': '/oauth2/token'} diff --git a/sdk/containerregistry/azure-containerregistry/azure/containerregistry/operations/_blob_operations.py b/sdk/containerregistry/azure-containerregistry/azure/containerregistry/operations/_blob_operations.py new file mode 100644 index 000000000000..2415fdde5ae5 --- /dev/null +++ b/sdk/containerregistry/azure-containerregistry/azure/containerregistry/operations/_blob_operations.py @@ -0,0 +1,657 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.pipeline import ClientRawResponse +from msrest.exceptions import HttpOperationError + +from .. import models + + +class BlobOperations(object): + """BlobOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + + self.config = config + + def get( + self, name, digest, custom_headers=None, raw=False, callback=None, **operation_config): + """Retrieve the blob from the registry identified by digest. + + :param name: Name of the image (including the namespace) + :type name: str + :param digest: Digest of a BLOB + :type digest: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param callback: When specified, will be called with each chunk of + data that is streamed. The callback should take two arguments, the + bytes of the current chunk of data and the response object. If the + data is uploading, response will be None. + :type callback: Callable[Bytes, response=None] + :param operation_config: :ref:`Operation configuration + overrides`. + :return: object or ClientRawResponse if raw=true + :rtype: Generator or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`HttpOperationError` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'url': self._serialize.url("self.config.login_uri", self.config.login_uri, 'str', skip_quote=True), + 'name': self._serialize.url("name", name, 'str'), + 'digest': self._serialize.url("digest", digest, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/octet-stream' + if custom_headers: + header_parameters.update(custom_headers) + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=True, **operation_config) + + if response.status_code not in [200, 307]: + raise HttpOperationError(self._deserialize, response) + + header_dict = {} + deserialized = self._client.stream_download(response, callback) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + client_raw_response.add_headers(header_dict) + return client_raw_response + + return deserialized + get.metadata = {'url': '/v2/{name}/blobs/{digest}'} + + def check( + self, name, digest, custom_headers=None, raw=False, **operation_config): + """Same as GET, except only the headers are returned. + + :param name: Name of the image (including the namespace) + :type name: str + :param digest: Digest of a BLOB + :type digest: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`AcrErrorsException` + """ + # Construct URL + url = self.check.metadata['url'] + path_format_arguments = { + 'url': self._serialize.url("self.config.login_uri", self.config.login_uri, 'str', skip_quote=True), + 'name': self._serialize.url("name", name, 'str'), + 'digest': self._serialize.url("digest", digest, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + + # Construct headers + header_parameters = {} + if custom_headers: + header_parameters.update(custom_headers) + + # Construct and send request + request = self._client.head(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 307]: + raise models.AcrErrorsException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + client_raw_response.add_headers({ + 'Content-Length': 'long', + 'Docker-Content-Digest': 'str', + 'Location': 'str', + }) + return client_raw_response + check.metadata = {'url': '/v2/{name}/blobs/{digest}'} + + def delete( + self, name, digest, custom_headers=None, raw=False, callback=None, **operation_config): + """Removes an already uploaded blob. + + :param name: Name of the image (including the namespace) + :type name: str + :param digest: Digest of a BLOB + :type digest: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param callback: When specified, will be called with each chunk of + data that is streamed. The callback should take two arguments, the + bytes of the current chunk of data and the response object. If the + data is uploading, response will be None. + :type callback: Callable[Bytes, response=None] + :param operation_config: :ref:`Operation configuration + overrides`. + :return: object or ClientRawResponse if raw=true + :rtype: Generator or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`HttpOperationError` + """ + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'url': self._serialize.url("self.config.login_uri", self.config.login_uri, 'str', skip_quote=True), + 'name': self._serialize.url("name", name, 'str'), + 'digest': self._serialize.url("digest", digest, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/octet-stream' + if custom_headers: + header_parameters.update(custom_headers) + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=True, **operation_config) + + if response.status_code not in [202]: + raise HttpOperationError(self._deserialize, response) + + header_dict = {} + deserialized = self._client.stream_download(response, callback) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + client_raw_response.add_headers(header_dict) + return client_raw_response + + return deserialized + delete.metadata = {'url': '/v2/{name}/blobs/{digest}'} + + def mount( + self, name, from_parameter, mount, custom_headers=None, raw=False, **operation_config): + """Mount a blob identified by the `mount` parameter from another + repository. + + :param name: Name of the image (including the namespace) + :type name: str + :param from_parameter: Name of the source repository. + :type from_parameter: str + :param mount: Digest of blob to mount from the source repository. + :type mount: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`AcrErrorsException` + """ + # Construct URL + url = self.mount.metadata['url'] + path_format_arguments = { + 'url': self._serialize.url("self.config.login_uri", self.config.login_uri, 'str', skip_quote=True), + 'name': self._serialize.url("name", name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['from'] = self._serialize.query("from_parameter", from_parameter, 'str') + query_parameters['mount'] = self._serialize.query("mount", mount, 'str') + + # Construct headers + header_parameters = {} + if custom_headers: + header_parameters.update(custom_headers) + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [201]: + raise models.AcrErrorsException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + client_raw_response.add_headers({ + 'Location': 'str', + 'Docker-Upload-UUID': 'str', + 'Docker-Content-Digest': 'str', + }) + return client_raw_response + mount.metadata = {'url': '/v2/{name}/blobs/uploads/'} + + def get_status( + self, location, custom_headers=None, raw=False, **operation_config): + """Retrieve status of upload identified by uuid. The primary purpose of + this endpoint is to resolve the current status of a resumable upload. + + :param location: Link acquired from upload start or previous chunk. + Note, do not include initial / (must do substring(1) ) + :type location: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`AcrErrorsException` + """ + # Construct URL + url = self.get_status.metadata['url'] + path_format_arguments = { + 'url': self._serialize.url("self.config.login_uri", self.config.login_uri, 'str', skip_quote=True), + 'nextBlobUuidLink': self._serialize.url("location", location, 'str', skip_quote=True) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + + # Construct headers + header_parameters = {} + if custom_headers: + header_parameters.update(custom_headers) + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [204]: + raise models.AcrErrorsException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + client_raw_response.add_headers({ + 'Range': 'str', + 'Docker-Upload-UUID': 'str', + }) + return client_raw_response + get_status.metadata = {'url': '/{nextBlobUuidLink}'} + + def upload( + self, value, location, custom_headers=None, raw=False, callback=None, **operation_config): + """Upload a stream of data without completing the upload. + + :param value: Raw data of blob + :type value: Generator + :param location: Link acquired from upload start or previous chunk. + Note, do not include initial / (must do substring(1) ) + :type location: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param callback: When specified, will be called with each chunk of + data that is streamed. The callback should take two arguments, the + bytes of the current chunk of data and the response object. If the + data is uploading, response will be None. + :type callback: Callable[Bytes, response=None] + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`AcrErrorsException` + """ + # Construct URL + url = self.upload.metadata['url'] + path_format_arguments = { + 'url': self._serialize.url("self.config.login_uri", self.config.login_uri, 'str', skip_quote=True), + 'nextBlobUuidLink': self._serialize.url("location", location, 'str', skip_quote=True) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/octet-stream' + if custom_headers: + header_parameters.update(custom_headers) + + # Construct body + body_content = self._client.stream_upload(value, callback) + + # Construct and send request + request = self._client.patch(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [202]: + raise models.AcrErrorsException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + client_raw_response.add_headers({ + 'Location': 'str', + 'Range': 'str', + 'Docker-Upload-UUID': 'str', + }) + return client_raw_response + upload.metadata = {'url': '/{nextBlobUuidLink}'} + + def end_upload( + self, digest, location, value=None, custom_headers=None, raw=False, callback=None, **operation_config): + """Complete the upload, providing all the data in the body, if necessary. + A request without a body will just complete the upload with previously + uploaded content. + + :param digest: Digest of a BLOB + :type digest: str + :param location: Link acquired from upload start or previous chunk. + Note, do not include initial / (must do substring(1) ) + :type location: str + :param value: Optional raw data of blob + :type value: Generator + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param callback: When specified, will be called with each chunk of + data that is streamed. The callback should take two arguments, the + bytes of the current chunk of data and the response object. If the + data is uploading, response will be None. + :type callback: Callable[Bytes, response=None] + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`AcrErrorsException` + """ + # Construct URL + url = self.end_upload.metadata['url'] + path_format_arguments = { + 'url': self._serialize.url("self.config.login_uri", self.config.login_uri, 'str', skip_quote=True), + 'nextBlobUuidLink': self._serialize.url("location", location, 'str', skip_quote=True) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['digest'] = self._serialize.query("digest", digest, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/octet-stream' + if custom_headers: + header_parameters.update(custom_headers) + + # Construct body + body_content = self._client.stream_upload(value, callback) + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [201]: + raise models.AcrErrorsException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + client_raw_response.add_headers({ + 'Location': 'str', + 'Range': 'str', + 'Docker-Content-Digest': 'str', + }) + return client_raw_response + end_upload.metadata = {'url': '/{nextBlobUuidLink}'} + + def cancel_upload( + self, location, custom_headers=None, raw=False, **operation_config): + """Cancel outstanding upload processes, releasing associated resources. If + this is not called, the unfinished uploads will eventually timeout. + + :param location: Link acquired from upload start or previous chunk. + Note, do not include initial / (must do substring(1) ) + :type location: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`AcrErrorsException` + """ + # Construct URL + url = self.cancel_upload.metadata['url'] + path_format_arguments = { + 'url': self._serialize.url("self.config.login_uri", self.config.login_uri, 'str', skip_quote=True), + 'nextBlobUuidLink': self._serialize.url("location", location, 'str', skip_quote=True) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + + # Construct headers + header_parameters = {} + if custom_headers: + header_parameters.update(custom_headers) + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [204]: + raise models.AcrErrorsException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + cancel_upload.metadata = {'url': '/{nextBlobUuidLink}'} + + def start_upload( + self, name, custom_headers=None, raw=False, **operation_config): + """Initiate a resumable blob upload with an empty request body. + + :param name: Name of the image (including the namespace) + :type name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`AcrErrorsException` + """ + # Construct URL + url = self.start_upload.metadata['url'] + path_format_arguments = { + 'url': self._serialize.url("self.config.login_uri", self.config.login_uri, 'str', skip_quote=True), + 'name': self._serialize.url("name", name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + + # Construct headers + header_parameters = {} + if custom_headers: + header_parameters.update(custom_headers) + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [202]: + raise models.AcrErrorsException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + client_raw_response.add_headers({ + 'Location': 'str', + 'Range': 'str', + 'Docker-Upload-UUID': 'str', + }) + return client_raw_response + start_upload.metadata = {'url': '/v2/{name}/blobs/uploads/'} + + def get_chunk( + self, name, digest, range, custom_headers=None, raw=False, callback=None, **operation_config): + """Retrieve the blob from the registry identified by `digest`. This + endpoint may also support RFC7233 compliant range requests. Support can + be detected by issuing a HEAD request. If the header `Accept-Range: + bytes` is returned, range requests can be used to fetch partial + content. + + :param name: Name of the image (including the namespace) + :type name: str + :param digest: Digest of a BLOB + :type digest: str + :param range: Format : bytes=-, HTTP Range header + specifying blob chunk. + :type range: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param callback: When specified, will be called with each chunk of + data that is streamed. The callback should take two arguments, the + bytes of the current chunk of data and the response object. If the + data is uploading, response will be None. + :type callback: Callable[Bytes, response=None] + :param operation_config: :ref:`Operation configuration + overrides`. + :return: object or ClientRawResponse if raw=true + :rtype: Generator or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`HttpOperationError` + """ + # Construct URL + url = self.get_chunk.metadata['url'] + path_format_arguments = { + 'url': self._serialize.url("self.config.login_uri", self.config.login_uri, 'str', skip_quote=True), + 'name': self._serialize.url("name", name, 'str'), + 'digest': self._serialize.url("digest", digest, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/octet-stream' + if custom_headers: + header_parameters.update(custom_headers) + header_parameters['Range'] = self._serialize.header("range", range, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=True, **operation_config) + + if response.status_code not in [206]: + raise HttpOperationError(self._deserialize, response) + + header_dict = {} + deserialized = self._client.stream_download(response, callback) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + client_raw_response.add_headers(header_dict) + return client_raw_response + + return deserialized + get_chunk.metadata = {'url': '/v2/{name}/blobs/{digest}'} + + def check_chunk( + self, name, digest, range, custom_headers=None, raw=False, **operation_config): + """Same as GET, except only the headers are returned. + + :param name: Name of the image (including the namespace) + :type name: str + :param digest: Digest of a BLOB + :type digest: str + :param range: Format : bytes=-, HTTP Range header + specifying blob chunk. + :type range: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`AcrErrorsException` + """ + # Construct URL + url = self.check_chunk.metadata['url'] + path_format_arguments = { + 'url': self._serialize.url("self.config.login_uri", self.config.login_uri, 'str', skip_quote=True), + 'name': self._serialize.url("name", name, 'str'), + 'digest': self._serialize.url("digest", digest, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + + # Construct headers + header_parameters = {} + if custom_headers: + header_parameters.update(custom_headers) + header_parameters['Range'] = self._serialize.header("range", range, 'str') + + # Construct and send request + request = self._client.head(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.AcrErrorsException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + client_raw_response.add_headers({ + 'Content-Length': 'long', + 'Content-Range': 'str', + }) + return client_raw_response + check_chunk.metadata = {'url': '/v2/{name}/blobs/{digest}'} diff --git a/sdk/containerregistry/azure-containerregistry/azure/containerregistry/operations/_manifests_operations.py b/sdk/containerregistry/azure-containerregistry/azure/containerregistry/operations/_manifests_operations.py new file mode 100644 index 000000000000..3bb1dc973077 --- /dev/null +++ b/sdk/containerregistry/azure-containerregistry/azure/containerregistry/operations/_manifests_operations.py @@ -0,0 +1,391 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.pipeline import ClientRawResponse + +from .. import models + + +class ManifestsOperations(object): + """ManifestsOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + + self.config = config + + def get( + self, name, reference, accept=None, custom_headers=None, raw=False, **operation_config): + """Get the manifest identified by `name` and `reference` where `reference` + can be a tag or digest. + + :param name: Name of the image (including the namespace) + :type name: str + :param reference: A tag or a digest, pointing to a specific image + :type reference: str + :param accept: Accept header string delimited by comma. For example, + application/vnd.docker.distribution.manifest.v2+json + :type accept: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: ManifestWrapper or ClientRawResponse if raw=true + :rtype: ~azure.containerregistry.models.ManifestWrapper or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`AcrErrorsException` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'url': self._serialize.url("self.config.login_uri", self.config.login_uri, 'str', skip_quote=True), + 'name': self._serialize.url("name", name, 'str'), + 'reference': self._serialize.url("reference", reference, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if custom_headers: + header_parameters.update(custom_headers) + if accept is not None: + header_parameters['accept'] = self._serialize.header("accept", accept, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.AcrErrorsException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ManifestWrapper', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/v2/{name}/manifests/{reference}'} + + def create( + self, name, reference, schema_version=None, custom_headers=None, raw=False, **operation_config): + """Put the manifest identified by `name` and `reference` where `reference` + can be a tag or digest. + + :param name: Name of the image (including the namespace) + :type name: str + :param reference: A tag or a digest, pointing to a specific image + :type reference: str + :param schema_version: Schema version + :type schema_version: int + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: object or ClientRawResponse if raw=true + :rtype: object or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`AcrErrorsException` + """ + payload = models.Manifest(schema_version=schema_version) + + # Construct URL + url = self.create.metadata['url'] + path_format_arguments = { + 'url': self._serialize.url("self.config.login_uri", self.config.login_uri, 'str', skip_quote=True), + 'name': self._serialize.url("name", name, 'str'), + 'reference': self._serialize.url("reference", reference, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/vnd.docker.distribution.manifest.v2+json' + if custom_headers: + header_parameters.update(custom_headers) + + # Construct body + body_content = self._serialize.body(payload, 'Manifest') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [201]: + raise models.AcrErrorsException(self._deserialize, response) + + header_dict = {} + deserialized = None + if response.status_code == 201: + deserialized = self._deserialize('object', response) + header_dict = { + 'Docker-Content-Digest': 'str', + 'Location': 'str', + 'Content-Length': 'long', + } + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + client_raw_response.add_headers(header_dict) + return client_raw_response + + return deserialized + create.metadata = {'url': '/v2/{name}/manifests/{reference}'} + + def delete( + self, name, reference, custom_headers=None, raw=False, **operation_config): + """Delete the manifest identified by `name` and `reference`. Note that a + manifest can _only_ be deleted by `digest`. + + :param name: Name of the image (including the namespace) + :type name: str + :param reference: A tag or a digest, pointing to a specific image + :type reference: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`AcrErrorsException` + """ + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'url': self._serialize.url("self.config.login_uri", self.config.login_uri, 'str', skip_quote=True), + 'name': self._serialize.url("name", name, 'str'), + 'reference': self._serialize.url("reference", reference, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + + # Construct headers + header_parameters = {} + if custom_headers: + header_parameters.update(custom_headers) + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [202]: + raise models.AcrErrorsException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + delete.metadata = {'url': '/v2/{name}/manifests/{reference}'} + + def get_list( + self, name, last=None, n=None, orderby=None, custom_headers=None, raw=False, **operation_config): + """List manifests of a repository. + + :param name: Name of the image (including the namespace) + :type name: str + :param last: Query parameter for the last item in previous query. + Result set will include values lexically after last. + :type last: str + :param n: query parameter for max number of items + :type n: int + :param orderby: orderby query parameter + :type orderby: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: AcrManifests or ClientRawResponse if raw=true + :rtype: ~azure.containerregistry.models.AcrManifests or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`AcrErrorsException` + """ + # Construct URL + url = self.get_list.metadata['url'] + path_format_arguments = { + 'url': self._serialize.url("self.config.login_uri", self.config.login_uri, 'str', skip_quote=True), + 'name': self._serialize.url("name", name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + if last is not None: + query_parameters['last'] = self._serialize.query("last", last, 'str') + if n is not None: + query_parameters['n'] = self._serialize.query("n", n, 'int') + if orderby is not None: + query_parameters['orderby'] = self._serialize.query("orderby", orderby, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if custom_headers: + header_parameters.update(custom_headers) + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.AcrErrorsException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('AcrManifests', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_list.metadata = {'url': '/acr/v1/{name}/_manifests'} + + def get_attributes( + self, name, reference, custom_headers=None, raw=False, **operation_config): + """Get manifest attributes. + + :param name: Name of the image (including the namespace) + :type name: str + :param reference: A tag or a digest, pointing to a specific image + :type reference: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: ManifestAttributes or ClientRawResponse if raw=true + :rtype: ~azure.containerregistry.models.ManifestAttributes or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`AcrErrorsException` + """ + # Construct URL + url = self.get_attributes.metadata['url'] + path_format_arguments = { + 'url': self._serialize.url("self.config.login_uri", self.config.login_uri, 'str', skip_quote=True), + 'name': self._serialize.url("name", name, 'str'), + 'reference': self._serialize.url("reference", reference, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if custom_headers: + header_parameters.update(custom_headers) + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.AcrErrorsException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ManifestAttributes', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_attributes.metadata = {'url': '/acr/v1/{name}/_manifests/{reference}'} + + def update_attributes( + self, name, reference, value=None, custom_headers=None, raw=False, **operation_config): + """Update attributes of a manifest. + + :param name: Name of the image (including the namespace) + :type name: str + :param reference: A tag or a digest, pointing to a specific image + :type reference: str + :param value: Repository attribute value + :type value: ~azure.containerregistry.models.ChangeableAttributes + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`AcrErrorsException` + """ + # Construct URL + url = self.update_attributes.metadata['url'] + path_format_arguments = { + 'url': self._serialize.url("self.config.login_uri", self.config.login_uri, 'str', skip_quote=True), + 'name': self._serialize.url("name", name, 'str'), + 'reference': self._serialize.url("reference", reference, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if custom_headers: + header_parameters.update(custom_headers) + + # Construct body + if value is not None: + body_content = self._serialize.body(value, 'ChangeableAttributes') + else: + body_content = None + + # Construct and send request + request = self._client.patch(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.AcrErrorsException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + update_attributes.metadata = {'url': '/acr/v1/{name}/_manifests/{reference}'} diff --git a/sdk/containerregistry/azure-containerregistry/azure/containerregistry/operations/_refresh_tokens_operations.py b/sdk/containerregistry/azure-containerregistry/azure/containerregistry/operations/_refresh_tokens_operations.py new file mode 100644 index 000000000000..dbb282fd0c75 --- /dev/null +++ b/sdk/containerregistry/azure-containerregistry/azure/containerregistry/operations/_refresh_tokens_operations.py @@ -0,0 +1,109 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.pipeline import ClientRawResponse + +from .. import models + + +class RefreshTokensOperations(object): + """RefreshTokensOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + + self.config = config + + def get_from_exchange( + self, grant_type, service, tenant=None, refresh_token=None, access_token=None, custom_headers=None, raw=False, **operation_config): + """Exchange AAD tokens for an ACR refresh Token. + + :param grant_type: Can take a value of access_token_refresh_token, or + access_token, or refresh_token. Possible values include: + 'access_token_refresh_token', 'access_token', 'refresh_token' + :type grant_type: str + :param service: Indicates the name of your Azure container registry. + :type service: str + :param tenant: AAD tenant associated to the AAD credentials. + :type tenant: str + :param refresh_token: AAD refresh token, mandatory when grant_type is + access_token_refresh_token or refresh_token + :type refresh_token: str + :param access_token: AAD access token, mandatory when grant_type is + access_token_refresh_token or access_token. + :type access_token: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: RefreshToken or ClientRawResponse if raw=true + :rtype: ~azure.containerregistry.models.RefreshToken or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`AcrErrorsException` + """ + # Construct URL + url = self.get_from_exchange.metadata['url'] + path_format_arguments = { + 'url': self._serialize.url("self.config.login_uri", self.config.login_uri, 'str', skip_quote=True) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/x-www-form-urlencoded' + if custom_headers: + header_parameters.update(custom_headers) + + # Construct form data + form_data_content = { + 'grant_type': grant_type, + 'service': service, + 'tenant': tenant, + 'refresh_token': refresh_token, + 'access_token': access_token, + } + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters, form_content=form_data_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.AcrErrorsException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('RefreshToken', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_from_exchange.metadata = {'url': '/oauth2/exchange'} diff --git a/sdk/containerregistry/azure-containerregistry/azure/containerregistry/operations/_repository_operations.py b/sdk/containerregistry/azure-containerregistry/azure/containerregistry/operations/_repository_operations.py new file mode 100644 index 000000000000..013caad51ca0 --- /dev/null +++ b/sdk/containerregistry/azure-containerregistry/azure/containerregistry/operations/_repository_operations.py @@ -0,0 +1,257 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.pipeline import ClientRawResponse + +from .. import models + + +class RepositoryOperations(object): + """RepositoryOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + + self.config = config + + def get_list( + self, last=None, n=None, custom_headers=None, raw=False, **operation_config): + """List repositories. + + :param last: Query parameter for the last item in previous query. + Result set will include values lexically after last. + :type last: str + :param n: query parameter for max number of items + :type n: int + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: Repositories or ClientRawResponse if raw=true + :rtype: ~azure.containerregistry.models.Repositories or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`AcrErrorsException` + """ + # Construct URL + url = self.get_list.metadata['url'] + path_format_arguments = { + 'url': self._serialize.url("self.config.login_uri", self.config.login_uri, 'str', skip_quote=True) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + if last is not None: + query_parameters['last'] = self._serialize.query("last", last, 'str') + if n is not None: + query_parameters['n'] = self._serialize.query("n", n, 'int') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if custom_headers: + header_parameters.update(custom_headers) + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.AcrErrorsException(self._deserialize, response) + + header_dict = {} + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('Repositories', response) + header_dict = { + 'Link': 'str', + } + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + client_raw_response.add_headers(header_dict) + return client_raw_response + + return deserialized + get_list.metadata = {'url': '/acr/v1/_catalog'} + + def get_attributes( + self, name, custom_headers=None, raw=False, **operation_config): + """Get repository attributes. + + :param name: Name of the image (including the namespace) + :type name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: RepositoryAttributes or ClientRawResponse if raw=true + :rtype: ~azure.containerregistry.models.RepositoryAttributes or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`AcrErrorsException` + """ + # Construct URL + url = self.get_attributes.metadata['url'] + path_format_arguments = { + 'url': self._serialize.url("self.config.login_uri", self.config.login_uri, 'str', skip_quote=True), + 'name': self._serialize.url("name", name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if custom_headers: + header_parameters.update(custom_headers) + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.AcrErrorsException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('RepositoryAttributes', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_attributes.metadata = {'url': '/acr/v1/{name}'} + + def delete( + self, name, custom_headers=None, raw=False, **operation_config): + """Delete the repository identified by `name`. + + :param name: Name of the image (including the namespace) + :type name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: DeletedRepository or ClientRawResponse if raw=true + :rtype: ~azure.containerregistry.models.DeletedRepository or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`AcrErrorsException` + """ + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'url': self._serialize.url("self.config.login_uri", self.config.login_uri, 'str', skip_quote=True), + 'name': self._serialize.url("name", name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if custom_headers: + header_parameters.update(custom_headers) + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [202]: + raise models.AcrErrorsException(self._deserialize, response) + + deserialized = None + if response.status_code == 202: + deserialized = self._deserialize('DeletedRepository', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + delete.metadata = {'url': '/acr/v1/{name}'} + + def update_attributes( + self, name, value=None, custom_headers=None, raw=False, **operation_config): + """Update the attribute identified by `name` where `reference` is the name + of the repository. + + :param name: Name of the image (including the namespace) + :type name: str + :param value: Repository attribute value + :type value: ~azure.containerregistry.models.ChangeableAttributes + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`AcrErrorsException` + """ + # Construct URL + url = self.update_attributes.metadata['url'] + path_format_arguments = { + 'url': self._serialize.url("self.config.login_uri", self.config.login_uri, 'str', skip_quote=True), + 'name': self._serialize.url("name", name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if custom_headers: + header_parameters.update(custom_headers) + + # Construct body + if value is not None: + body_content = self._serialize.body(value, 'ChangeableAttributes') + else: + body_content = None + + # Construct and send request + request = self._client.patch(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.AcrErrorsException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + update_attributes.metadata = {'url': '/acr/v1/{name}'} diff --git a/sdk/containerregistry/azure-containerregistry/azure/containerregistry/operations/_tag_operations.py b/sdk/containerregistry/azure-containerregistry/azure/containerregistry/operations/_tag_operations.py new file mode 100644 index 000000000000..7f2f452f4fa7 --- /dev/null +++ b/sdk/containerregistry/azure-containerregistry/azure/containerregistry/operations/_tag_operations.py @@ -0,0 +1,263 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.pipeline import ClientRawResponse + +from .. import models + + +class TagOperations(object): + """TagOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + + self.config = config + + def get_list( + self, name, last=None, n=None, orderby=None, digest=None, custom_headers=None, raw=False, **operation_config): + """List tags of a repository. + + :param name: Name of the image (including the namespace) + :type name: str + :param last: Query parameter for the last item in previous query. + Result set will include values lexically after last. + :type last: str + :param n: query parameter for max number of items + :type n: int + :param orderby: orderby query parameter + :type orderby: str + :param digest: filter by digest + :type digest: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: TagList or ClientRawResponse if raw=true + :rtype: ~azure.containerregistry.models.TagList or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`AcrErrorsException` + """ + # Construct URL + url = self.get_list.metadata['url'] + path_format_arguments = { + 'url': self._serialize.url("self.config.login_uri", self.config.login_uri, 'str', skip_quote=True), + 'name': self._serialize.url("name", name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + if last is not None: + query_parameters['last'] = self._serialize.query("last", last, 'str') + if n is not None: + query_parameters['n'] = self._serialize.query("n", n, 'int') + if orderby is not None: + query_parameters['orderby'] = self._serialize.query("orderby", orderby, 'str') + if digest is not None: + query_parameters['digest'] = self._serialize.query("digest", digest, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if custom_headers: + header_parameters.update(custom_headers) + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.AcrErrorsException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('TagList', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_list.metadata = {'url': '/acr/v1/{name}/_tags'} + + def get_attributes( + self, name, reference, custom_headers=None, raw=False, **operation_config): + """Get tag attributes by tag. + + :param name: Name of the image (including the namespace) + :type name: str + :param reference: Tag name + :type reference: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: TagAttributes or ClientRawResponse if raw=true + :rtype: ~azure.containerregistry.models.TagAttributes or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`AcrErrorsException` + """ + # Construct URL + url = self.get_attributes.metadata['url'] + path_format_arguments = { + 'url': self._serialize.url("self.config.login_uri", self.config.login_uri, 'str', skip_quote=True), + 'name': self._serialize.url("name", name, 'str'), + 'reference': self._serialize.url("reference", reference, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if custom_headers: + header_parameters.update(custom_headers) + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.AcrErrorsException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('TagAttributes', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_attributes.metadata = {'url': '/acr/v1/{name}/_tags/{reference}'} + + def update_attributes( + self, name, reference, value=None, custom_headers=None, raw=False, **operation_config): + """Update tag attributes. + + :param name: Name of the image (including the namespace) + :type name: str + :param reference: Tag name + :type reference: str + :param value: Repository attribute value + :type value: ~azure.containerregistry.models.ChangeableAttributes + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`AcrErrorsException` + """ + # Construct URL + url = self.update_attributes.metadata['url'] + path_format_arguments = { + 'url': self._serialize.url("self.config.login_uri", self.config.login_uri, 'str', skip_quote=True), + 'name': self._serialize.url("name", name, 'str'), + 'reference': self._serialize.url("reference", reference, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if custom_headers: + header_parameters.update(custom_headers) + + # Construct body + if value is not None: + body_content = self._serialize.body(value, 'ChangeableAttributes') + else: + body_content = None + + # Construct and send request + request = self._client.patch(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.AcrErrorsException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + update_attributes.metadata = {'url': '/acr/v1/{name}/_tags/{reference}'} + + def delete( + self, name, reference, custom_headers=None, raw=False, **operation_config): + """Delete tag. + + :param name: Name of the image (including the namespace) + :type name: str + :param reference: Tag name + :type reference: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`AcrErrorsException` + """ + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'url': self._serialize.url("self.config.login_uri", self.config.login_uri, 'str', skip_quote=True), + 'name': self._serialize.url("name", name, 'str'), + 'reference': self._serialize.url("reference", reference, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + + # Construct headers + header_parameters = {} + if custom_headers: + header_parameters.update(custom_headers) + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [202]: + raise models.AcrErrorsException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + delete.metadata = {'url': '/acr/v1/{name}/_tags/{reference}'} diff --git a/sdk/containerregistry/azure-containerregistry/azure/containerregistry/operations/_v2_support_operations.py b/sdk/containerregistry/azure-containerregistry/azure/containerregistry/operations/_v2_support_operations.py new file mode 100644 index 000000000000..31e76e06f79e --- /dev/null +++ b/sdk/containerregistry/azure-containerregistry/azure/containerregistry/operations/_v2_support_operations.py @@ -0,0 +1,78 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.pipeline import ClientRawResponse + +from .. import models + + +class V2SupportOperations(object): + """V2SupportOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + + self.config = config + + def check( + self, custom_headers=None, raw=False, **operation_config): + """Tells whether this Docker Registry instance supports Docker Registry + HTTP API v2. + + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`AcrErrorsException` + """ + # Construct URL + url = self.check.metadata['url'] + path_format_arguments = { + 'url': self._serialize.url("self.config.login_uri", self.config.login_uri, 'str', skip_quote=True) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + + # Construct headers + header_parameters = {} + if custom_headers: + header_parameters.update(custom_headers) + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.AcrErrorsException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + check.metadata = {'url': '/v2/'} diff --git a/sdk/containerregistry/azure-containerregistry/azure/containerregistry/version.py b/sdk/containerregistry/azure-containerregistry/azure/containerregistry/version.py new file mode 100644 index 000000000000..e0ec669828cb --- /dev/null +++ b/sdk/containerregistry/azure-containerregistry/azure/containerregistry/version.py @@ -0,0 +1,13 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +VERSION = "0.1.0" + diff --git a/sdk/containerregistry/azure-containerregistry/sdk_packaging.toml b/sdk/containerregistry/azure-containerregistry/sdk_packaging.toml new file mode 100644 index 000000000000..d5d06c353732 --- /dev/null +++ b/sdk/containerregistry/azure-containerregistry/sdk_packaging.toml @@ -0,0 +1,8 @@ +[packaging] +package_name = "azure-containerregistry" +package_nspkg = "azure-nspkg" +package_pprint_name = "MyService Management" +package_doc_id = "" +is_stable = false +is_arm = true +need_msrestazure = true diff --git a/sdk/containerregistry/azure-containerregistry/setup.cfg b/sdk/containerregistry/azure-containerregistry/setup.cfg new file mode 100644 index 000000000000..3c6e79cf31da --- /dev/null +++ b/sdk/containerregistry/azure-containerregistry/setup.cfg @@ -0,0 +1,2 @@ +[bdist_wheel] +universal=1 diff --git a/sdk/containerregistry/azure-containerregistry/setup.py b/sdk/containerregistry/azure-containerregistry/setup.py new file mode 100644 index 000000000000..3056a726f0de --- /dev/null +++ b/sdk/containerregistry/azure-containerregistry/setup.py @@ -0,0 +1,86 @@ +#!/usr/bin/env python + +#------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +#-------------------------------------------------------------------------- + +import re +import os.path +from io import open +from setuptools import find_packages, setup + +# Change the PACKAGE_NAME only to change folder and different name +PACKAGE_NAME = "azure-containerregistry" +PACKAGE_PPRINT_NAME = "MyService Management" + +# a-b-c => a/b/c +package_folder_path = PACKAGE_NAME.replace('-', '/') +# a-b-c => a.b.c +namespace_name = PACKAGE_NAME.replace('-', '.') + +# azure v0.x is not compatible with this package +# azure v0.x used to have a __version__ attribute (newer versions don't) +try: + import azure + try: + ver = azure.__version__ + raise Exception( + 'This package is incompatible with azure=={}. '.format(ver) + + 'Uninstall it with "pip uninstall azure".' + ) + except AttributeError: + pass +except ImportError: + pass + +# Version extraction inspired from 'requests' +with open(os.path.join(package_folder_path, 'version.py'), 'r') as fd: + version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', + fd.read(), re.MULTILINE).group(1) + +if not version: + raise RuntimeError('Cannot find version information') + +with open('README.rst', encoding='utf-8') as f: + readme = f.read() +with open('HISTORY.rst', encoding='utf-8') as f: + history = f.read() + +setup( + name=PACKAGE_NAME, + version=version, + description='Microsoft Azure {} Client Library for Python'.format(PACKAGE_PPRINT_NAME), + long_description=readme + '\n\n' + history, + long_description_content_type='text/x-rst', + license='MIT License', + author='Microsoft Corporation', + author_email='azpysdkhelp@microsoft.com', + url='https://github.com/Azure/azure-sdk-for-python', + classifiers=[ + 'Development Status :: 4 - Beta', + 'Programming Language :: Python', + 'Programming Language :: Python :: 2', + 'Programming Language :: Python :: 2.7', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.5', + 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', + 'License :: OSI Approved :: MIT License', + ], + zip_safe=False, + packages=find_packages(exclude=[ + 'tests', + # Exclude packages that will be covered by PEP420 or nspkg + 'azure', + ]), + install_requires=[ + 'msrest>=0.5.0', + 'msrestazure>=0.4.32,<2.0.0', + 'azure-common~=1.1', + ], + extras_require={ + ":python_version<'3.0'": ['azure-nspkg'], + } +)