From 6850376a3c47e3e289007417f12c7ae1e7c32b4a Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Tue, 22 Jun 2021 07:05:24 +0000 Subject: [PATCH] CodeGen from PR 14834 in Azure/azure-rest-api-specs Merge 3a1bed3a7c88c5b5ac2388b3d2f56c12c72956c8 into c059fb47f87a35ce5a90631883dfba8f01a41d8e --- .../azure-mgmt-containerregistry/_meta.json | 8 +- .../_container_registry_management_client.py | 37 + .../_container_registry_management_client.py | 37 + .../containerregistry/v2017_03_01/_version.py | 2 +- .../v2017_03_01/models/_models.py | 4 +- .../v2017_03_01/models/_models_py3.py | 4 +- .../containerregistry/v2017_10_01/_version.py | 2 +- .../v2017_10_01/models/_models.py | 4 +- .../v2017_10_01/models/_models_py3.py | 4 +- .../v2018_02_01_preview/_version.py | 2 +- .../containerregistry/v2018_09_01/_version.py | 2 +- .../containerregistry/v2019_04_01/_version.py | 2 +- .../containerregistry/v2019_05_01/_version.py | 2 +- .../v2019_05_01/models/_models.py | 4 +- .../v2019_05_01/models/_models_py3.py | 4 +- .../v2019_05_01_preview/_version.py | 2 +- .../v2019_06_01_preview/_version.py | 2 +- .../v2019_12_01_preview/_version.py | 2 +- .../v2019_12_01_preview/models/_models.py | 4 +- .../v2019_12_01_preview/models/_models_py3.py | 4 +- .../v2020_11_01_preview/_version.py | 2 +- .../v2020_11_01_preview/models/_models.py | 4 +- .../v2020_11_01_preview/models/_models_py3.py | 4 +- .../v2021_06_01_preview/__init__.py | 19 + .../v2021_06_01_preview/_configuration.py | 71 + .../_container_registry_management_client.py | 139 + .../v2021_06_01_preview/_metadata.json | 113 + .../v2021_06_01_preview/_version.py | 9 + .../v2021_06_01_preview/aio/__init__.py | 10 + .../v2021_06_01_preview/aio/_configuration.py | 67 + .../_container_registry_management_client.py | 132 + .../aio/operations/__init__.py | 33 + .../_connected_registries_operations.py | 699 +++ .../_export_pipelines_operations.py | 432 ++ .../_import_pipelines_operations.py | 432 ++ .../aio/operations/_operations.py | 104 + .../operations/_pipeline_runs_operations.py | 432 ++ ...private_endpoint_connections_operations.py | 433 ++ .../aio/operations/_registries_operations.py | 1171 +++++ .../operations/_replications_operations.py | 568 +++ .../aio/operations/_scope_maps_operations.py | 568 +++ .../aio/operations/_tokens_operations.py | 568 +++ .../aio/operations/_webhooks_operations.py | 773 ++++ .../v2021_06_01_preview/models/__init__.py | 402 ++ ...tainer_registry_management_client_enums.py | 301 ++ .../v2021_06_01_preview/models/_models.py | 3666 +++++++++++++++ .../v2021_06_01_preview/models/_models_py3.py | 4067 +++++++++++++++++ .../operations/__init__.py | 33 + .../_connected_registries_operations.py | 713 +++ .../_export_pipelines_operations.py | 442 ++ .../_import_pipelines_operations.py | 442 ++ .../operations/_operations.py | 109 + .../operations/_pipeline_runs_operations.py | 442 ++ ...private_endpoint_connections_operations.py | 443 ++ .../operations/_registries_operations.py | 1193 +++++ .../operations/_replications_operations.py | 580 +++ .../operations/_scope_maps_operations.py | 580 +++ .../operations/_tokens_operations.py | 580 +++ .../operations/_webhooks_operations.py | 788 ++++ .../v2021_06_01_preview/py.typed | 1 + 60 files changed, 21663 insertions(+), 34 deletions(-) create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/__init__.py create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/_configuration.py create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/_container_registry_management_client.py create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/_metadata.json create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/_version.py create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/__init__.py create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/_configuration.py create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/_container_registry_management_client.py create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/operations/__init__.py create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/operations/_connected_registries_operations.py create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/operations/_export_pipelines_operations.py create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/operations/_import_pipelines_operations.py create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/operations/_operations.py create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/operations/_pipeline_runs_operations.py create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/operations/_private_endpoint_connections_operations.py create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/operations/_registries_operations.py create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/operations/_replications_operations.py create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/operations/_scope_maps_operations.py create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/operations/_tokens_operations.py create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/operations/_webhooks_operations.py create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/models/__init__.py create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/models/_container_registry_management_client_enums.py create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/models/_models.py create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/models/_models_py3.py create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/operations/__init__.py create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/operations/_connected_registries_operations.py create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/operations/_export_pipelines_operations.py create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/operations/_import_pipelines_operations.py create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/operations/_operations.py create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/operations/_pipeline_runs_operations.py create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/operations/_private_endpoint_connections_operations.py create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/operations/_registries_operations.py create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/operations/_replications_operations.py create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/operations/_scope_maps_operations.py create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/operations/_tokens_operations.py create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/operations/_webhooks_operations.py create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/py.typed diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/_meta.json b/sdk/containerregistry/azure-mgmt-containerregistry/_meta.json index a8e3122d2b29..3724864ed807 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/_meta.json +++ b/sdk/containerregistry/azure-mgmt-containerregistry/_meta.json @@ -1,11 +1,11 @@ { "autorest": "3.4.2", "use": [ - "@autorest/python@5.8.0", - "@autorest/modelerfour@4.19.1" + "@autorest/python@5.8.1", + "@autorest/modelerfour@4.19.2" ], - "commit": "cb635c41dc75e34890f20a26ee509861260c8784", + "commit": "3f63ce40fff45913f8bac7109c4b8ffdb7e52338", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest_command": "autorest specification/containerregistry/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --track2 --use=@autorest/python@5.8.0 --use=@autorest/modelerfour@4.19.1 --version=3.4.2", + "autorest_command": "autorest specification/containerregistry/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --track2 --use=@autorest/python@5.8.1 --use=@autorest/modelerfour@4.19.2 --version=3.4.2", "readme": "specification/containerregistry/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/_container_registry_management_client.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/_container_registry_management_client.py index 76ea59915d84..15c2325759d7 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/_container_registry_management_client.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/_container_registry_management_client.py @@ -106,6 +106,7 @@ def models(cls, api_version=DEFAULT_API_VERSION): * 2019-06-01-preview: :mod:`v2019_06_01_preview.models` * 2019-12-01-preview: :mod:`v2019_12_01_preview.models` * 2020-11-01-preview: :mod:`v2020_11_01_preview.models` + * 2021-06-01-preview: :mod:`v2021_06_01_preview.models` """ if api_version == '2017-03-01': from .v2017_03_01 import models @@ -137,6 +138,9 @@ def models(cls, api_version=DEFAULT_API_VERSION): elif api_version == '2020-11-01-preview': from .v2020_11_01_preview import models return models + elif api_version == '2021-06-01-preview': + from .v2021_06_01_preview import models + return models raise ValueError("API version {} is not available".format(api_version)) @property @@ -196,10 +200,13 @@ def connected_registries(self): """Instance depends on the API version: * 2020-11-01-preview: :class:`ConnectedRegistriesOperations` + * 2021-06-01-preview: :class:`ConnectedRegistriesOperations` """ api_version = self._get_api_version('connected_registries') if api_version == '2020-11-01-preview': from .v2020_11_01_preview.operations import ConnectedRegistriesOperations as OperationClass + elif api_version == '2021-06-01-preview': + from .v2021_06_01_preview.operations import ConnectedRegistriesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'connected_registries'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -210,12 +217,15 @@ def export_pipelines(self): * 2019-12-01-preview: :class:`ExportPipelinesOperations` * 2020-11-01-preview: :class:`ExportPipelinesOperations` + * 2021-06-01-preview: :class:`ExportPipelinesOperations` """ api_version = self._get_api_version('export_pipelines') if api_version == '2019-12-01-preview': from .v2019_12_01_preview.operations import ExportPipelinesOperations as OperationClass elif api_version == '2020-11-01-preview': from .v2020_11_01_preview.operations import ExportPipelinesOperations as OperationClass + elif api_version == '2021-06-01-preview': + from .v2021_06_01_preview.operations import ExportPipelinesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'export_pipelines'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -226,12 +236,15 @@ def import_pipelines(self): * 2019-12-01-preview: :class:`ImportPipelinesOperations` * 2020-11-01-preview: :class:`ImportPipelinesOperations` + * 2021-06-01-preview: :class:`ImportPipelinesOperations` """ api_version = self._get_api_version('import_pipelines') if api_version == '2019-12-01-preview': from .v2019_12_01_preview.operations import ImportPipelinesOperations as OperationClass elif api_version == '2020-11-01-preview': from .v2020_11_01_preview.operations import ImportPipelinesOperations as OperationClass + elif api_version == '2021-06-01-preview': + from .v2021_06_01_preview.operations import ImportPipelinesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'import_pipelines'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -245,6 +258,7 @@ def operations(self): * 2019-05-01: :class:`Operations` * 2019-12-01-preview: :class:`Operations` * 2020-11-01-preview: :class:`Operations` + * 2021-06-01-preview: :class:`Operations` """ api_version = self._get_api_version('operations') if api_version == '2017-03-01': @@ -257,6 +271,8 @@ def operations(self): from .v2019_12_01_preview.operations import Operations as OperationClass elif api_version == '2020-11-01-preview': from .v2020_11_01_preview.operations import Operations as OperationClass + elif api_version == '2021-06-01-preview': + from .v2021_06_01_preview.operations import Operations as OperationClass else: raise ValueError("API version {} does not have operation group 'operations'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -267,12 +283,15 @@ def pipeline_runs(self): * 2019-12-01-preview: :class:`PipelineRunsOperations` * 2020-11-01-preview: :class:`PipelineRunsOperations` + * 2021-06-01-preview: :class:`PipelineRunsOperations` """ api_version = self._get_api_version('pipeline_runs') if api_version == '2019-12-01-preview': from .v2019_12_01_preview.operations import PipelineRunsOperations as OperationClass elif api_version == '2020-11-01-preview': from .v2020_11_01_preview.operations import PipelineRunsOperations as OperationClass + elif api_version == '2021-06-01-preview': + from .v2021_06_01_preview.operations import PipelineRunsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'pipeline_runs'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -283,12 +302,15 @@ def private_endpoint_connections(self): * 2019-12-01-preview: :class:`PrivateEndpointConnectionsOperations` * 2020-11-01-preview: :class:`PrivateEndpointConnectionsOperations` + * 2021-06-01-preview: :class:`PrivateEndpointConnectionsOperations` """ api_version = self._get_api_version('private_endpoint_connections') if api_version == '2019-12-01-preview': from .v2019_12_01_preview.operations import PrivateEndpointConnectionsOperations as OperationClass elif api_version == '2020-11-01-preview': from .v2020_11_01_preview.operations import PrivateEndpointConnectionsOperations as OperationClass + elif api_version == '2021-06-01-preview': + from .v2021_06_01_preview.operations import PrivateEndpointConnectionsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'private_endpoint_connections'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -307,6 +329,7 @@ def registries(self): * 2019-06-01-preview: :class:`RegistriesOperations` * 2019-12-01-preview: :class:`RegistriesOperations` * 2020-11-01-preview: :class:`RegistriesOperations` + * 2021-06-01-preview: :class:`RegistriesOperations` """ api_version = self._get_api_version('registries') if api_version == '2017-03-01': @@ -329,6 +352,8 @@ def registries(self): from .v2019_12_01_preview.operations import RegistriesOperations as OperationClass elif api_version == '2020-11-01-preview': from .v2020_11_01_preview.operations import RegistriesOperations as OperationClass + elif api_version == '2021-06-01-preview': + from .v2021_06_01_preview.operations import RegistriesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'registries'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -341,6 +366,7 @@ def replications(self): * 2019-05-01: :class:`ReplicationsOperations` * 2019-12-01-preview: :class:`ReplicationsOperations` * 2020-11-01-preview: :class:`ReplicationsOperations` + * 2021-06-01-preview: :class:`ReplicationsOperations` """ api_version = self._get_api_version('replications') if api_version == '2017-10-01': @@ -351,6 +377,8 @@ def replications(self): from .v2019_12_01_preview.operations import ReplicationsOperations as OperationClass elif api_version == '2020-11-01-preview': from .v2020_11_01_preview.operations import ReplicationsOperations as OperationClass + elif api_version == '2021-06-01-preview': + from .v2021_06_01_preview.operations import ReplicationsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'replications'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -380,12 +408,15 @@ def scope_maps(self): * 2019-05-01-preview: :class:`ScopeMapsOperations` * 2020-11-01-preview: :class:`ScopeMapsOperations` + * 2021-06-01-preview: :class:`ScopeMapsOperations` """ api_version = self._get_api_version('scope_maps') if api_version == '2019-05-01-preview': from .v2019_05_01_preview.operations import ScopeMapsOperations as OperationClass elif api_version == '2020-11-01-preview': from .v2020_11_01_preview.operations import ScopeMapsOperations as OperationClass + elif api_version == '2021-06-01-preview': + from .v2021_06_01_preview.operations import ScopeMapsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'scope_maps'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -428,12 +459,15 @@ def tokens(self): * 2019-05-01-preview: :class:`TokensOperations` * 2020-11-01-preview: :class:`TokensOperations` + * 2021-06-01-preview: :class:`TokensOperations` """ api_version = self._get_api_version('tokens') if api_version == '2019-05-01-preview': from .v2019_05_01_preview.operations import TokensOperations as OperationClass elif api_version == '2020-11-01-preview': from .v2020_11_01_preview.operations import TokensOperations as OperationClass + elif api_version == '2021-06-01-preview': + from .v2021_06_01_preview.operations import TokensOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'tokens'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -446,6 +480,7 @@ def webhooks(self): * 2019-05-01: :class:`WebhooksOperations` * 2019-12-01-preview: :class:`WebhooksOperations` * 2020-11-01-preview: :class:`WebhooksOperations` + * 2021-06-01-preview: :class:`WebhooksOperations` """ api_version = self._get_api_version('webhooks') if api_version == '2017-10-01': @@ -456,6 +491,8 @@ def webhooks(self): from .v2019_12_01_preview.operations import WebhooksOperations as OperationClass elif api_version == '2020-11-01-preview': from .v2020_11_01_preview.operations import WebhooksOperations as OperationClass + elif api_version == '2021-06-01-preview': + from .v2021_06_01_preview.operations import WebhooksOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'webhooks'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/aio/_container_registry_management_client.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/aio/_container_registry_management_client.py index fba14e3ebea3..fce2298add78 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/aio/_container_registry_management_client.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/aio/_container_registry_management_client.py @@ -104,6 +104,7 @@ def models(cls, api_version=DEFAULT_API_VERSION): * 2019-06-01-preview: :mod:`v2019_06_01_preview.models` * 2019-12-01-preview: :mod:`v2019_12_01_preview.models` * 2020-11-01-preview: :mod:`v2020_11_01_preview.models` + * 2021-06-01-preview: :mod:`v2021_06_01_preview.models` """ if api_version == '2017-03-01': from ..v2017_03_01 import models @@ -135,6 +136,9 @@ def models(cls, api_version=DEFAULT_API_VERSION): elif api_version == '2020-11-01-preview': from ..v2020_11_01_preview import models return models + elif api_version == '2021-06-01-preview': + from ..v2021_06_01_preview import models + return models raise ValueError("API version {} is not available".format(api_version)) @property @@ -194,10 +198,13 @@ def connected_registries(self): """Instance depends on the API version: * 2020-11-01-preview: :class:`ConnectedRegistriesOperations` + * 2021-06-01-preview: :class:`ConnectedRegistriesOperations` """ api_version = self._get_api_version('connected_registries') if api_version == '2020-11-01-preview': from ..v2020_11_01_preview.aio.operations import ConnectedRegistriesOperations as OperationClass + elif api_version == '2021-06-01-preview': + from ..v2021_06_01_preview.aio.operations import ConnectedRegistriesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'connected_registries'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -208,12 +215,15 @@ def export_pipelines(self): * 2019-12-01-preview: :class:`ExportPipelinesOperations` * 2020-11-01-preview: :class:`ExportPipelinesOperations` + * 2021-06-01-preview: :class:`ExportPipelinesOperations` """ api_version = self._get_api_version('export_pipelines') if api_version == '2019-12-01-preview': from ..v2019_12_01_preview.aio.operations import ExportPipelinesOperations as OperationClass elif api_version == '2020-11-01-preview': from ..v2020_11_01_preview.aio.operations import ExportPipelinesOperations as OperationClass + elif api_version == '2021-06-01-preview': + from ..v2021_06_01_preview.aio.operations import ExportPipelinesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'export_pipelines'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -224,12 +234,15 @@ def import_pipelines(self): * 2019-12-01-preview: :class:`ImportPipelinesOperations` * 2020-11-01-preview: :class:`ImportPipelinesOperations` + * 2021-06-01-preview: :class:`ImportPipelinesOperations` """ api_version = self._get_api_version('import_pipelines') if api_version == '2019-12-01-preview': from ..v2019_12_01_preview.aio.operations import ImportPipelinesOperations as OperationClass elif api_version == '2020-11-01-preview': from ..v2020_11_01_preview.aio.operations import ImportPipelinesOperations as OperationClass + elif api_version == '2021-06-01-preview': + from ..v2021_06_01_preview.aio.operations import ImportPipelinesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'import_pipelines'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -243,6 +256,7 @@ def operations(self): * 2019-05-01: :class:`Operations` * 2019-12-01-preview: :class:`Operations` * 2020-11-01-preview: :class:`Operations` + * 2021-06-01-preview: :class:`Operations` """ api_version = self._get_api_version('operations') if api_version == '2017-03-01': @@ -255,6 +269,8 @@ def operations(self): from ..v2019_12_01_preview.aio.operations import Operations as OperationClass elif api_version == '2020-11-01-preview': from ..v2020_11_01_preview.aio.operations import Operations as OperationClass + elif api_version == '2021-06-01-preview': + from ..v2021_06_01_preview.aio.operations import Operations as OperationClass else: raise ValueError("API version {} does not have operation group 'operations'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -265,12 +281,15 @@ def pipeline_runs(self): * 2019-12-01-preview: :class:`PipelineRunsOperations` * 2020-11-01-preview: :class:`PipelineRunsOperations` + * 2021-06-01-preview: :class:`PipelineRunsOperations` """ api_version = self._get_api_version('pipeline_runs') if api_version == '2019-12-01-preview': from ..v2019_12_01_preview.aio.operations import PipelineRunsOperations as OperationClass elif api_version == '2020-11-01-preview': from ..v2020_11_01_preview.aio.operations import PipelineRunsOperations as OperationClass + elif api_version == '2021-06-01-preview': + from ..v2021_06_01_preview.aio.operations import PipelineRunsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'pipeline_runs'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -281,12 +300,15 @@ def private_endpoint_connections(self): * 2019-12-01-preview: :class:`PrivateEndpointConnectionsOperations` * 2020-11-01-preview: :class:`PrivateEndpointConnectionsOperations` + * 2021-06-01-preview: :class:`PrivateEndpointConnectionsOperations` """ api_version = self._get_api_version('private_endpoint_connections') if api_version == '2019-12-01-preview': from ..v2019_12_01_preview.aio.operations import PrivateEndpointConnectionsOperations as OperationClass elif api_version == '2020-11-01-preview': from ..v2020_11_01_preview.aio.operations import PrivateEndpointConnectionsOperations as OperationClass + elif api_version == '2021-06-01-preview': + from ..v2021_06_01_preview.aio.operations import PrivateEndpointConnectionsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'private_endpoint_connections'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -305,6 +327,7 @@ def registries(self): * 2019-06-01-preview: :class:`RegistriesOperations` * 2019-12-01-preview: :class:`RegistriesOperations` * 2020-11-01-preview: :class:`RegistriesOperations` + * 2021-06-01-preview: :class:`RegistriesOperations` """ api_version = self._get_api_version('registries') if api_version == '2017-03-01': @@ -327,6 +350,8 @@ def registries(self): from ..v2019_12_01_preview.aio.operations import RegistriesOperations as OperationClass elif api_version == '2020-11-01-preview': from ..v2020_11_01_preview.aio.operations import RegistriesOperations as OperationClass + elif api_version == '2021-06-01-preview': + from ..v2021_06_01_preview.aio.operations import RegistriesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'registries'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -339,6 +364,7 @@ def replications(self): * 2019-05-01: :class:`ReplicationsOperations` * 2019-12-01-preview: :class:`ReplicationsOperations` * 2020-11-01-preview: :class:`ReplicationsOperations` + * 2021-06-01-preview: :class:`ReplicationsOperations` """ api_version = self._get_api_version('replications') if api_version == '2017-10-01': @@ -349,6 +375,8 @@ def replications(self): from ..v2019_12_01_preview.aio.operations import ReplicationsOperations as OperationClass elif api_version == '2020-11-01-preview': from ..v2020_11_01_preview.aio.operations import ReplicationsOperations as OperationClass + elif api_version == '2021-06-01-preview': + from ..v2021_06_01_preview.aio.operations import ReplicationsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'replications'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -378,12 +406,15 @@ def scope_maps(self): * 2019-05-01-preview: :class:`ScopeMapsOperations` * 2020-11-01-preview: :class:`ScopeMapsOperations` + * 2021-06-01-preview: :class:`ScopeMapsOperations` """ api_version = self._get_api_version('scope_maps') if api_version == '2019-05-01-preview': from ..v2019_05_01_preview.aio.operations import ScopeMapsOperations as OperationClass elif api_version == '2020-11-01-preview': from ..v2020_11_01_preview.aio.operations import ScopeMapsOperations as OperationClass + elif api_version == '2021-06-01-preview': + from ..v2021_06_01_preview.aio.operations import ScopeMapsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'scope_maps'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -426,12 +457,15 @@ def tokens(self): * 2019-05-01-preview: :class:`TokensOperations` * 2020-11-01-preview: :class:`TokensOperations` + * 2021-06-01-preview: :class:`TokensOperations` """ api_version = self._get_api_version('tokens') if api_version == '2019-05-01-preview': from ..v2019_05_01_preview.aio.operations import TokensOperations as OperationClass elif api_version == '2020-11-01-preview': from ..v2020_11_01_preview.aio.operations import TokensOperations as OperationClass + elif api_version == '2021-06-01-preview': + from ..v2021_06_01_preview.aio.operations import TokensOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'tokens'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -444,6 +478,7 @@ def webhooks(self): * 2019-05-01: :class:`WebhooksOperations` * 2019-12-01-preview: :class:`WebhooksOperations` * 2020-11-01-preview: :class:`WebhooksOperations` + * 2021-06-01-preview: :class:`WebhooksOperations` """ api_version = self._get_api_version('webhooks') if api_version == '2017-10-01': @@ -454,6 +489,8 @@ def webhooks(self): from ..v2019_12_01_preview.aio.operations import WebhooksOperations as OperationClass elif api_version == '2020-11-01-preview': from ..v2020_11_01_preview.aio.operations import WebhooksOperations as OperationClass + elif api_version == '2021-06-01-preview': + from ..v2021_06_01_preview.aio.operations import WebhooksOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'webhooks'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_03_01/_version.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_03_01/_version.py index 5673000dce3f..e5754a47ce68 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_03_01/_version.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_03_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "8.0.0b2" +VERSION = "1.0.0b1" diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_03_01/models/_models.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_03_01/models/_models.py index be275397b531..37adc6c774c3 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_03_01/models/_models.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_03_01/models/_models.py @@ -335,8 +335,8 @@ class RegistryNameCheckRequest(msrest.serialization.Model): :param name: Required. The name of the container registry. :type name: str - :ivar type: Required. The resource type of the container registry. This field must be set to - 'Microsoft.ContainerRegistry/registries'. Default value: + :ivar type: The resource type of the container registry. This field must be set to + 'Microsoft.ContainerRegistry/registries'. Has constant value: "Microsoft.ContainerRegistry/registries". :vartype type: str """ diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_03_01/models/_models_py3.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_03_01/models/_models_py3.py index 9bc53a0d5d63..072ccedef154 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_03_01/models/_models_py3.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_03_01/models/_models_py3.py @@ -373,8 +373,8 @@ class RegistryNameCheckRequest(msrest.serialization.Model): :param name: Required. The name of the container registry. :type name: str - :ivar type: Required. The resource type of the container registry. This field must be set to - 'Microsoft.ContainerRegistry/registries'. Default value: + :ivar type: The resource type of the container registry. This field must be set to + 'Microsoft.ContainerRegistry/registries'. Has constant value: "Microsoft.ContainerRegistry/registries". :vartype type: str """ diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_10_01/_version.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_10_01/_version.py index 5673000dce3f..e5754a47ce68 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_10_01/_version.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_10_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "8.0.0b2" +VERSION = "1.0.0b1" diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_10_01/models/_models.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_10_01/models/_models.py index 0de52073179e..5256c6fe6341 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_10_01/models/_models.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_10_01/models/_models.py @@ -799,8 +799,8 @@ class RegistryNameCheckRequest(msrest.serialization.Model): :param name: Required. The name of the container registry. :type name: str - :ivar type: Required. The resource type of the container registry. This field must be set to - 'Microsoft.ContainerRegistry/registries'. Default value: + :ivar type: The resource type of the container registry. This field must be set to + 'Microsoft.ContainerRegistry/registries'. Has constant value: "Microsoft.ContainerRegistry/registries". :vartype type: str """ diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_10_01/models/_models_py3.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_10_01/models/_models_py3.py index d31fb948022f..cd3b3b57e5ad 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_10_01/models/_models_py3.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_10_01/models/_models_py3.py @@ -900,8 +900,8 @@ class RegistryNameCheckRequest(msrest.serialization.Model): :param name: Required. The name of the container registry. :type name: str - :ivar type: Required. The resource type of the container registry. This field must be set to - 'Microsoft.ContainerRegistry/registries'. Default value: + :ivar type: The resource type of the container registry. This field must be set to + 'Microsoft.ContainerRegistry/registries'. Has constant value: "Microsoft.ContainerRegistry/registries". :vartype type: str """ diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/_version.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/_version.py index 5673000dce3f..e5754a47ce68 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/_version.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "8.0.0b2" +VERSION = "1.0.0b1" diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_09_01/_version.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_09_01/_version.py index 5673000dce3f..e5754a47ce68 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_09_01/_version.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_09_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "8.0.0b2" +VERSION = "1.0.0b1" diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_04_01/_version.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_04_01/_version.py index 5673000dce3f..e5754a47ce68 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_04_01/_version.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_04_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "8.0.0b2" +VERSION = "1.0.0b1" diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01/_version.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01/_version.py index 5673000dce3f..e5754a47ce68 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01/_version.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "8.0.0b2" +VERSION = "1.0.0b1" diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01/models/_models.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01/models/_models.py index 77d38ef02814..47589e18da9f 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01/models/_models.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01/models/_models.py @@ -830,8 +830,8 @@ class RegistryNameCheckRequest(msrest.serialization.Model): :param name: Required. The name of the container registry. :type name: str - :ivar type: Required. The resource type of the container registry. This field must be set to - 'Microsoft.ContainerRegistry/registries'. Default value: + :ivar type: The resource type of the container registry. This field must be set to + 'Microsoft.ContainerRegistry/registries'. Has constant value: "Microsoft.ContainerRegistry/registries". :vartype type: str """ diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01/models/_models_py3.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01/models/_models_py3.py index 1ee3b6a69124..3be2a3280335 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01/models/_models_py3.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01/models/_models_py3.py @@ -936,8 +936,8 @@ class RegistryNameCheckRequest(msrest.serialization.Model): :param name: Required. The name of the container registry. :type name: str - :ivar type: Required. The resource type of the container registry. This field must be set to - 'Microsoft.ContainerRegistry/registries'. Default value: + :ivar type: The resource type of the container registry. This field must be set to + 'Microsoft.ContainerRegistry/registries'. Has constant value: "Microsoft.ContainerRegistry/registries". :vartype type: str """ diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01_preview/_version.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01_preview/_version.py index 5673000dce3f..e5754a47ce68 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01_preview/_version.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_05_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "8.0.0b2" +VERSION = "1.0.0b1" diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/_version.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/_version.py index 5673000dce3f..e5754a47ce68 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/_version.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "8.0.0b2" +VERSION = "1.0.0b1" diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/_version.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/_version.py index 5673000dce3f..e5754a47ce68 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/_version.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "8.0.0b2" +VERSION = "1.0.0b1" diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/models/_models.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/models/_models.py index f62d7918cf80..01721f7f2a21 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/models/_models.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/models/_models.py @@ -1838,8 +1838,8 @@ class RegistryNameCheckRequest(msrest.serialization.Model): :param name: Required. The name of the container registry. :type name: str - :ivar type: Required. The resource type of the container registry. This field must be set to - 'Microsoft.ContainerRegistry/registries'. Default value: + :ivar type: The resource type of the container registry. This field must be set to + 'Microsoft.ContainerRegistry/registries'. Has constant value: "Microsoft.ContainerRegistry/registries". :vartype type: str """ diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/models/_models_py3.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/models/_models_py3.py index 4c97db0b500e..d2a925031c55 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/models/_models_py3.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/models/_models_py3.py @@ -2049,8 +2049,8 @@ class RegistryNameCheckRequest(msrest.serialization.Model): :param name: Required. The name of the container registry. :type name: str - :ivar type: Required. The resource type of the container registry. This field must be set to - 'Microsoft.ContainerRegistry/registries'. Default value: + :ivar type: The resource type of the container registry. This field must be set to + 'Microsoft.ContainerRegistry/registries'. Has constant value: "Microsoft.ContainerRegistry/registries". :vartype type: str """ diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/_version.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/_version.py index 5673000dce3f..e5754a47ce68 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/_version.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "8.0.0b2" +VERSION = "1.0.0b1" diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/models/_models.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/models/_models.py index 84950795ea8b..3e1b98272095 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/models/_models.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/models/_models.py @@ -2280,8 +2280,8 @@ class RegistryNameCheckRequest(msrest.serialization.Model): :param name: Required. The name of the container registry. :type name: str - :ivar type: Required. The resource type of the container registry. This field must be set to - 'Microsoft.ContainerRegistry/registries'. Default value: + :ivar type: The resource type of the container registry. This field must be set to + 'Microsoft.ContainerRegistry/registries'. Has constant value: "Microsoft.ContainerRegistry/registries". :vartype type: str """ diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/models/_models_py3.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/models/_models_py3.py index 9474c6b6a662..9cdc96641349 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/models/_models_py3.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/models/_models_py3.py @@ -2533,8 +2533,8 @@ class RegistryNameCheckRequest(msrest.serialization.Model): :param name: Required. The name of the container registry. :type name: str - :ivar type: Required. The resource type of the container registry. This field must be set to - 'Microsoft.ContainerRegistry/registries'. Default value: + :ivar type: The resource type of the container registry. This field must be set to + 'Microsoft.ContainerRegistry/registries'. Has constant value: "Microsoft.ContainerRegistry/registries". :vartype type: str """ diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/__init__.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/__init__.py new file mode 100644 index 000000000000..0c85bb0c5d60 --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/__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 ._container_registry_management_client import ContainerRegistryManagementClient +from ._version import VERSION + +__version__ = VERSION +__all__ = ['ContainerRegistryManagementClient'] + +try: + from ._patch import patch_sdk # type: ignore + patch_sdk() +except ImportError: + pass diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/_configuration.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/_configuration.py new file mode 100644 index 000000000000..1c7a837c89aa --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/_configuration.py @@ -0,0 +1,71 @@ +# 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 typing import TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy + +from ._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any + + from azure.core.credentials import TokenCredential + + +class ContainerRegistryManagementClientConfiguration(Configuration): + """Configuration for ContainerRegistryManagementClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: The Microsoft Azure subscription ID. + :type subscription_id: str + """ + + def __init__( + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + super(ContainerRegistryManagementClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2021-06-01-preview" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-containerregistry/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs # type: Any + ): + # type: (...) -> None + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/_container_registry_management_client.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/_container_registry_management_client.py new file mode 100644 index 000000000000..df060a3fffb2 --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/_container_registry_management_client.py @@ -0,0 +1,139 @@ +# 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 typing import TYPE_CHECKING + +from azure.mgmt.core import ARMPipelineClient +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Optional + + from azure.core.credentials import TokenCredential + from azure.core.pipeline.transport import HttpRequest, HttpResponse + +from ._configuration import ContainerRegistryManagementClientConfiguration +from .operations import ConnectedRegistriesOperations +from .operations import ExportPipelinesOperations +from .operations import RegistriesOperations +from .operations import ImportPipelinesOperations +from .operations import Operations +from .operations import PipelineRunsOperations +from .operations import PrivateEndpointConnectionsOperations +from .operations import ReplicationsOperations +from .operations import ScopeMapsOperations +from .operations import TokensOperations +from .operations import WebhooksOperations +from . import models + + +class ContainerRegistryManagementClient(object): + """ContainerRegistryManagementClient. + + :ivar connected_registries: ConnectedRegistriesOperations operations + :vartype connected_registries: azure.mgmt.containerregistry.v2021_06_01_preview.operations.ConnectedRegistriesOperations + :ivar export_pipelines: ExportPipelinesOperations operations + :vartype export_pipelines: azure.mgmt.containerregistry.v2021_06_01_preview.operations.ExportPipelinesOperations + :ivar registries: RegistriesOperations operations + :vartype registries: azure.mgmt.containerregistry.v2021_06_01_preview.operations.RegistriesOperations + :ivar import_pipelines: ImportPipelinesOperations operations + :vartype import_pipelines: azure.mgmt.containerregistry.v2021_06_01_preview.operations.ImportPipelinesOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.containerregistry.v2021_06_01_preview.operations.Operations + :ivar pipeline_runs: PipelineRunsOperations operations + :vartype pipeline_runs: azure.mgmt.containerregistry.v2021_06_01_preview.operations.PipelineRunsOperations + :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations + :vartype private_endpoint_connections: azure.mgmt.containerregistry.v2021_06_01_preview.operations.PrivateEndpointConnectionsOperations + :ivar replications: ReplicationsOperations operations + :vartype replications: azure.mgmt.containerregistry.v2021_06_01_preview.operations.ReplicationsOperations + :ivar scope_maps: ScopeMapsOperations operations + :vartype scope_maps: azure.mgmt.containerregistry.v2021_06_01_preview.operations.ScopeMapsOperations + :ivar tokens: TokensOperations operations + :vartype tokens: azure.mgmt.containerregistry.v2021_06_01_preview.operations.TokensOperations + :ivar webhooks: WebhooksOperations operations + :vartype webhooks: azure.mgmt.containerregistry.v2021_06_01_preview.operations.WebhooksOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: The Microsoft Azure subscription ID. + :type subscription_id: str + :param str base_url: Service URL + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + """ + + def __init__( + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + base_url=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> None + if not base_url: + base_url = 'https://management.azure.com' + self._config = ContainerRegistryManagementClientConfiguration(credential, subscription_id, **kwargs) + self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._serialize.client_side_validation = False + self._deserialize = Deserializer(client_models) + + self.connected_registries = ConnectedRegistriesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.export_pipelines = ExportPipelinesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.registries = RegistriesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.import_pipelines = ImportPipelinesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize) + self.pipeline_runs = PipelineRunsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.replications = ReplicationsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.scope_maps = ScopeMapsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.tokens = TokensOperations( + self._client, self._config, self._serialize, self._deserialize) + self.webhooks = WebhooksOperations( + self._client, self._config, self._serialize, self._deserialize) + + def _send_request(self, http_request, **kwargs): + # type: (HttpRequest, Any) -> HttpResponse + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.HttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + + def close(self): + # type: () -> None + self._client.close() + + def __enter__(self): + # type: () -> ContainerRegistryManagementClient + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/_metadata.json b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/_metadata.json new file mode 100644 index 000000000000..1f9ede71d80a --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/_metadata.json @@ -0,0 +1,113 @@ +{ + "chosen_version": "2021-06-01-preview", + "total_api_version_list": ["2021-06-01-preview"], + "client": { + "name": "ContainerRegistryManagementClient", + "filename": "_container_registry_management_client", + "description": "ContainerRegistryManagementClient.", + "base_url": "\u0027https://management.azure.com\u0027", + "custom_base_url": null, + "azure_arm": true, + "has_lro_operations": true, + "client_side_validation": false, + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerRegistryManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerRegistryManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + }, + "global_parameters": { + "sync": { + "credential": { + "signature": "credential, # type: \"TokenCredential\"", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials.TokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id, # type: str", + "description": "The Microsoft Azure subscription ID.", + "docstring_type": "str", + "required": true + } + }, + "async": { + "credential": { + "signature": "credential: \"AsyncTokenCredential\",", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id: str,", + "description": "The Microsoft Azure subscription ID.", + "docstring_type": "str", + "required": true + } + }, + "constant": { + }, + "call": "credential, subscription_id", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version=None, # type: Optional[str]", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url=None, # type: Optional[str]", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url: Optional[str] = None,", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + } + } + }, + "config": { + "credential": true, + "credential_scopes": ["https://management.azure.com/.default"], + "credential_default_policy_type": "BearerTokenCredentialPolicy", + "credential_default_policy_type_has_async_version": true, + "credential_key_header_name": null, + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + }, + "operation_groups": { + "connected_registries": "ConnectedRegistriesOperations", + "export_pipelines": "ExportPipelinesOperations", + "registries": "RegistriesOperations", + "import_pipelines": "ImportPipelinesOperations", + "operations": "Operations", + "pipeline_runs": "PipelineRunsOperations", + "private_endpoint_connections": "PrivateEndpointConnectionsOperations", + "replications": "ReplicationsOperations", + "scope_maps": "ScopeMapsOperations", + "tokens": "TokensOperations", + "webhooks": "WebhooksOperations" + } +} \ No newline at end of file diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/_version.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/_version.py new file mode 100644 index 000000000000..e5754a47ce68 --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/_version.py @@ -0,0 +1,9 @@ +# 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 = "1.0.0b1" diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/__init__.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/__init__.py new file mode 100644 index 000000000000..3f69d67ba538 --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/__init__.py @@ -0,0 +1,10 @@ +# 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 ._container_registry_management_client import ContainerRegistryManagementClient +__all__ = ['ContainerRegistryManagementClient'] diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/_configuration.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/_configuration.py new file mode 100644 index 000000000000..8b9eecbd9a13 --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/_configuration.py @@ -0,0 +1,67 @@ +# 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 typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy + +from .._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class ContainerRegistryManagementClientConfiguration(Configuration): + """Configuration for ContainerRegistryManagementClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The Microsoft Azure subscription ID. + :type subscription_id: str + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + super(ContainerRegistryManagementClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2021-06-01-preview" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-containerregistry/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/_container_registry_management_client.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/_container_registry_management_client.py new file mode 100644 index 000000000000..3d582531459d --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/_container_registry_management_client.py @@ -0,0 +1,132 @@ +# 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 typing import Any, Optional, TYPE_CHECKING + +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core import AsyncARMPipelineClient +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +from ._configuration import ContainerRegistryManagementClientConfiguration +from .operations import ConnectedRegistriesOperations +from .operations import ExportPipelinesOperations +from .operations import RegistriesOperations +from .operations import ImportPipelinesOperations +from .operations import Operations +from .operations import PipelineRunsOperations +from .operations import PrivateEndpointConnectionsOperations +from .operations import ReplicationsOperations +from .operations import ScopeMapsOperations +from .operations import TokensOperations +from .operations import WebhooksOperations +from .. import models + + +class ContainerRegistryManagementClient(object): + """ContainerRegistryManagementClient. + + :ivar connected_registries: ConnectedRegistriesOperations operations + :vartype connected_registries: azure.mgmt.containerregistry.v2021_06_01_preview.aio.operations.ConnectedRegistriesOperations + :ivar export_pipelines: ExportPipelinesOperations operations + :vartype export_pipelines: azure.mgmt.containerregistry.v2021_06_01_preview.aio.operations.ExportPipelinesOperations + :ivar registries: RegistriesOperations operations + :vartype registries: azure.mgmt.containerregistry.v2021_06_01_preview.aio.operations.RegistriesOperations + :ivar import_pipelines: ImportPipelinesOperations operations + :vartype import_pipelines: azure.mgmt.containerregistry.v2021_06_01_preview.aio.operations.ImportPipelinesOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.containerregistry.v2021_06_01_preview.aio.operations.Operations + :ivar pipeline_runs: PipelineRunsOperations operations + :vartype pipeline_runs: azure.mgmt.containerregistry.v2021_06_01_preview.aio.operations.PipelineRunsOperations + :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations + :vartype private_endpoint_connections: azure.mgmt.containerregistry.v2021_06_01_preview.aio.operations.PrivateEndpointConnectionsOperations + :ivar replications: ReplicationsOperations operations + :vartype replications: azure.mgmt.containerregistry.v2021_06_01_preview.aio.operations.ReplicationsOperations + :ivar scope_maps: ScopeMapsOperations operations + :vartype scope_maps: azure.mgmt.containerregistry.v2021_06_01_preview.aio.operations.ScopeMapsOperations + :ivar tokens: TokensOperations operations + :vartype tokens: azure.mgmt.containerregistry.v2021_06_01_preview.aio.operations.TokensOperations + :ivar webhooks: WebhooksOperations operations + :vartype webhooks: azure.mgmt.containerregistry.v2021_06_01_preview.aio.operations.WebhooksOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The Microsoft Azure subscription ID. + :type subscription_id: str + :param str base_url: Service URL + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: Optional[str] = None, + **kwargs: Any + ) -> None: + if not base_url: + base_url = 'https://management.azure.com' + self._config = ContainerRegistryManagementClientConfiguration(credential, subscription_id, **kwargs) + self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._serialize.client_side_validation = False + self._deserialize = Deserializer(client_models) + + self.connected_registries = ConnectedRegistriesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.export_pipelines = ExportPipelinesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.registries = RegistriesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.import_pipelines = ImportPipelinesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize) + self.pipeline_runs = PipelineRunsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.replications = ReplicationsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.scope_maps = ScopeMapsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.tokens = TokensOperations( + self._client, self._config, self._serialize, self._deserialize) + self.webhooks = WebhooksOperations( + self._client, self._config, self._serialize, self._deserialize) + + async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "ContainerRegistryManagementClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/operations/__init__.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/operations/__init__.py new file mode 100644 index 000000000000..532500a8b984 --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/operations/__init__.py @@ -0,0 +1,33 @@ +# 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 ._connected_registries_operations import ConnectedRegistriesOperations +from ._export_pipelines_operations import ExportPipelinesOperations +from ._registries_operations import RegistriesOperations +from ._import_pipelines_operations import ImportPipelinesOperations +from ._operations import Operations +from ._pipeline_runs_operations import PipelineRunsOperations +from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations +from ._replications_operations import ReplicationsOperations +from ._scope_maps_operations import ScopeMapsOperations +from ._tokens_operations import TokensOperations +from ._webhooks_operations import WebhooksOperations + +__all__ = [ + 'ConnectedRegistriesOperations', + 'ExportPipelinesOperations', + 'RegistriesOperations', + 'ImportPipelinesOperations', + 'Operations', + 'PipelineRunsOperations', + 'PrivateEndpointConnectionsOperations', + 'ReplicationsOperations', + 'ScopeMapsOperations', + 'TokensOperations', + 'WebhooksOperations', +] diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/operations/_connected_registries_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/operations/_connected_registries_operations.py new file mode 100644 index 000000000000..fdb8fe92c394 --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/operations/_connected_registries_operations.py @@ -0,0 +1,699 @@ +# 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 typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ConnectedRegistriesOperations: + """ConnectedRegistriesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.containerregistry.v2021_06_01_preview.models + :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) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + resource_group_name: str, + registry_name: str, + connected_registry_name: str, + **kwargs: Any + ) -> "_models.ConnectedRegistry": + """Gets the properties of the connected registry. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param connected_registry_name: The name of the connected registry. + :type connected_registry_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ConnectedRegistry, or the result of cls(response) + :rtype: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ConnectedRegistry + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConnectedRegistry"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'connectedRegistryName': self._serialize.url("connected_registry_name", connected_registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ConnectedRegistry', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/connectedRegistries/{connectedRegistryName}'} # type: ignore + + async def _create_initial( + self, + resource_group_name: str, + registry_name: str, + connected_registry_name: str, + connected_registry_create_parameters: "_models.ConnectedRegistry", + **kwargs: Any + ) -> "_models.ConnectedRegistry": + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConnectedRegistry"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'connectedRegistryName': self._serialize.url("connected_registry_name", connected_registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(connected_registry_create_parameters, 'ConnectedRegistry') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ConnectedRegistry', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('ConnectedRegistry', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/connectedRegistries/{connectedRegistryName}'} # type: ignore + + async def begin_create( + self, + resource_group_name: str, + registry_name: str, + connected_registry_name: str, + connected_registry_create_parameters: "_models.ConnectedRegistry", + **kwargs: Any + ) -> AsyncLROPoller["_models.ConnectedRegistry"]: + """Creates a connected registry for a container registry with the specified parameters. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param connected_registry_name: The name of the connected registry. + :type connected_registry_name: str + :param connected_registry_create_parameters: The parameters for creating a connectedRegistry. + :type connected_registry_create_parameters: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ConnectedRegistry + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ConnectedRegistry or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2021_06_01_preview.models.ConnectedRegistry] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConnectedRegistry"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + connected_registry_name=connected_registry_name, + connected_registry_create_parameters=connected_registry_create_parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('ConnectedRegistry', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'connectedRegistryName': self._serialize.url("connected_registry_name", connected_registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/connectedRegistries/{connectedRegistryName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + registry_name: str, + connected_registry_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'connectedRegistryName': self._serialize.url("connected_registry_name", connected_registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/connectedRegistries/{connectedRegistryName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + registry_name: str, + connected_registry_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes a connected registry from a container registry. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param connected_registry_name: The name of the connected registry. + :type connected_registry_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + connected_registry_name=connected_registry_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'connectedRegistryName': self._serialize.url("connected_registry_name", connected_registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/connectedRegistries/{connectedRegistryName}'} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + registry_name: str, + connected_registry_name: str, + connected_registry_update_parameters: "_models.ConnectedRegistryUpdateParameters", + **kwargs: Any + ) -> "_models.ConnectedRegistry": + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConnectedRegistry"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'connectedRegistryName': self._serialize.url("connected_registry_name", connected_registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(connected_registry_update_parameters, 'ConnectedRegistryUpdateParameters') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ConnectedRegistry', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('ConnectedRegistry', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/connectedRegistries/{connectedRegistryName}'} # type: ignore + + async def begin_update( + self, + resource_group_name: str, + registry_name: str, + connected_registry_name: str, + connected_registry_update_parameters: "_models.ConnectedRegistryUpdateParameters", + **kwargs: Any + ) -> AsyncLROPoller["_models.ConnectedRegistry"]: + """Updates a connected registry with the specified parameters. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param connected_registry_name: The name of the connected registry. + :type connected_registry_name: str + :param connected_registry_update_parameters: The parameters for updating a connectedRegistry. + :type connected_registry_update_parameters: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ConnectedRegistryUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ConnectedRegistry or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2021_06_01_preview.models.ConnectedRegistry] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConnectedRegistry"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + connected_registry_name=connected_registry_name, + connected_registry_update_parameters=connected_registry_update_parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('ConnectedRegistry', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'connectedRegistryName': self._serialize.url("connected_registry_name", connected_registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/connectedRegistries/{connectedRegistryName}'} # type: ignore + + def list( + self, + resource_group_name: str, + registry_name: str, + filter: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable["_models.ConnectedRegistryListResult"]: + """Lists all connected registries for the specified container registry. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param filter: An OData filter expression that describes a subset of connectedRegistries to + return. The parameters that can be filtered are parent.id (the resource id of the + connectedRegistry parent), mode, and connectionState. The supported operator is eq. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ConnectedRegistryListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2021_06_01_preview.models.ConnectedRegistryListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConnectedRegistryListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ConnectedRegistryListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/connectedRegistries'} # type: ignore + + async def _deactivate_initial( + self, + resource_group_name: str, + registry_name: str, + connected_registry_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self._deactivate_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'connectedRegistryName': self._serialize.url("connected_registry_name", connected_registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _deactivate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/connectedRegistries/{connectedRegistryName}/deactivate'} # type: ignore + + async def begin_deactivate( + self, + resource_group_name: str, + registry_name: str, + connected_registry_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deactivates the connected registry instance. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param connected_registry_name: The name of the connected registry. + :type connected_registry_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._deactivate_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + connected_registry_name=connected_registry_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'connectedRegistryName': self._serialize.url("connected_registry_name", connected_registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_deactivate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/connectedRegistries/{connectedRegistryName}/deactivate'} # type: ignore diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/operations/_export_pipelines_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/operations/_export_pipelines_operations.py new file mode 100644 index 000000000000..52d0b94e30fb --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/operations/_export_pipelines_operations.py @@ -0,0 +1,432 @@ +# 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 typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ExportPipelinesOperations: + """ExportPipelinesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.containerregistry.v2021_06_01_preview.models + :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) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + resource_group_name: str, + registry_name: str, + export_pipeline_name: str, + **kwargs: Any + ) -> "_models.ExportPipeline": + """Gets the properties of the export pipeline. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param export_pipeline_name: The name of the export pipeline. + :type export_pipeline_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ExportPipeline, or the result of cls(response) + :rtype: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ExportPipeline + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ExportPipeline"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'exportPipelineName': self._serialize.url("export_pipeline_name", export_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ExportPipeline', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/exportPipelines/{exportPipelineName}'} # type: ignore + + async def _create_initial( + self, + resource_group_name: str, + registry_name: str, + export_pipeline_name: str, + export_pipeline_create_parameters: "_models.ExportPipeline", + **kwargs: Any + ) -> "_models.ExportPipeline": + cls = kwargs.pop('cls', None) # type: ClsType["_models.ExportPipeline"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'exportPipelineName': self._serialize.url("export_pipeline_name", export_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(export_pipeline_create_parameters, 'ExportPipeline') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ExportPipeline', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('ExportPipeline', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/exportPipelines/{exportPipelineName}'} # type: ignore + + async def begin_create( + self, + resource_group_name: str, + registry_name: str, + export_pipeline_name: str, + export_pipeline_create_parameters: "_models.ExportPipeline", + **kwargs: Any + ) -> AsyncLROPoller["_models.ExportPipeline"]: + """Creates an export pipeline for a container registry with the specified parameters. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param export_pipeline_name: The name of the export pipeline. + :type export_pipeline_name: str + :param export_pipeline_create_parameters: The parameters for creating an export pipeline. + :type export_pipeline_create_parameters: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ExportPipeline + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ExportPipeline or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2021_06_01_preview.models.ExportPipeline] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ExportPipeline"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + export_pipeline_name=export_pipeline_name, + export_pipeline_create_parameters=export_pipeline_create_parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('ExportPipeline', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'exportPipelineName': self._serialize.url("export_pipeline_name", export_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/exportPipelines/{exportPipelineName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + registry_name: str, + export_pipeline_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'exportPipelineName': self._serialize.url("export_pipeline_name", export_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/exportPipelines/{exportPipelineName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + registry_name: str, + export_pipeline_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes an export pipeline from a container registry. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param export_pipeline_name: The name of the export pipeline. + :type export_pipeline_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + export_pipeline_name=export_pipeline_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'exportPipelineName': self._serialize.url("export_pipeline_name", export_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/exportPipelines/{exportPipelineName}'} # type: ignore + + def list( + self, + resource_group_name: str, + registry_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.ExportPipelineListResult"]: + """Lists all export pipelines for the specified container registry. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ExportPipelineListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2021_06_01_preview.models.ExportPipelineListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ExportPipelineListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ExportPipelineListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/exportPipelines'} # type: ignore diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/operations/_import_pipelines_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/operations/_import_pipelines_operations.py new file mode 100644 index 000000000000..140018bb95fc --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/operations/_import_pipelines_operations.py @@ -0,0 +1,432 @@ +# 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 typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ImportPipelinesOperations: + """ImportPipelinesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.containerregistry.v2021_06_01_preview.models + :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) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + resource_group_name: str, + registry_name: str, + import_pipeline_name: str, + **kwargs: Any + ) -> "_models.ImportPipeline": + """Gets the properties of the import pipeline. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param import_pipeline_name: The name of the import pipeline. + :type import_pipeline_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ImportPipeline, or the result of cls(response) + :rtype: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ImportPipeline + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ImportPipeline"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'importPipelineName': self._serialize.url("import_pipeline_name", import_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ImportPipeline', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importPipelines/{importPipelineName}'} # type: ignore + + async def _create_initial( + self, + resource_group_name: str, + registry_name: str, + import_pipeline_name: str, + import_pipeline_create_parameters: "_models.ImportPipeline", + **kwargs: Any + ) -> "_models.ImportPipeline": + cls = kwargs.pop('cls', None) # type: ClsType["_models.ImportPipeline"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'importPipelineName': self._serialize.url("import_pipeline_name", import_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(import_pipeline_create_parameters, 'ImportPipeline') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ImportPipeline', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('ImportPipeline', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importPipelines/{importPipelineName}'} # type: ignore + + async def begin_create( + self, + resource_group_name: str, + registry_name: str, + import_pipeline_name: str, + import_pipeline_create_parameters: "_models.ImportPipeline", + **kwargs: Any + ) -> AsyncLROPoller["_models.ImportPipeline"]: + """Creates an import pipeline for a container registry with the specified parameters. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param import_pipeline_name: The name of the import pipeline. + :type import_pipeline_name: str + :param import_pipeline_create_parameters: The parameters for creating an import pipeline. + :type import_pipeline_create_parameters: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ImportPipeline + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ImportPipeline or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2021_06_01_preview.models.ImportPipeline] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ImportPipeline"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + import_pipeline_name=import_pipeline_name, + import_pipeline_create_parameters=import_pipeline_create_parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('ImportPipeline', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'importPipelineName': self._serialize.url("import_pipeline_name", import_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importPipelines/{importPipelineName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + registry_name: str, + import_pipeline_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'importPipelineName': self._serialize.url("import_pipeline_name", import_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importPipelines/{importPipelineName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + registry_name: str, + import_pipeline_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes an import pipeline from a container registry. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param import_pipeline_name: The name of the import pipeline. + :type import_pipeline_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + import_pipeline_name=import_pipeline_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'importPipelineName': self._serialize.url("import_pipeline_name", import_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importPipelines/{importPipelineName}'} # type: ignore + + def list( + self, + resource_group_name: str, + registry_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.ImportPipelineListResult"]: + """Lists all import pipelines for the specified container registry. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ImportPipelineListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2021_06_01_preview.models.ImportPipelineListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ImportPipelineListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ImportPipelineListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importPipelines'} # type: ignore diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/operations/_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/operations/_operations.py new file mode 100644 index 000000000000..e413be47e4db --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/operations/_operations.py @@ -0,0 +1,104 @@ +# 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 typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class Operations: + """Operations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.containerregistry.v2021_06_01_preview.models + :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) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + **kwargs: Any + ) -> AsyncIterable["_models.OperationListResult"]: + """Lists all of the available Azure Container Registry REST API operations. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OperationListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2021_06_01_preview.models.OperationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('OperationListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.ContainerRegistry/operations'} # type: ignore diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/operations/_pipeline_runs_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/operations/_pipeline_runs_operations.py new file mode 100644 index 000000000000..5338e562b9a8 --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/operations/_pipeline_runs_operations.py @@ -0,0 +1,432 @@ +# 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 typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class PipelineRunsOperations: + """PipelineRunsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.containerregistry.v2021_06_01_preview.models + :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) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + resource_group_name: str, + registry_name: str, + pipeline_run_name: str, + **kwargs: Any + ) -> "_models.PipelineRun": + """Gets the detailed information for a given pipeline run. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param pipeline_run_name: The name of the pipeline run. + :type pipeline_run_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PipelineRun, or the result of cls(response) + :rtype: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PipelineRun + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PipelineRun"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'pipelineRunName': self._serialize.url("pipeline_run_name", pipeline_run_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PipelineRun', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/pipelineRuns/{pipelineRunName}'} # type: ignore + + async def _create_initial( + self, + resource_group_name: str, + registry_name: str, + pipeline_run_name: str, + pipeline_run_create_parameters: "_models.PipelineRun", + **kwargs: Any + ) -> "_models.PipelineRun": + cls = kwargs.pop('cls', None) # type: ClsType["_models.PipelineRun"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'pipelineRunName': self._serialize.url("pipeline_run_name", pipeline_run_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(pipeline_run_create_parameters, 'PipelineRun') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('PipelineRun', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('PipelineRun', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/pipelineRuns/{pipelineRunName}'} # type: ignore + + async def begin_create( + self, + resource_group_name: str, + registry_name: str, + pipeline_run_name: str, + pipeline_run_create_parameters: "_models.PipelineRun", + **kwargs: Any + ) -> AsyncLROPoller["_models.PipelineRun"]: + """Creates a pipeline run for a container registry with the specified parameters. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param pipeline_run_name: The name of the pipeline run. + :type pipeline_run_name: str + :param pipeline_run_create_parameters: The parameters for creating a pipeline run. + :type pipeline_run_create_parameters: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PipelineRun + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either PipelineRun or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2021_06_01_preview.models.PipelineRun] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PipelineRun"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + pipeline_run_name=pipeline_run_name, + pipeline_run_create_parameters=pipeline_run_create_parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('PipelineRun', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'pipelineRunName': self._serialize.url("pipeline_run_name", pipeline_run_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/pipelineRuns/{pipelineRunName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + registry_name: str, + pipeline_run_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'pipelineRunName': self._serialize.url("pipeline_run_name", pipeline_run_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/pipelineRuns/{pipelineRunName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + registry_name: str, + pipeline_run_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes a pipeline run from a container registry. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param pipeline_run_name: The name of the pipeline run. + :type pipeline_run_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + pipeline_run_name=pipeline_run_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'pipelineRunName': self._serialize.url("pipeline_run_name", pipeline_run_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/pipelineRuns/{pipelineRunName}'} # type: ignore + + def list( + self, + resource_group_name: str, + registry_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.PipelineRunListResult"]: + """Lists all the pipeline runs for the specified container registry. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PipelineRunListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2021_06_01_preview.models.PipelineRunListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PipelineRunListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('PipelineRunListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/pipelineRuns'} # type: ignore diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/operations/_private_endpoint_connections_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/operations/_private_endpoint_connections_operations.py new file mode 100644 index 000000000000..0d70575ec9bc --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/operations/_private_endpoint_connections_operations.py @@ -0,0 +1,433 @@ +# 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 typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class PrivateEndpointConnectionsOperations: + """PrivateEndpointConnectionsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.containerregistry.v2021_06_01_preview.models + :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) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + resource_group_name: str, + registry_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> "_models.PrivateEndpointConnection": + """Get the specified private endpoint connection associated with the container registry. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. + :type private_endpoint_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection, or the result of cls(response) + :rtype: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PrivateEndpointConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + registry_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection: "_models.PrivateEndpointConnection", + **kwargs: Any + ) -> "_models.PrivateEndpointConnection": + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(private_endpoint_connection, 'PrivateEndpointConnection') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + async def begin_create_or_update( + self, + resource_group_name: str, + registry_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection: "_models.PrivateEndpointConnection", + **kwargs: Any + ) -> AsyncLROPoller["_models.PrivateEndpointConnection"]: + """Update the state of specified private endpoint connection associated with the container + registry. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. + :type private_endpoint_connection_name: str + :param private_endpoint_connection: The parameters for creating a private endpoint connection. + :type private_endpoint_connection: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PrivateEndpointConnection + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2021_06_01_preview.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + private_endpoint_connection_name=private_endpoint_connection_name, + private_endpoint_connection=private_endpoint_connection, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + registry_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + registry_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the specified private endpoint connection associated with the container registry. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. + :type private_endpoint_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + private_endpoint_connection_name=private_endpoint_connection_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + def list( + self, + resource_group_name: str, + registry_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.PrivateEndpointConnectionListResult"]: + """List all private endpoint connections in a container registry. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2021_06_01_preview.models.PrivateEndpointConnectionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('PrivateEndpointConnectionListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/privateEndpointConnections'} # type: ignore diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/operations/_registries_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/operations/_registries_operations.py new file mode 100644 index 000000000000..8f3f9a3ba7f5 --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/operations/_registries_operations.py @@ -0,0 +1,1171 @@ +# 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 typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class RegistriesOperations: + """RegistriesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.containerregistry.v2021_06_01_preview.models + :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) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def _import_image_initial( + self, + resource_group_name: str, + registry_name: str, + parameters: "_models.ImportImageParameters", + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._import_image_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'ImportImageParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _import_image_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importImage'} # type: ignore + + async def begin_import_image( + self, + resource_group_name: str, + registry_name: str, + parameters: "_models.ImportImageParameters", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Copies an image to this container registry from the specified container registry. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param parameters: The parameters specifying the image to copy and the source container + registry. + :type parameters: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ImportImageParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._import_image_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_import_image.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importImage'} # type: ignore + + async def check_name_availability( + self, + registry_name_check_request: "_models.RegistryNameCheckRequest", + **kwargs: Any + ) -> "_models.RegistryNameStatus": + """Checks whether the container registry name is available for use. The name must contain only + alphanumeric characters, be globally unique, and between 5 and 50 characters in length. + + :param registry_name_check_request: The object containing information for the availability + request. + :type registry_name_check_request: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.RegistryNameCheckRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RegistryNameStatus, or the result of cls(response) + :rtype: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.RegistryNameStatus + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RegistryNameStatus"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.check_name_availability.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(registry_name_check_request, 'RegistryNameCheckRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RegistryNameStatus', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ContainerRegistry/checkNameAvailability'} # type: ignore + + async def get( + self, + resource_group_name: str, + registry_name: str, + **kwargs: Any + ) -> "_models.Registry": + """Gets the properties of the specified container registry. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Registry, or the result of cls(response) + :rtype: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.Registry + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Registry"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Registry', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore + + async def _create_initial( + self, + resource_group_name: str, + registry_name: str, + registry: "_models.Registry", + **kwargs: Any + ) -> "_models.Registry": + cls = kwargs.pop('cls', None) # type: ClsType["_models.Registry"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(registry, 'Registry') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Registry', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Registry', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore + + async def begin_create( + self, + resource_group_name: str, + registry_name: str, + registry: "_models.Registry", + **kwargs: Any + ) -> AsyncLROPoller["_models.Registry"]: + """Creates a container registry with the specified parameters. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param registry: The parameters for creating a container registry. + :type registry: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.Registry + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Registry or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2021_06_01_preview.models.Registry] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Registry"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + registry=registry, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('Registry', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + registry_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + registry_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes a container registry. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + registry_name: str, + registry_update_parameters: "_models.RegistryUpdateParameters", + **kwargs: Any + ) -> "_models.Registry": + cls = kwargs.pop('cls', None) # type: ClsType["_models.Registry"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(registry_update_parameters, 'RegistryUpdateParameters') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Registry', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Registry', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore + + async def begin_update( + self, + resource_group_name: str, + registry_name: str, + registry_update_parameters: "_models.RegistryUpdateParameters", + **kwargs: Any + ) -> AsyncLROPoller["_models.Registry"]: + """Updates a container registry with the specified parameters. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param registry_update_parameters: The parameters for updating a container registry. + :type registry_update_parameters: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.RegistryUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Registry or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2021_06_01_preview.models.Registry] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Registry"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + registry_update_parameters=registry_update_parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('Registry', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.RegistryListResult"]: + """Lists all the container registries under the specified resource group. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either RegistryListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2021_06_01_preview.models.RegistryListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RegistryListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('RegistryListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries'} # type: ignore + + def list( + self, + **kwargs: Any + ) -> AsyncIterable["_models.RegistryListResult"]: + """Lists all the container registries under the specified subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either RegistryListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2021_06_01_preview.models.RegistryListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RegistryListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('RegistryListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ContainerRegistry/registries'} # type: ignore + + async def list_credentials( + self, + resource_group_name: str, + registry_name: str, + **kwargs: Any + ) -> "_models.RegistryListCredentialsResult": + """Lists the login credentials for the specified container registry. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RegistryListCredentialsResult, or the result of cls(response) + :rtype: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.RegistryListCredentialsResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RegistryListCredentialsResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self.list_credentials.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RegistryListCredentialsResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_credentials.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/listCredentials'} # type: ignore + + async def regenerate_credential( + self, + resource_group_name: str, + registry_name: str, + regenerate_credential_parameters: "_models.RegenerateCredentialParameters", + **kwargs: Any + ) -> "_models.RegistryListCredentialsResult": + """Regenerates one of the login credentials for the specified container registry. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param regenerate_credential_parameters: Specifies name of the password which should be + regenerated -- password or password2. + :type regenerate_credential_parameters: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.RegenerateCredentialParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RegistryListCredentialsResult, or the result of cls(response) + :rtype: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.RegistryListCredentialsResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RegistryListCredentialsResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.regenerate_credential.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(regenerate_credential_parameters, 'RegenerateCredentialParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RegistryListCredentialsResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + regenerate_credential.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/regenerateCredential'} # type: ignore + + async def list_usages( + self, + resource_group_name: str, + registry_name: str, + **kwargs: Any + ) -> "_models.RegistryUsageListResult": + """Gets the quota usages for the specified container registry. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RegistryUsageListResult, or the result of cls(response) + :rtype: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.RegistryUsageListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RegistryUsageListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self.list_usages.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RegistryUsageListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_usages.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/listUsages'} # type: ignore + + def list_private_link_resources( + self, + resource_group_name: str, + registry_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.PrivateLinkResourceListResult"]: + """Lists the private link resources for a container registry. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PrivateLinkResourceListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2021_06_01_preview.models.PrivateLinkResourceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_private_link_resources.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('PrivateLinkResourceListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_private_link_resources.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/privateLinkResources'} # type: ignore + + async def _generate_credentials_initial( + self, + resource_group_name: str, + registry_name: str, + generate_credentials_parameters: "_models.GenerateCredentialsParameters", + **kwargs: Any + ) -> Optional["_models.GenerateCredentialsResult"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GenerateCredentialsResult"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._generate_credentials_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(generate_credentials_parameters, 'GenerateCredentialsParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('GenerateCredentialsResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _generate_credentials_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/generateCredentials'} # type: ignore + + async def begin_generate_credentials( + self, + resource_group_name: str, + registry_name: str, + generate_credentials_parameters: "_models.GenerateCredentialsParameters", + **kwargs: Any + ) -> AsyncLROPoller["_models.GenerateCredentialsResult"]: + """Generate keys for a token of a specified container registry. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param generate_credentials_parameters: The parameters for generating credentials. + :type generate_credentials_parameters: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.GenerateCredentialsParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either GenerateCredentialsResult or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2021_06_01_preview.models.GenerateCredentialsResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenerateCredentialsResult"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._generate_credentials_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + generate_credentials_parameters=generate_credentials_parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('GenerateCredentialsResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_generate_credentials.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/generateCredentials'} # type: ignore diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/operations/_replications_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/operations/_replications_operations.py new file mode 100644 index 000000000000..c0b22cc762d2 --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/operations/_replications_operations.py @@ -0,0 +1,568 @@ +# 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 typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ReplicationsOperations: + """ReplicationsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.containerregistry.v2021_06_01_preview.models + :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) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + resource_group_name: str, + registry_name: str, + replication_name: str, + **kwargs: Any + ) -> "_models.Replication": + """Gets the properties of the specified replication. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param replication_name: The name of the replication. + :type replication_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Replication, or the result of cls(response) + :rtype: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.Replication + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Replication"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'replicationName': self._serialize.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Replication', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'} # type: ignore + + async def _create_initial( + self, + resource_group_name: str, + registry_name: str, + replication_name: str, + replication: "_models.Replication", + **kwargs: Any + ) -> "_models.Replication": + cls = kwargs.pop('cls', None) # type: ClsType["_models.Replication"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'replicationName': self._serialize.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(replication, 'Replication') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Replication', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Replication', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'} # type: ignore + + async def begin_create( + self, + resource_group_name: str, + registry_name: str, + replication_name: str, + replication: "_models.Replication", + **kwargs: Any + ) -> AsyncLROPoller["_models.Replication"]: + """Creates a replication for a container registry with the specified parameters. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param replication_name: The name of the replication. + :type replication_name: str + :param replication: The parameters for creating a replication. + :type replication: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.Replication + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Replication or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2021_06_01_preview.models.Replication] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Replication"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + replication_name=replication_name, + replication=replication, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('Replication', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'replicationName': self._serialize.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + registry_name: str, + replication_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'replicationName': self._serialize.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + registry_name: str, + replication_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes a replication from a container registry. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param replication_name: The name of the replication. + :type replication_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + replication_name=replication_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'replicationName': self._serialize.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + registry_name: str, + replication_name: str, + replication_update_parameters: "_models.ReplicationUpdateParameters", + **kwargs: Any + ) -> "_models.Replication": + cls = kwargs.pop('cls', None) # type: ClsType["_models.Replication"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'replicationName': self._serialize.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(replication_update_parameters, 'ReplicationUpdateParameters') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Replication', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Replication', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'} # type: ignore + + async def begin_update( + self, + resource_group_name: str, + registry_name: str, + replication_name: str, + replication_update_parameters: "_models.ReplicationUpdateParameters", + **kwargs: Any + ) -> AsyncLROPoller["_models.Replication"]: + """Updates a replication for a container registry with the specified parameters. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param replication_name: The name of the replication. + :type replication_name: str + :param replication_update_parameters: The parameters for updating a replication. + :type replication_update_parameters: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ReplicationUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Replication or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2021_06_01_preview.models.Replication] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Replication"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + replication_name=replication_name, + replication_update_parameters=replication_update_parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('Replication', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'replicationName': self._serialize.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'} # type: ignore + + def list( + self, + resource_group_name: str, + registry_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.ReplicationListResult"]: + """Lists all the replications for the specified container registry. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ReplicationListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2021_06_01_preview.models.ReplicationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ReplicationListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ReplicationListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications'} # type: ignore diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/operations/_scope_maps_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/operations/_scope_maps_operations.py new file mode 100644 index 000000000000..7930e49900ab --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/operations/_scope_maps_operations.py @@ -0,0 +1,568 @@ +# 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 typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ScopeMapsOperations: + """ScopeMapsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.containerregistry.v2021_06_01_preview.models + :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) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + resource_group_name: str, + registry_name: str, + scope_map_name: str, + **kwargs: Any + ) -> "_models.ScopeMap": + """Gets the properties of the specified scope map. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param scope_map_name: The name of the scope map. + :type scope_map_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ScopeMap, or the result of cls(response) + :rtype: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ScopeMap + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ScopeMap"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'scopeMapName': self._serialize.url("scope_map_name", scope_map_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ScopeMap', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scopeMaps/{scopeMapName}'} # type: ignore + + async def _create_initial( + self, + resource_group_name: str, + registry_name: str, + scope_map_name: str, + scope_map_create_parameters: "_models.ScopeMap", + **kwargs: Any + ) -> "_models.ScopeMap": + cls = kwargs.pop('cls', None) # type: ClsType["_models.ScopeMap"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'scopeMapName': self._serialize.url("scope_map_name", scope_map_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(scope_map_create_parameters, 'ScopeMap') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ScopeMap', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('ScopeMap', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scopeMaps/{scopeMapName}'} # type: ignore + + async def begin_create( + self, + resource_group_name: str, + registry_name: str, + scope_map_name: str, + scope_map_create_parameters: "_models.ScopeMap", + **kwargs: Any + ) -> AsyncLROPoller["_models.ScopeMap"]: + """Creates a scope map for a container registry with the specified parameters. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param scope_map_name: The name of the scope map. + :type scope_map_name: str + :param scope_map_create_parameters: The parameters for creating a scope map. + :type scope_map_create_parameters: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ScopeMap + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ScopeMap or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2021_06_01_preview.models.ScopeMap] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ScopeMap"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + scope_map_name=scope_map_name, + scope_map_create_parameters=scope_map_create_parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('ScopeMap', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'scopeMapName': self._serialize.url("scope_map_name", scope_map_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scopeMaps/{scopeMapName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + registry_name: str, + scope_map_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'scopeMapName': self._serialize.url("scope_map_name", scope_map_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scopeMaps/{scopeMapName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + registry_name: str, + scope_map_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes a scope map from a container registry. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param scope_map_name: The name of the scope map. + :type scope_map_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + scope_map_name=scope_map_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'scopeMapName': self._serialize.url("scope_map_name", scope_map_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scopeMaps/{scopeMapName}'} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + registry_name: str, + scope_map_name: str, + scope_map_update_parameters: "_models.ScopeMapUpdateParameters", + **kwargs: Any + ) -> "_models.ScopeMap": + cls = kwargs.pop('cls', None) # type: ClsType["_models.ScopeMap"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'scopeMapName': self._serialize.url("scope_map_name", scope_map_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(scope_map_update_parameters, 'ScopeMapUpdateParameters') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ScopeMap', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('ScopeMap', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scopeMaps/{scopeMapName}'} # type: ignore + + async def begin_update( + self, + resource_group_name: str, + registry_name: str, + scope_map_name: str, + scope_map_update_parameters: "_models.ScopeMapUpdateParameters", + **kwargs: Any + ) -> AsyncLROPoller["_models.ScopeMap"]: + """Updates a scope map with the specified parameters. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param scope_map_name: The name of the scope map. + :type scope_map_name: str + :param scope_map_update_parameters: The parameters for updating a scope map. + :type scope_map_update_parameters: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ScopeMapUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ScopeMap or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2021_06_01_preview.models.ScopeMap] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ScopeMap"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + scope_map_name=scope_map_name, + scope_map_update_parameters=scope_map_update_parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('ScopeMap', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'scopeMapName': self._serialize.url("scope_map_name", scope_map_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scopeMaps/{scopeMapName}'} # type: ignore + + def list( + self, + resource_group_name: str, + registry_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.ScopeMapListResult"]: + """Lists all the scope maps for the specified container registry. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ScopeMapListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2021_06_01_preview.models.ScopeMapListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ScopeMapListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ScopeMapListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scopeMaps'} # type: ignore diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/operations/_tokens_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/operations/_tokens_operations.py new file mode 100644 index 000000000000..93ed4121fab6 --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/operations/_tokens_operations.py @@ -0,0 +1,568 @@ +# 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 typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class TokensOperations: + """TokensOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.containerregistry.v2021_06_01_preview.models + :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) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + resource_group_name: str, + registry_name: str, + token_name: str, + **kwargs: Any + ) -> "_models.Token": + """Gets the properties of the specified token. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param token_name: The name of the token. + :type token_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Token, or the result of cls(response) + :rtype: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.Token + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Token"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'tokenName': self._serialize.url("token_name", token_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-]*$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Token', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tokens/{tokenName}'} # type: ignore + + async def _create_initial( + self, + resource_group_name: str, + registry_name: str, + token_name: str, + token_create_parameters: "_models.Token", + **kwargs: Any + ) -> "_models.Token": + cls = kwargs.pop('cls', None) # type: ClsType["_models.Token"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'tokenName': self._serialize.url("token_name", token_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-]*$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(token_create_parameters, 'Token') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Token', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Token', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tokens/{tokenName}'} # type: ignore + + async def begin_create( + self, + resource_group_name: str, + registry_name: str, + token_name: str, + token_create_parameters: "_models.Token", + **kwargs: Any + ) -> AsyncLROPoller["_models.Token"]: + """Creates a token for a container registry with the specified parameters. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param token_name: The name of the token. + :type token_name: str + :param token_create_parameters: The parameters for creating a token. + :type token_create_parameters: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.Token + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Token or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2021_06_01_preview.models.Token] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Token"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + token_name=token_name, + token_create_parameters=token_create_parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('Token', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'tokenName': self._serialize.url("token_name", token_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-]*$'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tokens/{tokenName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + registry_name: str, + token_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'tokenName': self._serialize.url("token_name", token_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-]*$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tokens/{tokenName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + registry_name: str, + token_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes a token from a container registry. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param token_name: The name of the token. + :type token_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + token_name=token_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'tokenName': self._serialize.url("token_name", token_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-]*$'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tokens/{tokenName}'} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + registry_name: str, + token_name: str, + token_update_parameters: "_models.TokenUpdateParameters", + **kwargs: Any + ) -> "_models.Token": + cls = kwargs.pop('cls', None) # type: ClsType["_models.Token"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'tokenName': self._serialize.url("token_name", token_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-]*$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(token_update_parameters, 'TokenUpdateParameters') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Token', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Token', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tokens/{tokenName}'} # type: ignore + + async def begin_update( + self, + resource_group_name: str, + registry_name: str, + token_name: str, + token_update_parameters: "_models.TokenUpdateParameters", + **kwargs: Any + ) -> AsyncLROPoller["_models.Token"]: + """Updates a token with the specified parameters. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param token_name: The name of the token. + :type token_name: str + :param token_update_parameters: The parameters for updating a token. + :type token_update_parameters: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.TokenUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Token or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2021_06_01_preview.models.Token] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Token"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + token_name=token_name, + token_update_parameters=token_update_parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('Token', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'tokenName': self._serialize.url("token_name", token_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-]*$'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tokens/{tokenName}'} # type: ignore + + def list( + self, + resource_group_name: str, + registry_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.TokenListResult"]: + """Lists all the tokens for the specified container registry. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either TokenListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2021_06_01_preview.models.TokenListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TokenListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('TokenListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tokens'} # type: ignore diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/operations/_webhooks_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/operations/_webhooks_operations.py new file mode 100644 index 000000000000..15b231f7705e --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/operations/_webhooks_operations.py @@ -0,0 +1,773 @@ +# 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 typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class WebhooksOperations: + """WebhooksOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.containerregistry.v2021_06_01_preview.models + :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) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + resource_group_name: str, + registry_name: str, + webhook_name: str, + **kwargs: Any + ) -> "_models.Webhook": + """Gets the properties of the specified webhook. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param webhook_name: The name of the webhook. + :type webhook_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Webhook, or the result of cls(response) + :rtype: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.Webhook + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Webhook"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Webhook', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'} # type: ignore + + async def _create_initial( + self, + resource_group_name: str, + registry_name: str, + webhook_name: str, + webhook_create_parameters: "_models.WebhookCreateParameters", + **kwargs: Any + ) -> "_models.Webhook": + cls = kwargs.pop('cls', None) # type: ClsType["_models.Webhook"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(webhook_create_parameters, 'WebhookCreateParameters') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Webhook', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Webhook', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'} # type: ignore + + async def begin_create( + self, + resource_group_name: str, + registry_name: str, + webhook_name: str, + webhook_create_parameters: "_models.WebhookCreateParameters", + **kwargs: Any + ) -> AsyncLROPoller["_models.Webhook"]: + """Creates a webhook for a container registry with the specified parameters. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param webhook_name: The name of the webhook. + :type webhook_name: str + :param webhook_create_parameters: The parameters for creating a webhook. + :type webhook_create_parameters: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.WebhookCreateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Webhook or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2021_06_01_preview.models.Webhook] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Webhook"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + webhook_create_parameters=webhook_create_parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('Webhook', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + registry_name: str, + webhook_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + registry_name: str, + webhook_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes a webhook from a container registry. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param webhook_name: The name of the webhook. + :type webhook_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + registry_name: str, + webhook_name: str, + webhook_update_parameters: "_models.WebhookUpdateParameters", + **kwargs: Any + ) -> "_models.Webhook": + cls = kwargs.pop('cls', None) # type: ClsType["_models.Webhook"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(webhook_update_parameters, 'WebhookUpdateParameters') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Webhook', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Webhook', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'} # type: ignore + + async def begin_update( + self, + resource_group_name: str, + registry_name: str, + webhook_name: str, + webhook_update_parameters: "_models.WebhookUpdateParameters", + **kwargs: Any + ) -> AsyncLROPoller["_models.Webhook"]: + """Updates a webhook with the specified parameters. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param webhook_name: The name of the webhook. + :type webhook_name: str + :param webhook_update_parameters: The parameters for updating a webhook. + :type webhook_update_parameters: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.WebhookUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Webhook or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2021_06_01_preview.models.Webhook] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Webhook"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + webhook_update_parameters=webhook_update_parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('Webhook', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'} # type: ignore + + def list( + self, + resource_group_name: str, + registry_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.WebhookListResult"]: + """Lists all the webhooks for the specified container registry. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either WebhookListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2021_06_01_preview.models.WebhookListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.WebhookListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('WebhookListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks'} # type: ignore + + async def ping( + self, + resource_group_name: str, + registry_name: str, + webhook_name: str, + **kwargs: Any + ) -> "_models.EventInfo": + """Triggers a ping event to be sent to the webhook. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param webhook_name: The name of the webhook. + :type webhook_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: EventInfo, or the result of cls(response) + :rtype: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.EventInfo + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.EventInfo"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self.ping.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('EventInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + ping.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}/ping'} # type: ignore + + async def get_callback_config( + self, + resource_group_name: str, + registry_name: str, + webhook_name: str, + **kwargs: Any + ) -> "_models.CallbackConfig": + """Gets the configuration of service URI and custom headers for the webhook. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param webhook_name: The name of the webhook. + :type webhook_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CallbackConfig, or the result of cls(response) + :rtype: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.CallbackConfig + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CallbackConfig"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self.get_callback_config.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CallbackConfig', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_callback_config.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}/getCallbackConfig'} # type: ignore + + def list_events( + self, + resource_group_name: str, + registry_name: str, + webhook_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.EventListResult"]: + """Lists recent events for the specified webhook. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param webhook_name: The name of the webhook. + :type webhook_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either EventListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2021_06_01_preview.models.EventListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.EventListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_events.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('EventListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_events.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}/listEvents'} # type: ignore diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/models/__init__.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/models/__init__.py new file mode 100644 index 000000000000..1a70164b9beb --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/models/__init__.py @@ -0,0 +1,402 @@ +# 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 ActivationProperties + from ._models_py3 import ActiveDirectoryObject + from ._models_py3 import Actor + from ._models_py3 import CallbackConfig + from ._models_py3 import ConnectedRegistry + from ._models_py3 import ConnectedRegistryListResult + from ._models_py3 import ConnectedRegistryUpdateParameters + from ._models_py3 import EncryptionProperty + from ._models_py3 import ErrorResponse + from ._models_py3 import ErrorResponseBody + from ._models_py3 import Event + from ._models_py3 import EventContent + from ._models_py3 import EventInfo + from ._models_py3 import EventListResult + from ._models_py3 import EventRequestMessage + from ._models_py3 import EventResponseMessage + from ._models_py3 import ExportPipeline + from ._models_py3 import ExportPipelineListResult + from ._models_py3 import ExportPipelineTargetProperties + from ._models_py3 import ExportPolicy + from ._models_py3 import GenerateCredentialsParameters + from ._models_py3 import GenerateCredentialsResult + from ._models_py3 import IPRule + from ._models_py3 import IdentityProperties + from ._models_py3 import ImportImageParameters + from ._models_py3 import ImportPipeline + from ._models_py3 import ImportPipelineListResult + from ._models_py3 import ImportPipelineSourceProperties + from ._models_py3 import ImportSource + from ._models_py3 import ImportSourceCredentials + from ._models_py3 import InnerErrorDescription + from ._models_py3 import KeyVaultProperties + from ._models_py3 import LoggingProperties + from ._models_py3 import LoginServerProperties + from ._models_py3 import NetworkRuleSet + from ._models_py3 import OperationDefinition + from ._models_py3 import OperationDisplayDefinition + from ._models_py3 import OperationListResult + from ._models_py3 import OperationLogSpecificationDefinition + from ._models_py3 import OperationMetricSpecificationDefinition + from ._models_py3 import OperationServiceSpecificationDefinition + from ._models_py3 import ParentProperties + from ._models_py3 import PipelineRun + from ._models_py3 import PipelineRunListResult + from ._models_py3 import PipelineRunRequest + from ._models_py3 import PipelineRunResponse + from ._models_py3 import PipelineRunSourceProperties + from ._models_py3 import PipelineRunTargetProperties + from ._models_py3 import PipelineSourceTriggerDescriptor + from ._models_py3 import PipelineSourceTriggerProperties + from ._models_py3 import PipelineTriggerDescriptor + from ._models_py3 import PipelineTriggerProperties + from ._models_py3 import Policies + from ._models_py3 import PrivateEndpoint + from ._models_py3 import PrivateEndpointConnection + from ._models_py3 import PrivateEndpointConnectionListResult + from ._models_py3 import PrivateLinkResource + from ._models_py3 import PrivateLinkResourceListResult + from ._models_py3 import PrivateLinkServiceConnectionState + from ._models_py3 import ProgressProperties + from ._models_py3 import ProxyResource + from ._models_py3 import QuarantinePolicy + from ._models_py3 import RegenerateCredentialParameters + from ._models_py3 import Registry + from ._models_py3 import RegistryListCredentialsResult + from ._models_py3 import RegistryListResult + from ._models_py3 import RegistryNameCheckRequest + from ._models_py3 import RegistryNameStatus + from ._models_py3 import RegistryPassword + from ._models_py3 import RegistryUpdateParameters + from ._models_py3 import RegistryUsage + from ._models_py3 import RegistryUsageListResult + from ._models_py3 import Replication + from ._models_py3 import ReplicationListResult + from ._models_py3 import ReplicationUpdateParameters + from ._models_py3 import Request + from ._models_py3 import Resource + from ._models_py3 import RetentionPolicy + from ._models_py3 import ScopeMap + from ._models_py3 import ScopeMapListResult + from ._models_py3 import ScopeMapUpdateParameters + from ._models_py3 import Sku + from ._models_py3 import Source + from ._models_py3 import Status + from ._models_py3 import StatusDetailProperties + from ._models_py3 import SyncProperties + from ._models_py3 import SyncUpdateProperties + from ._models_py3 import SystemData + from ._models_py3 import Target + from ._models_py3 import TlsCertificateProperties + from ._models_py3 import TlsProperties + from ._models_py3 import Token + from ._models_py3 import TokenCertificate + from ._models_py3 import TokenCredentialsProperties + from ._models_py3 import TokenListResult + from ._models_py3 import TokenPassword + from ._models_py3 import TokenUpdateParameters + from ._models_py3 import TrustPolicy + from ._models_py3 import UserIdentityProperties + from ._models_py3 import VirtualNetworkRule + from ._models_py3 import Webhook + from ._models_py3 import WebhookCreateParameters + from ._models_py3 import WebhookListResult + from ._models_py3 import WebhookUpdateParameters +except (SyntaxError, ImportError): + from ._models import ActivationProperties # type: ignore + from ._models import ActiveDirectoryObject # type: ignore + from ._models import Actor # type: ignore + from ._models import CallbackConfig # type: ignore + from ._models import ConnectedRegistry # type: ignore + from ._models import ConnectedRegistryListResult # type: ignore + from ._models import ConnectedRegistryUpdateParameters # type: ignore + from ._models import EncryptionProperty # type: ignore + from ._models import ErrorResponse # type: ignore + from ._models import ErrorResponseBody # type: ignore + from ._models import Event # type: ignore + from ._models import EventContent # type: ignore + from ._models import EventInfo # type: ignore + from ._models import EventListResult # type: ignore + from ._models import EventRequestMessage # type: ignore + from ._models import EventResponseMessage # type: ignore + from ._models import ExportPipeline # type: ignore + from ._models import ExportPipelineListResult # type: ignore + from ._models import ExportPipelineTargetProperties # type: ignore + from ._models import ExportPolicy # type: ignore + from ._models import GenerateCredentialsParameters # type: ignore + from ._models import GenerateCredentialsResult # type: ignore + from ._models import IPRule # type: ignore + from ._models import IdentityProperties # type: ignore + from ._models import ImportImageParameters # type: ignore + from ._models import ImportPipeline # type: ignore + from ._models import ImportPipelineListResult # type: ignore + from ._models import ImportPipelineSourceProperties # type: ignore + from ._models import ImportSource # type: ignore + from ._models import ImportSourceCredentials # type: ignore + from ._models import InnerErrorDescription # type: ignore + from ._models import KeyVaultProperties # type: ignore + from ._models import LoggingProperties # type: ignore + from ._models import LoginServerProperties # type: ignore + from ._models import NetworkRuleSet # type: ignore + from ._models import OperationDefinition # type: ignore + from ._models import OperationDisplayDefinition # type: ignore + from ._models import OperationListResult # type: ignore + from ._models import OperationLogSpecificationDefinition # type: ignore + from ._models import OperationMetricSpecificationDefinition # type: ignore + from ._models import OperationServiceSpecificationDefinition # type: ignore + from ._models import ParentProperties # type: ignore + from ._models import PipelineRun # type: ignore + from ._models import PipelineRunListResult # type: ignore + from ._models import PipelineRunRequest # type: ignore + from ._models import PipelineRunResponse # type: ignore + from ._models import PipelineRunSourceProperties # type: ignore + from ._models import PipelineRunTargetProperties # type: ignore + from ._models import PipelineSourceTriggerDescriptor # type: ignore + from ._models import PipelineSourceTriggerProperties # type: ignore + from ._models import PipelineTriggerDescriptor # type: ignore + from ._models import PipelineTriggerProperties # type: ignore + from ._models import Policies # type: ignore + from ._models import PrivateEndpoint # type: ignore + from ._models import PrivateEndpointConnection # type: ignore + from ._models import PrivateEndpointConnectionListResult # type: ignore + from ._models import PrivateLinkResource # type: ignore + from ._models import PrivateLinkResourceListResult # type: ignore + from ._models import PrivateLinkServiceConnectionState # type: ignore + from ._models import ProgressProperties # type: ignore + from ._models import ProxyResource # type: ignore + from ._models import QuarantinePolicy # type: ignore + from ._models import RegenerateCredentialParameters # type: ignore + from ._models import Registry # type: ignore + from ._models import RegistryListCredentialsResult # type: ignore + from ._models import RegistryListResult # type: ignore + from ._models import RegistryNameCheckRequest # type: ignore + from ._models import RegistryNameStatus # type: ignore + from ._models import RegistryPassword # type: ignore + from ._models import RegistryUpdateParameters # type: ignore + from ._models import RegistryUsage # type: ignore + from ._models import RegistryUsageListResult # type: ignore + from ._models import Replication # type: ignore + from ._models import ReplicationListResult # type: ignore + from ._models import ReplicationUpdateParameters # type: ignore + from ._models import Request # type: ignore + from ._models import Resource # type: ignore + from ._models import RetentionPolicy # type: ignore + from ._models import ScopeMap # type: ignore + from ._models import ScopeMapListResult # type: ignore + from ._models import ScopeMapUpdateParameters # type: ignore + from ._models import Sku # type: ignore + from ._models import Source # type: ignore + from ._models import Status # type: ignore + from ._models import StatusDetailProperties # type: ignore + from ._models import SyncProperties # type: ignore + from ._models import SyncUpdateProperties # type: ignore + from ._models import SystemData # type: ignore + from ._models import Target # type: ignore + from ._models import TlsCertificateProperties # type: ignore + from ._models import TlsProperties # type: ignore + from ._models import Token # type: ignore + from ._models import TokenCertificate # type: ignore + from ._models import TokenCredentialsProperties # type: ignore + from ._models import TokenListResult # type: ignore + from ._models import TokenPassword # type: ignore + from ._models import TokenUpdateParameters # type: ignore + from ._models import TrustPolicy # type: ignore + from ._models import UserIdentityProperties # type: ignore + from ._models import VirtualNetworkRule # type: ignore + from ._models import Webhook # type: ignore + from ._models import WebhookCreateParameters # type: ignore + from ._models import WebhookListResult # type: ignore + from ._models import WebhookUpdateParameters # type: ignore + +from ._container_registry_management_client_enums import ( + Action, + ActionsRequired, + ActivationStatus, + AuditLogStatus, + CertificateType, + ConnectedRegistryMode, + ConnectionState, + ConnectionStatus, + CreatedByType, + DefaultAction, + EncryptionStatus, + ExportPolicyStatus, + ImportMode, + LastModifiedByType, + LogLevel, + NetworkRuleBypassOptions, + PasswordName, + PipelineOptions, + PipelineRunSourceType, + PipelineRunTargetType, + PipelineSourceType, + PolicyStatus, + ProvisioningState, + PublicNetworkAccess, + RegistryUsageUnit, + ResourceIdentityType, + SkuName, + SkuTier, + TlsStatus, + TokenCertificateName, + TokenPasswordName, + TokenStatus, + TriggerStatus, + TrustPolicyType, + WebhookAction, + WebhookStatus, + ZoneRedundancy, +) + +__all__ = [ + 'ActivationProperties', + 'ActiveDirectoryObject', + 'Actor', + 'CallbackConfig', + 'ConnectedRegistry', + 'ConnectedRegistryListResult', + 'ConnectedRegistryUpdateParameters', + 'EncryptionProperty', + 'ErrorResponse', + 'ErrorResponseBody', + 'Event', + 'EventContent', + 'EventInfo', + 'EventListResult', + 'EventRequestMessage', + 'EventResponseMessage', + 'ExportPipeline', + 'ExportPipelineListResult', + 'ExportPipelineTargetProperties', + 'ExportPolicy', + 'GenerateCredentialsParameters', + 'GenerateCredentialsResult', + 'IPRule', + 'IdentityProperties', + 'ImportImageParameters', + 'ImportPipeline', + 'ImportPipelineListResult', + 'ImportPipelineSourceProperties', + 'ImportSource', + 'ImportSourceCredentials', + 'InnerErrorDescription', + 'KeyVaultProperties', + 'LoggingProperties', + 'LoginServerProperties', + 'NetworkRuleSet', + 'OperationDefinition', + 'OperationDisplayDefinition', + 'OperationListResult', + 'OperationLogSpecificationDefinition', + 'OperationMetricSpecificationDefinition', + 'OperationServiceSpecificationDefinition', + 'ParentProperties', + 'PipelineRun', + 'PipelineRunListResult', + 'PipelineRunRequest', + 'PipelineRunResponse', + 'PipelineRunSourceProperties', + 'PipelineRunTargetProperties', + 'PipelineSourceTriggerDescriptor', + 'PipelineSourceTriggerProperties', + 'PipelineTriggerDescriptor', + 'PipelineTriggerProperties', + 'Policies', + 'PrivateEndpoint', + 'PrivateEndpointConnection', + 'PrivateEndpointConnectionListResult', + 'PrivateLinkResource', + 'PrivateLinkResourceListResult', + 'PrivateLinkServiceConnectionState', + 'ProgressProperties', + 'ProxyResource', + 'QuarantinePolicy', + 'RegenerateCredentialParameters', + 'Registry', + 'RegistryListCredentialsResult', + 'RegistryListResult', + 'RegistryNameCheckRequest', + 'RegistryNameStatus', + 'RegistryPassword', + 'RegistryUpdateParameters', + 'RegistryUsage', + 'RegistryUsageListResult', + 'Replication', + 'ReplicationListResult', + 'ReplicationUpdateParameters', + 'Request', + 'Resource', + 'RetentionPolicy', + 'ScopeMap', + 'ScopeMapListResult', + 'ScopeMapUpdateParameters', + 'Sku', + 'Source', + 'Status', + 'StatusDetailProperties', + 'SyncProperties', + 'SyncUpdateProperties', + 'SystemData', + 'Target', + 'TlsCertificateProperties', + 'TlsProperties', + 'Token', + 'TokenCertificate', + 'TokenCredentialsProperties', + 'TokenListResult', + 'TokenPassword', + 'TokenUpdateParameters', + 'TrustPolicy', + 'UserIdentityProperties', + 'VirtualNetworkRule', + 'Webhook', + 'WebhookCreateParameters', + 'WebhookListResult', + 'WebhookUpdateParameters', + 'Action', + 'ActionsRequired', + 'ActivationStatus', + 'AuditLogStatus', + 'CertificateType', + 'ConnectedRegistryMode', + 'ConnectionState', + 'ConnectionStatus', + 'CreatedByType', + 'DefaultAction', + 'EncryptionStatus', + 'ExportPolicyStatus', + 'ImportMode', + 'LastModifiedByType', + 'LogLevel', + 'NetworkRuleBypassOptions', + 'PasswordName', + 'PipelineOptions', + 'PipelineRunSourceType', + 'PipelineRunTargetType', + 'PipelineSourceType', + 'PolicyStatus', + 'ProvisioningState', + 'PublicNetworkAccess', + 'RegistryUsageUnit', + 'ResourceIdentityType', + 'SkuName', + 'SkuTier', + 'TlsStatus', + 'TokenCertificateName', + 'TokenPasswordName', + 'TokenStatus', + 'TriggerStatus', + 'TrustPolicyType', + 'WebhookAction', + 'WebhookStatus', + 'ZoneRedundancy', +] diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/models/_container_registry_management_client_enums.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/models/_container_registry_management_client_enums.py new file mode 100644 index 000000000000..029513edcb95 --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/models/_container_registry_management_client_enums.py @@ -0,0 +1,301 @@ +# 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 enum import Enum, EnumMeta +from six import with_metaclass + +class _CaseInsensitiveEnumMeta(EnumMeta): + def __getitem__(self, name): + return super().__getitem__(name.upper()) + + def __getattr__(cls, name): + """Return the enum member matching `name` + We use __getattr__ instead of descriptors or inserting into the enum + class' __dict__ in order to support `name` and `value` being both + properties for enum members (which live in the class' __dict__) and + enum members themselves. + """ + try: + return cls._member_map_[name.upper()] + except KeyError: + raise AttributeError(name) + + +class Action(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The action of virtual network rule. + """ + + ALLOW = "Allow" + +class ActionsRequired(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """A message indicating if changes on the service provider require any updates on the consumer. + """ + + NONE = "None" + RECREATE = "Recreate" + +class ActivationStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The activation status of the connected registry. + """ + + ACTIVE = "Active" + INACTIVE = "Inactive" + +class AuditLogStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Indicates whether audit logs are enabled on the connected registry. + """ + + ENABLED = "Enabled" + DISABLED = "Disabled" + +class CertificateType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The type of certificate location. + """ + + LOCAL_DIRECTORY = "LocalDirectory" + +class ConnectedRegistryMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The mode of the connected registry resource that indicates the permissions of the registry. + """ + + REGISTRY = "Registry" + MIRROR = "Mirror" + +class ConnectionState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The current connection state of the connected registry. + """ + + ONLINE = "Online" + OFFLINE = "Offline" + SYNCING = "Syncing" + UNHEALTHY = "Unhealthy" + +class ConnectionStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The private link service connection status. + """ + + APPROVED = "Approved" + PENDING = "Pending" + REJECTED = "Rejected" + DISCONNECTED = "Disconnected" + +class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The type of identity that created the resource. + """ + + USER = "User" + APPLICATION = "Application" + MANAGED_IDENTITY = "ManagedIdentity" + KEY = "Key" + +class DefaultAction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The default action of allow or deny when no other rules match. + """ + + ALLOW = "Allow" + DENY = "Deny" + +class EncryptionStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Indicates whether or not the encryption is enabled for container registry. + """ + + ENABLED = "enabled" + DISABLED = "disabled" + +class ExportPolicyStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The value that indicates whether the policy is enabled or not. + """ + + ENABLED = "enabled" + DISABLED = "disabled" + +class ImportMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """When Force, any existing target tags will be overwritten. When NoForce, any existing target + tags will fail the operation before any copying begins. + """ + + NO_FORCE = "NoForce" + FORCE = "Force" + +class LastModifiedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The type of identity that last modified the resource. + """ + + USER = "User" + APPLICATION = "Application" + MANAGED_IDENTITY = "ManagedIdentity" + KEY = "Key" + +class LogLevel(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The verbosity of logs persisted on the connected registry. + """ + + DEBUG = "Debug" + INFORMATION = "Information" + WARNING = "Warning" + ERROR = "Error" + NONE = "None" + +class NetworkRuleBypassOptions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Whether to allow trusted Azure services to access a network restricted registry. + """ + + AZURE_SERVICES = "AzureServices" + NONE = "None" + +class PasswordName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The password name. + """ + + PASSWORD = "password" + PASSWORD2 = "password2" + +class PipelineOptions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + OVERWRITE_TAGS = "OverwriteTags" + OVERWRITE_BLOBS = "OverwriteBlobs" + DELETE_SOURCE_BLOB_ON_SUCCESS = "DeleteSourceBlobOnSuccess" + CONTINUE_ON_ERRORS = "ContinueOnErrors" + +class PipelineRunSourceType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The type of the source. + """ + + AZURE_STORAGE_BLOB = "AzureStorageBlob" + +class PipelineRunTargetType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The type of the target. + """ + + AZURE_STORAGE_BLOB = "AzureStorageBlob" + +class PipelineSourceType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The type of source for the import pipeline. + """ + + AZURE_STORAGE_BLOB_CONTAINER = "AzureStorageBlobContainer" + +class PolicyStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The value that indicates whether the policy is enabled or not. + """ + + ENABLED = "enabled" + DISABLED = "disabled" + +class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Provisioning state of the resource. + """ + + CREATING = "Creating" + UPDATING = "Updating" + DELETING = "Deleting" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + CANCELED = "Canceled" + +class PublicNetworkAccess(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Whether or not public network access is allowed for the container registry. + """ + + ENABLED = "Enabled" + DISABLED = "Disabled" + +class RegistryUsageUnit(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The unit of measurement. + """ + + COUNT = "Count" + BYTES = "Bytes" + +class ResourceIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The identity type. + """ + + SYSTEM_ASSIGNED = "SystemAssigned" + USER_ASSIGNED = "UserAssigned" + SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned, UserAssigned" + NONE = "None" + +class SkuName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The SKU name of the container registry. Required for registry creation. + """ + + CLASSIC = "Classic" + BASIC = "Basic" + STANDARD = "Standard" + PREMIUM = "Premium" + +class SkuTier(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The SKU tier based on the SKU name. + """ + + CLASSIC = "Classic" + BASIC = "Basic" + STANDARD = "Standard" + PREMIUM = "Premium" + +class TlsStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Indicates whether HTTPS is enabled for the login server. + """ + + ENABLED = "Enabled" + DISABLED = "Disabled" + +class TokenCertificateName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + CERTIFICATE1 = "certificate1" + CERTIFICATE2 = "certificate2" + +class TokenPasswordName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The password name "password1" or "password2" + """ + + PASSWORD1 = "password1" + PASSWORD2 = "password2" + +class TokenStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The status of the token example enabled or disabled. + """ + + ENABLED = "enabled" + DISABLED = "disabled" + +class TriggerStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The current status of the source trigger. + """ + + ENABLED = "Enabled" + DISABLED = "Disabled" + +class TrustPolicyType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The type of trust policy. + """ + + NOTARY = "Notary" + +class WebhookAction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + PUSH = "push" + DELETE = "delete" + QUARANTINE = "quarantine" + CHART_PUSH = "chart_push" + CHART_DELETE = "chart_delete" + +class WebhookStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The status of the webhook at the time the operation was called. + """ + + ENABLED = "enabled" + DISABLED = "disabled" + +class ZoneRedundancy(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Whether or not zone redundancy is enabled for this container registry + """ + + ENABLED = "Enabled" + DISABLED = "Disabled" diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/models/_models.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/models/_models.py new file mode 100644 index 000000000000..5c8f58e3fc47 --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/models/_models.py @@ -0,0 +1,3666 @@ +# 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 azure.core.exceptions import HttpResponseError +import msrest.serialization + + +class ActivationProperties(msrest.serialization.Model): + """The activation properties of the connected registry. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar status: The activation status of the connected registry. Possible values include: + "Active", "Inactive". + :vartype status: str or + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ActivationStatus + """ + + _validation = { + 'status': {'readonly': True}, + } + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ActivationProperties, self).__init__(**kwargs) + self.status = None + + +class ActiveDirectoryObject(msrest.serialization.Model): + """The Active Directory Object that will be used for authenticating the token of a container registry. + + :param object_id: The user/group/application object ID for Active Directory Object that will be + used for authenticating the token of a container registry. + :type object_id: str + :param tenant_id: The tenant ID of user/group/application object Active Directory Object that + will be used for authenticating the token of a container registry. + :type tenant_id: str + """ + + _attribute_map = { + 'object_id': {'key': 'objectId', 'type': 'str'}, + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ActiveDirectoryObject, self).__init__(**kwargs) + self.object_id = kwargs.get('object_id', None) + self.tenant_id = kwargs.get('tenant_id', None) + + +class Actor(msrest.serialization.Model): + """The agent that initiated the event. For most situations, this could be from the authorization context of the request. + + :param name: The subject or username associated with the request context that generated the + event. + :type name: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Actor, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + + +class CallbackConfig(msrest.serialization.Model): + """The configuration of service URI and custom headers for the webhook. + + All required parameters must be populated in order to send to Azure. + + :param service_uri: Required. The service URI for the webhook to post notifications. + :type service_uri: str + :param custom_headers: Custom headers that will be added to the webhook notifications. + :type custom_headers: dict[str, str] + """ + + _validation = { + 'service_uri': {'required': True}, + } + + _attribute_map = { + 'service_uri': {'key': 'serviceUri', 'type': 'str'}, + 'custom_headers': {'key': 'customHeaders', 'type': '{str}'}, + } + + def __init__( + self, + **kwargs + ): + super(CallbackConfig, self).__init__(**kwargs) + self.service_uri = kwargs['service_uri'] + self.custom_headers = kwargs.get('custom_headers', None) + + +class ProxyResource(msrest.serialization.Model): + """The resource model definition for a ARM proxy resource. It will have everything other than required location and tags. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The resource ID. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.SystemData + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + } + + def __init__( + self, + **kwargs + ): + super(ProxyResource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.system_data = None + + +class ConnectedRegistry(ProxyResource): + """An object that represents a connected registry for a container registry. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The resource ID. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.SystemData + :ivar provisioning_state: Provisioning state of the resource. Possible values include: + "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled". + :vartype provisioning_state: str or + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ProvisioningState + :param mode: The mode of the connected registry resource that indicates the permissions of the + registry. Possible values include: "Registry", "Mirror". + :type mode: str or + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ConnectedRegistryMode + :ivar version: The current version of ACR runtime on the connected registry. + :vartype version: str + :ivar connection_state: The current connection state of the connected registry. Possible values + include: "Online", "Offline", "Syncing", "Unhealthy". + :vartype connection_state: str or + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ConnectionState + :ivar last_activity_time: The last activity time of the connected registry. + :vartype last_activity_time: ~datetime.datetime + :ivar activation: The activation properties of the connected registry. + :vartype activation: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ActivationProperties + :param parent: The parent of the connected registry. + :type parent: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ParentProperties + :param client_token_ids: The list of the ACR token resource IDs used to authenticate clients to + the connected registry. + :type client_token_ids: list[str] + :param login_server: The login server properties of the connected registry. + :type login_server: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.LoginServerProperties + :param logging: The logging properties of the connected registry. + :type logging: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.LoggingProperties + :ivar status_details: The list of current statuses of the connected registry. + :vartype status_details: + list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.StatusDetailProperties] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'version': {'readonly': True}, + 'connection_state': {'readonly': True}, + 'last_activity_time': {'readonly': True}, + 'activation': {'readonly': True}, + 'status_details': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'mode': {'key': 'properties.mode', 'type': 'str'}, + 'version': {'key': 'properties.version', 'type': 'str'}, + 'connection_state': {'key': 'properties.connectionState', 'type': 'str'}, + 'last_activity_time': {'key': 'properties.lastActivityTime', 'type': 'iso-8601'}, + 'activation': {'key': 'properties.activation', 'type': 'ActivationProperties'}, + 'parent': {'key': 'properties.parent', 'type': 'ParentProperties'}, + 'client_token_ids': {'key': 'properties.clientTokenIds', 'type': '[str]'}, + 'login_server': {'key': 'properties.loginServer', 'type': 'LoginServerProperties'}, + 'logging': {'key': 'properties.logging', 'type': 'LoggingProperties'}, + 'status_details': {'key': 'properties.statusDetails', 'type': '[StatusDetailProperties]'}, + } + + def __init__( + self, + **kwargs + ): + super(ConnectedRegistry, self).__init__(**kwargs) + self.provisioning_state = None + self.mode = kwargs.get('mode', None) + self.version = None + self.connection_state = None + self.last_activity_time = None + self.activation = None + self.parent = kwargs.get('parent', None) + self.client_token_ids = kwargs.get('client_token_ids', None) + self.login_server = kwargs.get('login_server', None) + self.logging = kwargs.get('logging', None) + self.status_details = None + + +class ConnectedRegistryListResult(msrest.serialization.Model): + """The result of a request to list connected registries for a container registry. + + :param value: The list of connected registries. Since this list may be incomplete, the nextLink + field should be used to request the next list of connected registries. + :type value: list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.ConnectedRegistry] + :param next_link: The URI that can be used to request the next list of connected registries. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ConnectedRegistry]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ConnectedRegistryListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class ConnectedRegistryUpdateParameters(msrest.serialization.Model): + """The parameters for updating a connected registry. + + :param sync_properties: The sync properties of the connected registry with its parent. + :type sync_properties: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.SyncUpdateProperties + :param logging: The logging properties of the connected registry. + :type logging: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.LoggingProperties + :param client_token_ids: The list of the ACR token resource IDs used to authenticate clients to + the connected registry. + :type client_token_ids: list[str] + """ + + _attribute_map = { + 'sync_properties': {'key': 'properties.syncProperties', 'type': 'SyncUpdateProperties'}, + 'logging': {'key': 'properties.logging', 'type': 'LoggingProperties'}, + 'client_token_ids': {'key': 'properties.clientTokenIds', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(ConnectedRegistryUpdateParameters, self).__init__(**kwargs) + self.sync_properties = kwargs.get('sync_properties', None) + self.logging = kwargs.get('logging', None) + self.client_token_ids = kwargs.get('client_token_ids', None) + + +class EncryptionProperty(msrest.serialization.Model): + """EncryptionProperty. + + :param status: Indicates whether or not the encryption is enabled for container registry. + Possible values include: "enabled", "disabled". + :type status: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.EncryptionStatus + :param key_vault_properties: Key vault properties. + :type key_vault_properties: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.KeyVaultProperties + """ + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + 'key_vault_properties': {'key': 'keyVaultProperties', 'type': 'KeyVaultProperties'}, + } + + def __init__( + self, + **kwargs + ): + super(EncryptionProperty, self).__init__(**kwargs) + self.status = kwargs.get('status', None) + self.key_vault_properties = kwargs.get('key_vault_properties', None) + + +class ErrorResponse(msrest.serialization.Model): + """An error response from the Azure Container Registry service. + + :param error: Azure container registry build API error body. + :type error: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ErrorResponseBody + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorResponseBody'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorResponse, self).__init__(**kwargs) + self.error = kwargs.get('error', None) + + +class ErrorResponseBody(msrest.serialization.Model): + """An error response from the Azure Container Registry service. + + All required parameters must be populated in order to send to Azure. + + :param code: Required. error code. + :type code: str + :param message: Required. error message. + :type message: str + :param target: target of the particular error. + :type target: str + :param details: an array of additional nested error response info objects, as described by this + contract. + :type details: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.InnerErrorDescription + """ + + _validation = { + 'code': {'required': True}, + 'message': {'required': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': 'InnerErrorDescription'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorResponseBody, self).__init__(**kwargs) + self.code = kwargs['code'] + self.message = kwargs['message'] + self.target = kwargs.get('target', None) + self.details = kwargs.get('details', None) + + +class EventInfo(msrest.serialization.Model): + """The basic information of an event. + + :param id: The event ID. + :type id: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(EventInfo, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + + +class Event(EventInfo): + """The event for a webhook. + + :param id: The event ID. + :type id: str + :param event_request_message: The event request message sent to the service URI. + :type event_request_message: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.EventRequestMessage + :param event_response_message: The event response message received from the service URI. + :type event_response_message: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.EventResponseMessage + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'event_request_message': {'key': 'eventRequestMessage', 'type': 'EventRequestMessage'}, + 'event_response_message': {'key': 'eventResponseMessage', 'type': 'EventResponseMessage'}, + } + + def __init__( + self, + **kwargs + ): + super(Event, self).__init__(**kwargs) + self.event_request_message = kwargs.get('event_request_message', None) + self.event_response_message = kwargs.get('event_response_message', None) + + +class EventContent(msrest.serialization.Model): + """The content of the event request message. + + :param id: The event ID. + :type id: str + :param timestamp: The time at which the event occurred. + :type timestamp: ~datetime.datetime + :param action: The action that encompasses the provided event. + :type action: str + :param target: The target of the event. + :type target: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.Target + :param request: The request that generated the event. + :type request: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.Request + :param actor: The agent that initiated the event. For most situations, this could be from the + authorization context of the request. + :type actor: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.Actor + :param source: The registry node that generated the event. Put differently, while the actor + initiates the event, the source generates it. + :type source: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.Source + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'timestamp': {'key': 'timestamp', 'type': 'iso-8601'}, + 'action': {'key': 'action', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'Target'}, + 'request': {'key': 'request', 'type': 'Request'}, + 'actor': {'key': 'actor', 'type': 'Actor'}, + 'source': {'key': 'source', 'type': 'Source'}, + } + + def __init__( + self, + **kwargs + ): + super(EventContent, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.timestamp = kwargs.get('timestamp', None) + self.action = kwargs.get('action', None) + self.target = kwargs.get('target', None) + self.request = kwargs.get('request', None) + self.actor = kwargs.get('actor', None) + self.source = kwargs.get('source', None) + + +class EventListResult(msrest.serialization.Model): + """The result of a request to list events for a webhook. + + :param value: The list of events. Since this list may be incomplete, the nextLink field should + be used to request the next list of events. + :type value: list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.Event] + :param next_link: The URI that can be used to request the next list of events. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Event]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(EventListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class EventRequestMessage(msrest.serialization.Model): + """The event request message sent to the service URI. + + :param content: The content of the event request message. + :type content: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.EventContent + :param headers: The headers of the event request message. + :type headers: dict[str, str] + :param method: The HTTP method used to send the event request message. + :type method: str + :param request_uri: The URI used to send the event request message. + :type request_uri: str + :param version: The HTTP message version. + :type version: str + """ + + _attribute_map = { + 'content': {'key': 'content', 'type': 'EventContent'}, + 'headers': {'key': 'headers', 'type': '{str}'}, + 'method': {'key': 'method', 'type': 'str'}, + 'request_uri': {'key': 'requestUri', 'type': 'str'}, + 'version': {'key': 'version', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(EventRequestMessage, self).__init__(**kwargs) + self.content = kwargs.get('content', None) + self.headers = kwargs.get('headers', None) + self.method = kwargs.get('method', None) + self.request_uri = kwargs.get('request_uri', None) + self.version = kwargs.get('version', None) + + +class EventResponseMessage(msrest.serialization.Model): + """The event response message received from the service URI. + + :param content: The content of the event response message. + :type content: str + :param headers: The headers of the event response message. + :type headers: dict[str, str] + :param reason_phrase: The reason phrase of the event response message. + :type reason_phrase: str + :param status_code: The status code of the event response message. + :type status_code: str + :param version: The HTTP message version. + :type version: str + """ + + _attribute_map = { + 'content': {'key': 'content', 'type': 'str'}, + 'headers': {'key': 'headers', 'type': '{str}'}, + 'reason_phrase': {'key': 'reasonPhrase', 'type': 'str'}, + 'status_code': {'key': 'statusCode', 'type': 'str'}, + 'version': {'key': 'version', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(EventResponseMessage, self).__init__(**kwargs) + self.content = kwargs.get('content', None) + self.headers = kwargs.get('headers', None) + self.reason_phrase = kwargs.get('reason_phrase', None) + self.status_code = kwargs.get('status_code', None) + self.version = kwargs.get('version', None) + + +class ExportPipeline(ProxyResource): + """An object that represents an export pipeline for a container registry. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The resource ID. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.SystemData + :param location: The location of the export pipeline. + :type location: str + :param identity: The identity of the export pipeline. + :type identity: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.IdentityProperties + :param target: The target properties of the export pipeline. + :type target: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ExportPipelineTargetProperties + :param options: The list of all options configured for the pipeline. + :type options: list[str or + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PipelineOptions] + :ivar provisioning_state: The provisioning state of the pipeline at the time the operation was + called. Possible values include: "Creating", "Updating", "Deleting", "Succeeded", "Failed", + "Canceled". + :vartype provisioning_state: str or + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ProvisioningState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'location': {'key': 'location', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'IdentityProperties'}, + 'target': {'key': 'properties.target', 'type': 'ExportPipelineTargetProperties'}, + 'options': {'key': 'properties.options', 'type': '[str]'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ExportPipeline, self).__init__(**kwargs) + self.location = kwargs.get('location', None) + self.identity = kwargs.get('identity', None) + self.target = kwargs.get('target', None) + self.options = kwargs.get('options', None) + self.provisioning_state = None + + +class ExportPipelineListResult(msrest.serialization.Model): + """The result of a request to list export pipelines for a container registry. + + :param value: The list of export pipelines. Since this list may be incomplete, the nextLink + field should be used to request the next list of export pipelines. + :type value: list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.ExportPipeline] + :param next_link: The URI that can be used to request the next list of pipeline runs. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ExportPipeline]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ExportPipelineListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class ExportPipelineTargetProperties(msrest.serialization.Model): + """The properties of the export pipeline target. + + All required parameters must be populated in order to send to Azure. + + :param type: The type of target for the export pipeline. + :type type: str + :param uri: The target uri of the export pipeline. + When 'AzureStorageBlob': "https://accountName.blob.core.windows.net/containerName/blobName" + When 'AzureStorageBlobContainer': "https://accountName.blob.core.windows.net/containerName". + :type uri: str + :param key_vault_uri: Required. They key vault secret uri to obtain the target storage SAS + token. + :type key_vault_uri: str + """ + + _validation = { + 'key_vault_uri': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'uri': {'key': 'uri', 'type': 'str'}, + 'key_vault_uri': {'key': 'keyVaultUri', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ExportPipelineTargetProperties, self).__init__(**kwargs) + self.type = kwargs.get('type', None) + self.uri = kwargs.get('uri', None) + self.key_vault_uri = kwargs['key_vault_uri'] + + +class ExportPolicy(msrest.serialization.Model): + """The export policy for a container registry. + + :param status: The value that indicates whether the policy is enabled or not. Possible values + include: "enabled", "disabled". Default value: "enabled". + :type status: str or + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ExportPolicyStatus + """ + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ExportPolicy, self).__init__(**kwargs) + self.status = kwargs.get('status', "enabled") + + +class GenerateCredentialsParameters(msrest.serialization.Model): + """The parameters used to generate credentials for a specified token or user of a container registry. + + :param token_id: The resource ID of the token for which credentials have to be generated. + :type token_id: str + :param expiry: The expiry date of the generated credentials after which the credentials become + invalid. + :type expiry: ~datetime.datetime + :param name: Specifies name of the password which should be regenerated if any -- password1 or + password2. Possible values include: "password1", "password2". + :type name: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.TokenPasswordName + """ + + _attribute_map = { + 'token_id': {'key': 'tokenId', 'type': 'str'}, + 'expiry': {'key': 'expiry', 'type': 'iso-8601'}, + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(GenerateCredentialsParameters, self).__init__(**kwargs) + self.token_id = kwargs.get('token_id', None) + self.expiry = kwargs.get('expiry', None) + self.name = kwargs.get('name', None) + + +class GenerateCredentialsResult(msrest.serialization.Model): + """The response from the GenerateCredentials operation. + + :param username: The username for a container registry. + :type username: str + :param passwords: The list of passwords for a container registry. + :type passwords: list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.TokenPassword] + """ + + _attribute_map = { + 'username': {'key': 'username', 'type': 'str'}, + 'passwords': {'key': 'passwords', 'type': '[TokenPassword]'}, + } + + def __init__( + self, + **kwargs + ): + super(GenerateCredentialsResult, self).__init__(**kwargs) + self.username = kwargs.get('username', None) + self.passwords = kwargs.get('passwords', None) + + +class IdentityProperties(msrest.serialization.Model): + """Managed identity for the resource. + + :param principal_id: The principal ID of resource identity. + :type principal_id: str + :param tenant_id: The tenant ID of resource. + :type tenant_id: str + :param type: The identity type. Possible values include: "SystemAssigned", "UserAssigned", + "SystemAssigned, UserAssigned", "None". + :type type: str or + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ResourceIdentityType + :param user_assigned_identities: The list of user identities associated with the resource. The + user identity + dictionary key references will be ARM resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/ + providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + :type user_assigned_identities: dict[str, + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.UserIdentityProperties] + """ + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{UserIdentityProperties}'}, + } + + def __init__( + self, + **kwargs + ): + super(IdentityProperties, self).__init__(**kwargs) + self.principal_id = kwargs.get('principal_id', None) + self.tenant_id = kwargs.get('tenant_id', None) + self.type = kwargs.get('type', None) + self.user_assigned_identities = kwargs.get('user_assigned_identities', None) + + +class ImportImageParameters(msrest.serialization.Model): + """ImportImageParameters. + + All required parameters must be populated in order to send to Azure. + + :param source: Required. The source of the image. + :type source: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ImportSource + :param target_tags: List of strings of the form repo[:tag]. When tag is omitted the source will + be used (or 'latest' if source tag is also omitted). + :type target_tags: list[str] + :param untagged_target_repositories: List of strings of repository names to do a manifest only + copy. No tag will be created. + :type untagged_target_repositories: list[str] + :param mode: When Force, any existing target tags will be overwritten. When NoForce, any + existing target tags will fail the operation before any copying begins. Possible values + include: "NoForce", "Force". Default value: "NoForce". + :type mode: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ImportMode + """ + + _validation = { + 'source': {'required': True}, + } + + _attribute_map = { + 'source': {'key': 'source', 'type': 'ImportSource'}, + 'target_tags': {'key': 'targetTags', 'type': '[str]'}, + 'untagged_target_repositories': {'key': 'untaggedTargetRepositories', 'type': '[str]'}, + 'mode': {'key': 'mode', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ImportImageParameters, self).__init__(**kwargs) + self.source = kwargs['source'] + self.target_tags = kwargs.get('target_tags', None) + self.untagged_target_repositories = kwargs.get('untagged_target_repositories', None) + self.mode = kwargs.get('mode', "NoForce") + + +class ImportPipeline(ProxyResource): + """An object that represents an import pipeline for a container registry. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The resource ID. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.SystemData + :param location: The location of the import pipeline. + :type location: str + :param identity: The identity of the import pipeline. + :type identity: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.IdentityProperties + :param source: The source properties of the import pipeline. + :type source: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ImportPipelineSourceProperties + :param trigger: The properties that describe the trigger of the import pipeline. + :type trigger: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PipelineTriggerProperties + :param options: The list of all options configured for the pipeline. + :type options: list[str or + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PipelineOptions] + :ivar provisioning_state: The provisioning state of the pipeline at the time the operation was + called. Possible values include: "Creating", "Updating", "Deleting", "Succeeded", "Failed", + "Canceled". + :vartype provisioning_state: str or + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ProvisioningState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'location': {'key': 'location', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'IdentityProperties'}, + 'source': {'key': 'properties.source', 'type': 'ImportPipelineSourceProperties'}, + 'trigger': {'key': 'properties.trigger', 'type': 'PipelineTriggerProperties'}, + 'options': {'key': 'properties.options', 'type': '[str]'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ImportPipeline, self).__init__(**kwargs) + self.location = kwargs.get('location', None) + self.identity = kwargs.get('identity', None) + self.source = kwargs.get('source', None) + self.trigger = kwargs.get('trigger', None) + self.options = kwargs.get('options', None) + self.provisioning_state = None + + +class ImportPipelineListResult(msrest.serialization.Model): + """The result of a request to list import pipelines for a container registry. + + :param value: The list of import pipelines. Since this list may be incomplete, the nextLink + field should be used to request the next list of import pipelines. + :type value: list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.ImportPipeline] + :param next_link: The URI that can be used to request the next list of pipeline runs. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ImportPipeline]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ImportPipelineListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class ImportPipelineSourceProperties(msrest.serialization.Model): + """The properties of the import pipeline source. + + All required parameters must be populated in order to send to Azure. + + :param type: The type of source for the import pipeline. Possible values include: + "AzureStorageBlobContainer". Default value: "AzureStorageBlobContainer". + :type type: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PipelineSourceType + :param uri: The source uri of the import pipeline. + When 'AzureStorageBlob': "https://accountName.blob.core.windows.net/containerName/blobName" + When 'AzureStorageBlobContainer': "https://accountName.blob.core.windows.net/containerName". + :type uri: str + :param key_vault_uri: Required. They key vault secret uri to obtain the source storage SAS + token. + :type key_vault_uri: str + """ + + _validation = { + 'key_vault_uri': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'uri': {'key': 'uri', 'type': 'str'}, + 'key_vault_uri': {'key': 'keyVaultUri', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ImportPipelineSourceProperties, self).__init__(**kwargs) + self.type = kwargs.get('type', "AzureStorageBlobContainer") + self.uri = kwargs.get('uri', None) + self.key_vault_uri = kwargs['key_vault_uri'] + + +class ImportSource(msrest.serialization.Model): + """ImportSource. + + All required parameters must be populated in order to send to Azure. + + :param resource_id: The resource identifier of the source Azure Container Registry. + :type resource_id: str + :param registry_uri: The address of the source registry (e.g. 'mcr.microsoft.com'). + :type registry_uri: str + :param credentials: Credentials used when importing from a registry uri. + :type credentials: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ImportSourceCredentials + :param source_image: Required. Repository name of the source image. + Specify an image by repository ('hello-world'). This will use the 'latest' tag. + Specify an image by tag ('hello-world:latest'). + Specify an image by sha256-based manifest digest ('hello-world@sha256:abc123'). + :type source_image: str + """ + + _validation = { + 'source_image': {'required': True}, + } + + _attribute_map = { + 'resource_id': {'key': 'resourceId', 'type': 'str'}, + 'registry_uri': {'key': 'registryUri', 'type': 'str'}, + 'credentials': {'key': 'credentials', 'type': 'ImportSourceCredentials'}, + 'source_image': {'key': 'sourceImage', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ImportSource, self).__init__(**kwargs) + self.resource_id = kwargs.get('resource_id', None) + self.registry_uri = kwargs.get('registry_uri', None) + self.credentials = kwargs.get('credentials', None) + self.source_image = kwargs['source_image'] + + +class ImportSourceCredentials(msrest.serialization.Model): + """ImportSourceCredentials. + + All required parameters must be populated in order to send to Azure. + + :param username: The username to authenticate with the source registry. + :type username: str + :param password: Required. The password used to authenticate with the source registry. + :type password: str + """ + + _validation = { + 'password': {'required': True}, + } + + _attribute_map = { + 'username': {'key': 'username', 'type': 'str'}, + 'password': {'key': 'password', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ImportSourceCredentials, self).__init__(**kwargs) + self.username = kwargs.get('username', None) + self.password = kwargs['password'] + + +class InnerErrorDescription(msrest.serialization.Model): + """inner error. + + All required parameters must be populated in order to send to Azure. + + :param code: Required. error code. + :type code: str + :param message: Required. error message. + :type message: str + :param target: target of the particular error. + :type target: str + """ + + _validation = { + 'code': {'required': True}, + 'message': {'required': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(InnerErrorDescription, self).__init__(**kwargs) + self.code = kwargs['code'] + self.message = kwargs['message'] + self.target = kwargs.get('target', None) + + +class IPRule(msrest.serialization.Model): + """IP rule with specific IP or IP range in CIDR format. + + All required parameters must be populated in order to send to Azure. + + :param action: The action of IP ACL rule. Possible values include: "Allow". + :type action: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.Action + :param ip_address_or_range: Required. Specifies the IP or IP range in CIDR format. Only IPV4 + address is allowed. + :type ip_address_or_range: str + """ + + _validation = { + 'ip_address_or_range': {'required': True}, + } + + _attribute_map = { + 'action': {'key': 'action', 'type': 'str'}, + 'ip_address_or_range': {'key': 'value', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(IPRule, self).__init__(**kwargs) + self.action = kwargs.get('action', None) + self.ip_address_or_range = kwargs['ip_address_or_range'] + + +class KeyVaultProperties(msrest.serialization.Model): + """KeyVaultProperties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param key_identifier: Key vault uri to access the encryption key. + :type key_identifier: str + :ivar versioned_key_identifier: The fully qualified key identifier that includes the version of + the key that is actually used for encryption. + :vartype versioned_key_identifier: str + :param identity: The client id of the identity which will be used to access key vault. + :type identity: str + :ivar key_rotation_enabled: Auto key rotation status for a CMK enabled registry. + :vartype key_rotation_enabled: bool + :ivar last_key_rotation_timestamp: Timestamp of the last successful key rotation. + :vartype last_key_rotation_timestamp: ~datetime.datetime + """ + + _validation = { + 'versioned_key_identifier': {'readonly': True}, + 'key_rotation_enabled': {'readonly': True}, + 'last_key_rotation_timestamp': {'readonly': True}, + } + + _attribute_map = { + 'key_identifier': {'key': 'keyIdentifier', 'type': 'str'}, + 'versioned_key_identifier': {'key': 'versionedKeyIdentifier', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'str'}, + 'key_rotation_enabled': {'key': 'keyRotationEnabled', 'type': 'bool'}, + 'last_key_rotation_timestamp': {'key': 'lastKeyRotationTimestamp', 'type': 'iso-8601'}, + } + + def __init__( + self, + **kwargs + ): + super(KeyVaultProperties, self).__init__(**kwargs) + self.key_identifier = kwargs.get('key_identifier', None) + self.versioned_key_identifier = None + self.identity = kwargs.get('identity', None) + self.key_rotation_enabled = None + self.last_key_rotation_timestamp = None + + +class LoggingProperties(msrest.serialization.Model): + """The logging properties of the connected registry. + + :param log_level: The verbosity of logs persisted on the connected registry. Possible values + include: "Debug", "Information", "Warning", "Error", "None". Default value: "Information". + :type log_level: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.LogLevel + :param audit_log_status: Indicates whether audit logs are enabled on the connected registry. + Possible values include: "Enabled", "Disabled". Default value: "Disabled". + :type audit_log_status: str or + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.AuditLogStatus + """ + + _attribute_map = { + 'log_level': {'key': 'logLevel', 'type': 'str'}, + 'audit_log_status': {'key': 'auditLogStatus', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(LoggingProperties, self).__init__(**kwargs) + self.log_level = kwargs.get('log_level', "Information") + self.audit_log_status = kwargs.get('audit_log_status', "Disabled") + + +class LoginServerProperties(msrest.serialization.Model): + """The login server properties of the connected registry. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar host: The host of the connected registry. Can be FQDN or IP. + :vartype host: str + :ivar tls: The TLS properties of the connected registry login server. + :vartype tls: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.TlsProperties + """ + + _validation = { + 'host': {'readonly': True}, + 'tls': {'readonly': True}, + } + + _attribute_map = { + 'host': {'key': 'host', 'type': 'str'}, + 'tls': {'key': 'tls', 'type': 'TlsProperties'}, + } + + def __init__( + self, + **kwargs + ): + super(LoginServerProperties, self).__init__(**kwargs) + self.host = None + self.tls = None + + +class NetworkRuleSet(msrest.serialization.Model): + """The network rule set for a container registry. + + All required parameters must be populated in order to send to Azure. + + :param default_action: Required. The default action of allow or deny when no other rules match. + Possible values include: "Allow", "Deny". Default value: "Allow". + :type default_action: str or + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.DefaultAction + :param virtual_network_rules: The virtual network rules. + :type virtual_network_rules: + list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.VirtualNetworkRule] + :param ip_rules: The IP ACL rules. + :type ip_rules: list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.IPRule] + """ + + _validation = { + 'default_action': {'required': True}, + } + + _attribute_map = { + 'default_action': {'key': 'defaultAction', 'type': 'str'}, + 'virtual_network_rules': {'key': 'virtualNetworkRules', 'type': '[VirtualNetworkRule]'}, + 'ip_rules': {'key': 'ipRules', 'type': '[IPRule]'}, + } + + def __init__( + self, + **kwargs + ): + super(NetworkRuleSet, self).__init__(**kwargs) + self.default_action = kwargs.get('default_action', "Allow") + self.virtual_network_rules = kwargs.get('virtual_network_rules', None) + self.ip_rules = kwargs.get('ip_rules', None) + + +class OperationDefinition(msrest.serialization.Model): + """The definition of a container registry operation. + + :param origin: The origin information of the container registry operation. + :type origin: str + :param name: Operation name: {provider}/{resource}/{operation}. + :type name: str + :param display: The display information for the container registry operation. + :type display: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.OperationDisplayDefinition + :param is_data_action: This property indicates if the operation is an action or a data action + ref: + https://docs.microsoft.com/en-us/azure/role-based-access-control/role-definitions#management-and-data-operations. + :type is_data_action: bool + :param service_specification: The definition of Azure Monitoring service. + :type service_specification: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.OperationServiceSpecificationDefinition + """ + + _attribute_map = { + 'origin': {'key': 'origin', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplayDefinition'}, + 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, + 'service_specification': {'key': 'properties.serviceSpecification', 'type': 'OperationServiceSpecificationDefinition'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationDefinition, self).__init__(**kwargs) + self.origin = kwargs.get('origin', None) + self.name = kwargs.get('name', None) + self.display = kwargs.get('display', None) + self.is_data_action = kwargs.get('is_data_action', None) + self.service_specification = kwargs.get('service_specification', None) + + +class OperationDisplayDefinition(msrest.serialization.Model): + """The display information for a container registry operation. + + :param provider: The resource provider name: Microsoft.ContainerRegistry. + :type provider: str + :param resource: The resource on which the operation is performed. + :type resource: str + :param operation: The operation that users can perform. + :type operation: str + :param description: The description for the operation. + :type description: str + """ + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationDisplayDefinition, self).__init__(**kwargs) + self.provider = kwargs.get('provider', None) + self.resource = kwargs.get('resource', None) + self.operation = kwargs.get('operation', None) + self.description = kwargs.get('description', None) + + +class OperationListResult(msrest.serialization.Model): + """The result of a request to list container registry operations. + + :param value: The list of container registry operations. Since this list may be incomplete, the + nextLink field should be used to request the next list of operations. + :type value: list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.OperationDefinition] + :param next_link: The URI that can be used to request the next list of container registry + operations. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[OperationDefinition]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class OperationLogSpecificationDefinition(msrest.serialization.Model): + """The definition of Azure Monitoring log. + + :param name: Log name. + :type name: str + :param display_name: Log display name. + :type display_name: str + :param blob_duration: Log blob duration. + :type blob_duration: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'blob_duration': {'key': 'blobDuration', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationLogSpecificationDefinition, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.display_name = kwargs.get('display_name', None) + self.blob_duration = kwargs.get('blob_duration', None) + + +class OperationMetricSpecificationDefinition(msrest.serialization.Model): + """The definition of Azure Monitoring metric. + + :param name: Metric name. + :type name: str + :param display_name: Metric display name. + :type display_name: str + :param display_description: Metric description. + :type display_description: str + :param unit: Metric unit. + :type unit: str + :param aggregation_type: Metric aggregation type. + :type aggregation_type: str + :param internal_metric_name: Internal metric name. + :type internal_metric_name: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'display_description': {'key': 'displayDescription', 'type': 'str'}, + 'unit': {'key': 'unit', 'type': 'str'}, + 'aggregation_type': {'key': 'aggregationType', 'type': 'str'}, + 'internal_metric_name': {'key': 'internalMetricName', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationMetricSpecificationDefinition, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.display_name = kwargs.get('display_name', None) + self.display_description = kwargs.get('display_description', None) + self.unit = kwargs.get('unit', None) + self.aggregation_type = kwargs.get('aggregation_type', None) + self.internal_metric_name = kwargs.get('internal_metric_name', None) + + +class OperationServiceSpecificationDefinition(msrest.serialization.Model): + """The definition of Azure Monitoring list. + + :param metric_specifications: A list of Azure Monitoring metrics definition. + :type metric_specifications: + list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.OperationMetricSpecificationDefinition] + :param log_specifications: A list of Azure Monitoring log definitions. + :type log_specifications: + list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.OperationLogSpecificationDefinition] + """ + + _attribute_map = { + 'metric_specifications': {'key': 'metricSpecifications', 'type': '[OperationMetricSpecificationDefinition]'}, + 'log_specifications': {'key': 'logSpecifications', 'type': '[OperationLogSpecificationDefinition]'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationServiceSpecificationDefinition, self).__init__(**kwargs) + self.metric_specifications = kwargs.get('metric_specifications', None) + self.log_specifications = kwargs.get('log_specifications', None) + + +class ParentProperties(msrest.serialization.Model): + """The properties of the connected registry parent. + + All required parameters must be populated in order to send to Azure. + + :param id: The resource ID of the parent to which the connected registry will be associated. + :type id: str + :param sync_properties: Required. The sync properties of the connected registry with its + parent. + :type sync_properties: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.SyncProperties + """ + + _validation = { + 'sync_properties': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'sync_properties': {'key': 'syncProperties', 'type': 'SyncProperties'}, + } + + def __init__( + self, + **kwargs + ): + super(ParentProperties, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.sync_properties = kwargs['sync_properties'] + + +class PipelineRun(ProxyResource): + """An object that represents a pipeline run for a container registry. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The resource ID. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.SystemData + :ivar provisioning_state: The provisioning state of a pipeline run. Possible values include: + "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled". + :vartype provisioning_state: str or + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ProvisioningState + :param request: The request parameters for a pipeline run. + :type request: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PipelineRunRequest + :ivar response: The response of a pipeline run. + :vartype response: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PipelineRunResponse + :param force_update_tag: How the pipeline run should be forced to recreate even if the pipeline + run configuration has not changed. + :type force_update_tag: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'response': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'request': {'key': 'properties.request', 'type': 'PipelineRunRequest'}, + 'response': {'key': 'properties.response', 'type': 'PipelineRunResponse'}, + 'force_update_tag': {'key': 'properties.forceUpdateTag', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PipelineRun, self).__init__(**kwargs) + self.provisioning_state = None + self.request = kwargs.get('request', None) + self.response = None + self.force_update_tag = kwargs.get('force_update_tag', None) + + +class PipelineRunListResult(msrest.serialization.Model): + """The result of a request to list pipeline runs for a container registry. + + :param value: The list of pipeline runs. Since this list may be incomplete, the nextLink field + should be used to request the next list of pipeline runs. + :type value: list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.PipelineRun] + :param next_link: The URI that can be used to request the next list of pipeline runs. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[PipelineRun]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PipelineRunListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class PipelineRunRequest(msrest.serialization.Model): + """The request properties provided for a pipeline run. + + :param pipeline_resource_id: The resource ID of the pipeline to run. + :type pipeline_resource_id: str + :param artifacts: List of source artifacts to be transferred by the pipeline. + Specify an image by repository ('hello-world'). This will use the 'latest' tag. + Specify an image by tag ('hello-world:latest'). + Specify an image by sha256-based manifest digest ('hello-world@sha256:abc123'). + :type artifacts: list[str] + :param source: The source properties of the pipeline run. + :type source: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PipelineRunSourceProperties + :param target: The target properties of the pipeline run. + :type target: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PipelineRunTargetProperties + :param catalog_digest: The digest of the tar used to transfer the artifacts. + :type catalog_digest: str + """ + + _attribute_map = { + 'pipeline_resource_id': {'key': 'pipelineResourceId', 'type': 'str'}, + 'artifacts': {'key': 'artifacts', 'type': '[str]'}, + 'source': {'key': 'source', 'type': 'PipelineRunSourceProperties'}, + 'target': {'key': 'target', 'type': 'PipelineRunTargetProperties'}, + 'catalog_digest': {'key': 'catalogDigest', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PipelineRunRequest, self).__init__(**kwargs) + self.pipeline_resource_id = kwargs.get('pipeline_resource_id', None) + self.artifacts = kwargs.get('artifacts', None) + self.source = kwargs.get('source', None) + self.target = kwargs.get('target', None) + self.catalog_digest = kwargs.get('catalog_digest', None) + + +class PipelineRunResponse(msrest.serialization.Model): + """The response properties returned for a pipeline run. + + :param status: The current status of the pipeline run. + :type status: str + :param imported_artifacts: The artifacts imported in the pipeline run. + :type imported_artifacts: list[str] + :param progress: The current progress of the copy operation. + :type progress: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ProgressProperties + :param start_time: The time the pipeline run started. + :type start_time: ~datetime.datetime + :param finish_time: The time the pipeline run finished. + :type finish_time: ~datetime.datetime + :param source: The source of the pipeline run. + :type source: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ImportPipelineSourceProperties + :param target: The target of the pipeline run. + :type target: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ExportPipelineTargetProperties + :param catalog_digest: The digest of the tar used to transfer the artifacts. + :type catalog_digest: str + :param trigger: The trigger that caused the pipeline run. + :type trigger: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PipelineTriggerDescriptor + :param pipeline_run_error_message: The detailed error message for the pipeline run in the case + of failure. + :type pipeline_run_error_message: str + """ + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + 'imported_artifacts': {'key': 'importedArtifacts', 'type': '[str]'}, + 'progress': {'key': 'progress', 'type': 'ProgressProperties'}, + 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, + 'finish_time': {'key': 'finishTime', 'type': 'iso-8601'}, + 'source': {'key': 'source', 'type': 'ImportPipelineSourceProperties'}, + 'target': {'key': 'target', 'type': 'ExportPipelineTargetProperties'}, + 'catalog_digest': {'key': 'catalogDigest', 'type': 'str'}, + 'trigger': {'key': 'trigger', 'type': 'PipelineTriggerDescriptor'}, + 'pipeline_run_error_message': {'key': 'pipelineRunErrorMessage', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PipelineRunResponse, self).__init__(**kwargs) + self.status = kwargs.get('status', None) + self.imported_artifacts = kwargs.get('imported_artifacts', None) + self.progress = kwargs.get('progress', None) + self.start_time = kwargs.get('start_time', None) + self.finish_time = kwargs.get('finish_time', None) + self.source = kwargs.get('source', None) + self.target = kwargs.get('target', None) + self.catalog_digest = kwargs.get('catalog_digest', None) + self.trigger = kwargs.get('trigger', None) + self.pipeline_run_error_message = kwargs.get('pipeline_run_error_message', None) + + +class PipelineRunSourceProperties(msrest.serialization.Model): + """PipelineRunSourceProperties. + + :param type: The type of the source. Possible values include: "AzureStorageBlob". Default + value: "AzureStorageBlob". + :type type: str or + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PipelineRunSourceType + :param name: The name of the source. + :type name: str + """ + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PipelineRunSourceProperties, self).__init__(**kwargs) + self.type = kwargs.get('type', "AzureStorageBlob") + self.name = kwargs.get('name', None) + + +class PipelineRunTargetProperties(msrest.serialization.Model): + """PipelineRunTargetProperties. + + :param type: The type of the target. Possible values include: "AzureStorageBlob". Default + value: "AzureStorageBlob". + :type type: str or + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PipelineRunTargetType + :param name: The name of the target. + :type name: str + """ + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PipelineRunTargetProperties, self).__init__(**kwargs) + self.type = kwargs.get('type', "AzureStorageBlob") + self.name = kwargs.get('name', None) + + +class PipelineSourceTriggerDescriptor(msrest.serialization.Model): + """PipelineSourceTriggerDescriptor. + + :param timestamp: The timestamp when the source update happened. + :type timestamp: ~datetime.datetime + """ + + _attribute_map = { + 'timestamp': {'key': 'timestamp', 'type': 'iso-8601'}, + } + + def __init__( + self, + **kwargs + ): + super(PipelineSourceTriggerDescriptor, self).__init__(**kwargs) + self.timestamp = kwargs.get('timestamp', None) + + +class PipelineSourceTriggerProperties(msrest.serialization.Model): + """PipelineSourceTriggerProperties. + + All required parameters must be populated in order to send to Azure. + + :param status: Required. The current status of the source trigger. Possible values include: + "Enabled", "Disabled". Default value: "Enabled". + :type status: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.TriggerStatus + """ + + _validation = { + 'status': {'required': True}, + } + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PipelineSourceTriggerProperties, self).__init__(**kwargs) + self.status = kwargs.get('status', "Enabled") + + +class PipelineTriggerDescriptor(msrest.serialization.Model): + """PipelineTriggerDescriptor. + + :param source_trigger: The source trigger that caused the pipeline run. + :type source_trigger: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PipelineSourceTriggerDescriptor + """ + + _attribute_map = { + 'source_trigger': {'key': 'sourceTrigger', 'type': 'PipelineSourceTriggerDescriptor'}, + } + + def __init__( + self, + **kwargs + ): + super(PipelineTriggerDescriptor, self).__init__(**kwargs) + self.source_trigger = kwargs.get('source_trigger', None) + + +class PipelineTriggerProperties(msrest.serialization.Model): + """PipelineTriggerProperties. + + :param source_trigger: The source trigger properties of the pipeline. + :type source_trigger: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PipelineSourceTriggerProperties + """ + + _attribute_map = { + 'source_trigger': {'key': 'sourceTrigger', 'type': 'PipelineSourceTriggerProperties'}, + } + + def __init__( + self, + **kwargs + ): + super(PipelineTriggerProperties, self).__init__(**kwargs) + self.source_trigger = kwargs.get('source_trigger', None) + + +class Policies(msrest.serialization.Model): + """The policies for a container registry. + + :param quarantine_policy: The quarantine policy for a container registry. + :type quarantine_policy: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.QuarantinePolicy + :param trust_policy: The content trust policy for a container registry. + :type trust_policy: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.TrustPolicy + :param retention_policy: The retention policy for a container registry. + :type retention_policy: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.RetentionPolicy + :param export_policy: The export policy for a container registry. + :type export_policy: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ExportPolicy + """ + + _attribute_map = { + 'quarantine_policy': {'key': 'quarantinePolicy', 'type': 'QuarantinePolicy'}, + 'trust_policy': {'key': 'trustPolicy', 'type': 'TrustPolicy'}, + 'retention_policy': {'key': 'retentionPolicy', 'type': 'RetentionPolicy'}, + 'export_policy': {'key': 'exportPolicy', 'type': 'ExportPolicy'}, + } + + def __init__( + self, + **kwargs + ): + super(Policies, self).__init__(**kwargs) + self.quarantine_policy = kwargs.get('quarantine_policy', None) + self.trust_policy = kwargs.get('trust_policy', None) + self.retention_policy = kwargs.get('retention_policy', None) + self.export_policy = kwargs.get('export_policy', None) + + +class PrivateEndpoint(msrest.serialization.Model): + """The Private Endpoint resource. + + :param id: This is private endpoint resource created with Microsoft.Network resource provider. + :type id: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PrivateEndpoint, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + + +class PrivateEndpointConnection(ProxyResource): + """An object that represents a private endpoint connection for a container registry. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The resource ID. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.SystemData + :param private_endpoint: The resource of private endpoint. + :type private_endpoint: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PrivateEndpoint + :param private_link_service_connection_state: A collection of information about the state of + the connection between service consumer and provider. + :type private_link_service_connection_state: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PrivateLinkServiceConnectionState + :ivar provisioning_state: The provisioning state of private endpoint connection resource. + Possible values include: "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled". + :vartype provisioning_state: str or + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ProvisioningState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, + 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PrivateEndpointConnection, self).__init__(**kwargs) + self.private_endpoint = kwargs.get('private_endpoint', None) + self.private_link_service_connection_state = kwargs.get('private_link_service_connection_state', None) + self.provisioning_state = None + + +class PrivateEndpointConnectionListResult(msrest.serialization.Model): + """The result of a request to list private endpoint connections for a container registry. + + :param value: The list of private endpoint connections. Since this list may be incomplete, the + nextLink field should be used to request the next list of private endpoint connections. + :type value: + list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.PrivateEndpointConnection] + :param next_link: The URI that can be used to request the next list of private endpoint + connections. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[PrivateEndpointConnection]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PrivateEndpointConnectionListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class PrivateLinkResource(msrest.serialization.Model): + """A resource that supports private link capabilities. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The resource type is private link resource. + :vartype type: str + :param id: The resource ID. + :type id: str + :param name: The name of the resource. + :type name: str + :param group_id: The private link resource group id. + :type group_id: str + :param required_members: The private link resource required member names. + :type required_members: list[str] + :param required_zone_names: The private link resource Private link DNS zone name. + :type required_zone_names: list[str] + """ + + _validation = { + 'type': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'group_id': {'key': 'properties.groupId', 'type': 'str'}, + 'required_members': {'key': 'properties.requiredMembers', 'type': '[str]'}, + 'required_zone_names': {'key': 'properties.requiredZoneNames', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(PrivateLinkResource, self).__init__(**kwargs) + self.type = None + self.id = kwargs.get('id', None) + self.name = kwargs.get('name', None) + self.group_id = kwargs.get('group_id', None) + self.required_members = kwargs.get('required_members', None) + self.required_zone_names = kwargs.get('required_zone_names', None) + + +class PrivateLinkResourceListResult(msrest.serialization.Model): + """The result of a request to list private link resources for a container registry. + + :param value: The list of private link resources. Since this list may be incomplete, the + nextLink field should be used to request the next list of private link resources. + :type value: list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.PrivateLinkResource] + :param next_link: The URI that can be used to request the next list of private link resources. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[PrivateLinkResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PrivateLinkResourceListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class PrivateLinkServiceConnectionState(msrest.serialization.Model): + """The state of a private link service connection. + + :param status: The private link service connection status. Possible values include: "Approved", + "Pending", "Rejected", "Disconnected". + :type status: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ConnectionStatus + :param description: The description for connection status. For example if connection is + rejected it can indicate reason for rejection. + :type description: str + :param actions_required: A message indicating if changes on the service provider require any + updates on the consumer. Possible values include: "None", "Recreate". + :type actions_required: str or + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ActionsRequired + """ + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'actions_required': {'key': 'actionsRequired', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) + self.status = kwargs.get('status', None) + self.description = kwargs.get('description', None) + self.actions_required = kwargs.get('actions_required', None) + + +class ProgressProperties(msrest.serialization.Model): + """ProgressProperties. + + :param percentage: The percentage complete of the copy operation. + :type percentage: str + """ + + _attribute_map = { + 'percentage': {'key': 'percentage', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ProgressProperties, self).__init__(**kwargs) + self.percentage = kwargs.get('percentage', None) + + +class QuarantinePolicy(msrest.serialization.Model): + """The quarantine policy for a container registry. + + :param status: The value that indicates whether the policy is enabled or not. Possible values + include: "enabled", "disabled". + :type status: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PolicyStatus + """ + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(QuarantinePolicy, self).__init__(**kwargs) + self.status = kwargs.get('status', None) + + +class RegenerateCredentialParameters(msrest.serialization.Model): + """The parameters used to regenerate the login credential. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. Specifies name of the password which should be regenerated -- password + or password2. Possible values include: "password", "password2". + :type name: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PasswordName + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(RegenerateCredentialParameters, self).__init__(**kwargs) + self.name = kwargs['name'] + + +class Resource(msrest.serialization.Model): + """An Azure resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The resource ID. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :param location: Required. The location of the resource. This cannot be changed after the + resource is created. + :type location: str + :param tags: A set of tags. The tags of the resource. + :type tags: dict[str, str] + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.SystemData + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + } + + def __init__( + self, + **kwargs + ): + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = kwargs['location'] + self.tags = kwargs.get('tags', None) + self.system_data = None + + +class Registry(Resource): + """An object that represents a container registry. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The resource ID. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :param location: Required. The location of the resource. This cannot be changed after the + resource is created. + :type location: str + :param tags: A set of tags. The tags of the resource. + :type tags: dict[str, str] + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.SystemData + :param sku: Required. The SKU of the container registry. + :type sku: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.Sku + :param identity: The identity of the container registry. + :type identity: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.IdentityProperties + :ivar login_server: The URL that can be used to log into the container registry. + :vartype login_server: str + :ivar creation_date: The creation date of the container registry in ISO8601 format. + :vartype creation_date: ~datetime.datetime + :ivar provisioning_state: The provisioning state of the container registry at the time the + operation was called. Possible values include: "Creating", "Updating", "Deleting", "Succeeded", + "Failed", "Canceled". + :vartype provisioning_state: str or + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ProvisioningState + :ivar status: The status of the container registry at the time the operation was called. + :vartype status: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.Status + :param admin_user_enabled: The value that indicates whether the admin user is enabled. + :type admin_user_enabled: bool + :param network_rule_set: The network rule set for a container registry. + :type network_rule_set: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.NetworkRuleSet + :param policies: The policies for a container registry. + :type policies: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.Policies + :param encryption: The encryption settings of container registry. + :type encryption: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.EncryptionProperty + :param data_endpoint_enabled: Enable a single data endpoint per region for serving data. + :type data_endpoint_enabled: bool + :ivar data_endpoint_host_names: List of host names that will serve data when + dataEndpointEnabled is true. + :vartype data_endpoint_host_names: list[str] + :ivar private_endpoint_connections: List of private endpoint connections for a container + registry. + :vartype private_endpoint_connections: + list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.PrivateEndpointConnection] + :param public_network_access: Whether or not public network access is allowed for the container + registry. Possible values include: "Enabled", "Disabled". + :type public_network_access: str or + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PublicNetworkAccess + :param network_rule_bypass_options: Whether to allow trusted Azure services to access a network + restricted registry. Possible values include: "AzureServices", "None". + :type network_rule_bypass_options: str or + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.NetworkRuleBypassOptions + :param zone_redundancy: Whether or not zone redundancy is enabled for this container registry. + Possible values include: "Enabled", "Disabled". + :type zone_redundancy: str or + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ZoneRedundancy + :param anonymous_pull_enabled: Enables registry-wide pull from unauthenticated clients. + :type anonymous_pull_enabled: bool + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'system_data': {'readonly': True}, + 'sku': {'required': True}, + 'login_server': {'readonly': True}, + 'creation_date': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'status': {'readonly': True}, + 'data_endpoint_host_names': {'readonly': True}, + 'private_endpoint_connections': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'identity': {'key': 'identity', 'type': 'IdentityProperties'}, + 'login_server': {'key': 'properties.loginServer', 'type': 'str'}, + 'creation_date': {'key': 'properties.creationDate', 'type': 'iso-8601'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'Status'}, + 'admin_user_enabled': {'key': 'properties.adminUserEnabled', 'type': 'bool'}, + 'network_rule_set': {'key': 'properties.networkRuleSet', 'type': 'NetworkRuleSet'}, + 'policies': {'key': 'properties.policies', 'type': 'Policies'}, + 'encryption': {'key': 'properties.encryption', 'type': 'EncryptionProperty'}, + 'data_endpoint_enabled': {'key': 'properties.dataEndpointEnabled', 'type': 'bool'}, + 'data_endpoint_host_names': {'key': 'properties.dataEndpointHostNames', 'type': '[str]'}, + 'private_endpoint_connections': {'key': 'properties.privateEndpointConnections', 'type': '[PrivateEndpointConnection]'}, + 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, + 'network_rule_bypass_options': {'key': 'properties.networkRuleBypassOptions', 'type': 'str'}, + 'zone_redundancy': {'key': 'properties.zoneRedundancy', 'type': 'str'}, + 'anonymous_pull_enabled': {'key': 'properties.anonymousPullEnabled', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(Registry, self).__init__(**kwargs) + self.sku = kwargs['sku'] + self.identity = kwargs.get('identity', None) + self.login_server = None + self.creation_date = None + self.provisioning_state = None + self.status = None + self.admin_user_enabled = kwargs.get('admin_user_enabled', False) + self.network_rule_set = kwargs.get('network_rule_set', None) + self.policies = kwargs.get('policies', None) + self.encryption = kwargs.get('encryption', None) + self.data_endpoint_enabled = kwargs.get('data_endpoint_enabled', None) + self.data_endpoint_host_names = None + self.private_endpoint_connections = None + self.public_network_access = kwargs.get('public_network_access', None) + self.network_rule_bypass_options = kwargs.get('network_rule_bypass_options', None) + self.zone_redundancy = kwargs.get('zone_redundancy', None) + self.anonymous_pull_enabled = kwargs.get('anonymous_pull_enabled', False) + + +class RegistryListCredentialsResult(msrest.serialization.Model): + """The response from the ListCredentials operation. + + :param username: The username for a container registry. + :type username: str + :param passwords: The list of passwords for a container registry. + :type passwords: + list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.RegistryPassword] + """ + + _attribute_map = { + 'username': {'key': 'username', 'type': 'str'}, + 'passwords': {'key': 'passwords', 'type': '[RegistryPassword]'}, + } + + def __init__( + self, + **kwargs + ): + super(RegistryListCredentialsResult, self).__init__(**kwargs) + self.username = kwargs.get('username', None) + self.passwords = kwargs.get('passwords', None) + + +class RegistryListResult(msrest.serialization.Model): + """The result of a request to list container registries. + + :param value: The list of container registries. Since this list may be incomplete, the nextLink + field should be used to request the next list of container registries. + :type value: list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.Registry] + :param next_link: The URI that can be used to request the next list of container registries. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Registry]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(RegistryListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class RegistryNameCheckRequest(msrest.serialization.Model): + """A request to check whether a container registry name is available. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the container registry. + :type name: str + :ivar type: The resource type of the container registry. This field must be set to + 'Microsoft.ContainerRegistry/registries'. Has constant value: + "Microsoft.ContainerRegistry/registries". + :vartype type: str + """ + + _validation = { + 'name': {'required': True, 'max_length': 50, 'min_length': 5, 'pattern': r'^[a-zA-Z0-9]*$'}, + 'type': {'required': True, 'constant': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + type = "Microsoft.ContainerRegistry/registries" + + def __init__( + self, + **kwargs + ): + super(RegistryNameCheckRequest, self).__init__(**kwargs) + self.name = kwargs['name'] + + +class RegistryNameStatus(msrest.serialization.Model): + """The result of a request to check the availability of a container registry name. + + :param name_available: The value that indicates whether the name is available. + :type name_available: bool + :param reason: If any, the reason that the name is not available. + :type reason: str + :param message: If any, the error message that provides more detail for the reason that the + name is not available. + :type message: str + """ + + _attribute_map = { + 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, + 'reason': {'key': 'reason', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(RegistryNameStatus, self).__init__(**kwargs) + self.name_available = kwargs.get('name_available', None) + self.reason = kwargs.get('reason', None) + self.message = kwargs.get('message', None) + + +class RegistryPassword(msrest.serialization.Model): + """The login password for the container registry. + + :param name: The password name. Possible values include: "password", "password2". + :type name: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PasswordName + :param value: The password value. + :type value: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(RegistryPassword, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.value = kwargs.get('value', None) + + +class RegistryUpdateParameters(msrest.serialization.Model): + """The parameters for updating a container registry. + + :param identity: The identity of the container registry. + :type identity: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.IdentityProperties + :param tags: A set of tags. The tags for the container registry. + :type tags: dict[str, str] + :param sku: The SKU of the container registry. + :type sku: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.Sku + :param admin_user_enabled: The value that indicates whether the admin user is enabled. + :type admin_user_enabled: bool + :param network_rule_set: The network rule set for a container registry. + :type network_rule_set: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.NetworkRuleSet + :param policies: The policies for a container registry. + :type policies: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.Policies + :param encryption: The encryption settings of container registry. + :type encryption: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.EncryptionProperty + :param data_endpoint_enabled: Enable a single data endpoint per region for serving data. + :type data_endpoint_enabled: bool + :param public_network_access: Whether or not public network access is allowed for the container + registry. Possible values include: "Enabled", "Disabled". + :type public_network_access: str or + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PublicNetworkAccess + :param network_rule_bypass_options: Whether to allow trusted Azure services to access a network + restricted registry. Possible values include: "AzureServices", "None". + :type network_rule_bypass_options: str or + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.NetworkRuleBypassOptions + :param anonymous_pull_enabled: Enables registry-wide pull from unauthenticated clients. + :type anonymous_pull_enabled: bool + """ + + _attribute_map = { + 'identity': {'key': 'identity', 'type': 'IdentityProperties'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'admin_user_enabled': {'key': 'properties.adminUserEnabled', 'type': 'bool'}, + 'network_rule_set': {'key': 'properties.networkRuleSet', 'type': 'NetworkRuleSet'}, + 'policies': {'key': 'properties.policies', 'type': 'Policies'}, + 'encryption': {'key': 'properties.encryption', 'type': 'EncryptionProperty'}, + 'data_endpoint_enabled': {'key': 'properties.dataEndpointEnabled', 'type': 'bool'}, + 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, + 'network_rule_bypass_options': {'key': 'properties.networkRuleBypassOptions', 'type': 'str'}, + 'anonymous_pull_enabled': {'key': 'properties.anonymousPullEnabled', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(RegistryUpdateParameters, self).__init__(**kwargs) + self.identity = kwargs.get('identity', None) + self.tags = kwargs.get('tags', None) + self.sku = kwargs.get('sku', None) + self.admin_user_enabled = kwargs.get('admin_user_enabled', None) + self.network_rule_set = kwargs.get('network_rule_set', None) + self.policies = kwargs.get('policies', None) + self.encryption = kwargs.get('encryption', None) + self.data_endpoint_enabled = kwargs.get('data_endpoint_enabled', None) + self.public_network_access = kwargs.get('public_network_access', None) + self.network_rule_bypass_options = kwargs.get('network_rule_bypass_options', None) + self.anonymous_pull_enabled = kwargs.get('anonymous_pull_enabled', None) + + +class RegistryUsage(msrest.serialization.Model): + """The quota usage for a container registry. + + :param name: The name of the usage. + :type name: str + :param limit: The limit of the usage. + :type limit: long + :param current_value: The current value of the usage. + :type current_value: long + :param unit: The unit of measurement. Possible values include: "Count", "Bytes". + :type unit: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.RegistryUsageUnit + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'limit': {'key': 'limit', 'type': 'long'}, + 'current_value': {'key': 'currentValue', 'type': 'long'}, + 'unit': {'key': 'unit', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(RegistryUsage, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.limit = kwargs.get('limit', None) + self.current_value = kwargs.get('current_value', None) + self.unit = kwargs.get('unit', None) + + +class RegistryUsageListResult(msrest.serialization.Model): + """The result of a request to get container registry quota usages. + + :param value: The list of container registry quota usages. + :type value: list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.RegistryUsage] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[RegistryUsage]'}, + } + + def __init__( + self, + **kwargs + ): + super(RegistryUsageListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + + +class Replication(Resource): + """An object that represents a replication for a container registry. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The resource ID. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :param location: Required. The location of the resource. This cannot be changed after the + resource is created. + :type location: str + :param tags: A set of tags. The tags of the resource. + :type tags: dict[str, str] + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.SystemData + :ivar provisioning_state: The provisioning state of the replication at the time the operation + was called. Possible values include: "Creating", "Updating", "Deleting", "Succeeded", "Failed", + "Canceled". + :vartype provisioning_state: str or + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ProvisioningState + :ivar status: The status of the replication at the time the operation was called. + :vartype status: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.Status + :param region_endpoint_enabled: Specifies whether the replication's regional endpoint is + enabled. Requests will not be routed to a replication whose regional endpoint is disabled, + however its data will continue to be synced with other replications. + :type region_endpoint_enabled: bool + :param zone_redundancy: Whether or not zone redundancy is enabled for this container registry + replication. Possible values include: "Enabled", "Disabled". + :type zone_redundancy: str or + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ZoneRedundancy + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'system_data': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'status': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'Status'}, + 'region_endpoint_enabled': {'key': 'properties.regionEndpointEnabled', 'type': 'bool'}, + 'zone_redundancy': {'key': 'properties.zoneRedundancy', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Replication, self).__init__(**kwargs) + self.provisioning_state = None + self.status = None + self.region_endpoint_enabled = kwargs.get('region_endpoint_enabled', True) + self.zone_redundancy = kwargs.get('zone_redundancy', None) + + +class ReplicationListResult(msrest.serialization.Model): + """The result of a request to list replications for a container registry. + + :param value: The list of replications. Since this list may be incomplete, the nextLink field + should be used to request the next list of replications. + :type value: list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.Replication] + :param next_link: The URI that can be used to request the next list of replications. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Replication]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ReplicationListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class ReplicationUpdateParameters(msrest.serialization.Model): + """The parameters for updating a replication. + + :param tags: A set of tags. The tags for the replication. + :type tags: dict[str, str] + :param region_endpoint_enabled: Specifies whether the replication's regional endpoint is + enabled. Requests will not be routed to a replication whose regional endpoint is disabled, + however its data will continue to be synced with other replications. + :type region_endpoint_enabled: bool + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'region_endpoint_enabled': {'key': 'properties.regionEndpointEnabled', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(ReplicationUpdateParameters, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + self.region_endpoint_enabled = kwargs.get('region_endpoint_enabled', None) + + +class Request(msrest.serialization.Model): + """The request that generated the event. + + :param id: The ID of the request that initiated the event. + :type id: str + :param addr: The IP or hostname and possibly port of the client connection that initiated the + event. This is the RemoteAddr from the standard http request. + :type addr: str + :param host: The externally accessible hostname of the registry instance, as specified by the + http host header on incoming requests. + :type host: str + :param method: The request method that generated the event. + :type method: str + :param useragent: The user agent header of the request. + :type useragent: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'addr': {'key': 'addr', 'type': 'str'}, + 'host': {'key': 'host', 'type': 'str'}, + 'method': {'key': 'method', 'type': 'str'}, + 'useragent': {'key': 'useragent', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Request, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.addr = kwargs.get('addr', None) + self.host = kwargs.get('host', None) + self.method = kwargs.get('method', None) + self.useragent = kwargs.get('useragent', None) + + +class RetentionPolicy(msrest.serialization.Model): + """The retention policy for a container registry. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param days: The number of days to retain an untagged manifest after which it gets purged. + :type days: int + :ivar last_updated_time: The timestamp when the policy was last updated. + :vartype last_updated_time: ~datetime.datetime + :param status: The value that indicates whether the policy is enabled or not. Possible values + include: "enabled", "disabled". + :type status: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PolicyStatus + """ + + _validation = { + 'last_updated_time': {'readonly': True}, + } + + _attribute_map = { + 'days': {'key': 'days', 'type': 'int'}, + 'last_updated_time': {'key': 'lastUpdatedTime', 'type': 'iso-8601'}, + 'status': {'key': 'status', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(RetentionPolicy, self).__init__(**kwargs) + self.days = kwargs.get('days', 7) + self.last_updated_time = None + self.status = kwargs.get('status', None) + + +class ScopeMap(ProxyResource): + """An object that represents a scope map for a container registry. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The resource ID. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.SystemData + :param description: The user friendly description of the scope map. + :type description: str + :ivar type_properties_type: The type of the scope map. E.g. BuildIn scope map. + :vartype type_properties_type: str + :ivar creation_date: The creation date of scope map. + :vartype creation_date: ~datetime.datetime + :ivar provisioning_state: Provisioning state of the resource. Possible values include: + "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled". + :vartype provisioning_state: str or + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ProvisioningState + :param actions: The list of scoped permissions for registry artifacts. + E.g. repositories/repository-name/content/read, + repositories/repository-name/metadata/write. + :type actions: list[str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'type_properties_type': {'readonly': True}, + 'creation_date': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'type_properties_type': {'key': 'properties.type', 'type': 'str'}, + 'creation_date': {'key': 'properties.creationDate', 'type': 'iso-8601'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'actions': {'key': 'properties.actions', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(ScopeMap, self).__init__(**kwargs) + self.description = kwargs.get('description', None) + self.type_properties_type = None + self.creation_date = None + self.provisioning_state = None + self.actions = kwargs.get('actions', None) + + +class ScopeMapListResult(msrest.serialization.Model): + """The result of a request to list scope maps for a container registry. + + :param value: The list of scope maps. Since this list may be incomplete, the nextLink field + should be used to request the next list of scope maps. + :type value: list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.ScopeMap] + :param next_link: The URI that can be used to request the next list of scope maps. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ScopeMap]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ScopeMapListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class ScopeMapUpdateParameters(msrest.serialization.Model): + """The properties for updating the scope map. + + :param description: The user friendly description of the scope map. + :type description: str + :param actions: The list of scope permissions for registry artifacts. + E.g. repositories/repository-name/pull, + repositories/repository-name/delete. + :type actions: list[str] + """ + + _attribute_map = { + 'description': {'key': 'properties.description', 'type': 'str'}, + 'actions': {'key': 'properties.actions', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(ScopeMapUpdateParameters, self).__init__(**kwargs) + self.description = kwargs.get('description', None) + self.actions = kwargs.get('actions', None) + + +class Sku(msrest.serialization.Model): + """The SKU of a container registry. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The SKU name of the container registry. Required for registry creation. + Possible values include: "Classic", "Basic", "Standard", "Premium". + :type name: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.SkuName + :ivar tier: The SKU tier based on the SKU name. Possible values include: "Classic", "Basic", + "Standard", "Premium". + :vartype tier: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.SkuTier + """ + + _validation = { + 'name': {'required': True}, + 'tier': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'tier': {'key': 'tier', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Sku, self).__init__(**kwargs) + self.name = kwargs['name'] + self.tier = None + + +class Source(msrest.serialization.Model): + """The registry node that generated the event. Put differently, while the actor initiates the event, the source generates it. + + :param addr: The IP or hostname and the port of the registry node that generated the event. + Generally, this will be resolved by os.Hostname() along with the running port. + :type addr: str + :param instance_id: The running instance of an application. Changes after each restart. + :type instance_id: str + """ + + _attribute_map = { + 'addr': {'key': 'addr', 'type': 'str'}, + 'instance_id': {'key': 'instanceID', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Source, self).__init__(**kwargs) + self.addr = kwargs.get('addr', None) + self.instance_id = kwargs.get('instance_id', None) + + +class Status(msrest.serialization.Model): + """The status of an Azure resource at the time the operation was called. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar display_status: The short label for the status. + :vartype display_status: str + :ivar message: The detailed message for the status, including alerts and error messages. + :vartype message: str + :ivar timestamp: The timestamp when the status was changed to the current value. + :vartype timestamp: ~datetime.datetime + """ + + _validation = { + 'display_status': {'readonly': True}, + 'message': {'readonly': True}, + 'timestamp': {'readonly': True}, + } + + _attribute_map = { + 'display_status': {'key': 'displayStatus', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'timestamp': {'key': 'timestamp', 'type': 'iso-8601'}, + } + + def __init__( + self, + **kwargs + ): + super(Status, self).__init__(**kwargs) + self.display_status = None + self.message = None + self.timestamp = None + + +class StatusDetailProperties(msrest.serialization.Model): + """The status detail properties of the connected registry. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The component of the connected registry corresponding to the status. + :vartype type: str + :ivar code: The code of the status. + :vartype code: str + :ivar description: The description of the status. + :vartype description: str + :ivar timestamp: The timestamp of the status. + :vartype timestamp: ~datetime.datetime + :ivar correlation_id: The correlation ID of the status. + :vartype correlation_id: str + """ + + _validation = { + 'type': {'readonly': True}, + 'code': {'readonly': True}, + 'description': {'readonly': True}, + 'timestamp': {'readonly': True}, + 'correlation_id': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'code': {'key': 'code', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'timestamp': {'key': 'timestamp', 'type': 'iso-8601'}, + 'correlation_id': {'key': 'correlationId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(StatusDetailProperties, self).__init__(**kwargs) + self.type = None + self.code = None + self.description = None + self.timestamp = None + self.correlation_id = None + + +class SyncProperties(msrest.serialization.Model): + """The sync properties of the connected registry with its parent. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param token_id: Required. The resource ID of the ACR token used to authenticate the connected + registry to its parent during sync. + :type token_id: str + :param schedule: The cron expression indicating the schedule that the connected registry will + sync with its parent. + :type schedule: str + :param sync_window: The time window during which sync is enabled for each schedule occurrence. + Specify the duration using the format P[n]Y[n]M[n]DT[n]H[n]M[n]S as per ISO8601. + :type sync_window: ~datetime.timedelta + :param message_ttl: Required. The period of time for which a message is available to sync + before it is expired. Specify the duration using the format P[n]Y[n]M[n]DT[n]H[n]M[n]S as per + ISO8601. + :type message_ttl: ~datetime.timedelta + :ivar last_sync_time: The last time a sync occurred between the connected registry and its + parent. + :vartype last_sync_time: ~datetime.datetime + :ivar gateway_endpoint: The gateway endpoint used by the connected registry to communicate with + its parent. + :vartype gateway_endpoint: str + """ + + _validation = { + 'token_id': {'required': True}, + 'message_ttl': {'required': True}, + 'last_sync_time': {'readonly': True}, + 'gateway_endpoint': {'readonly': True}, + } + + _attribute_map = { + 'token_id': {'key': 'tokenId', 'type': 'str'}, + 'schedule': {'key': 'schedule', 'type': 'str'}, + 'sync_window': {'key': 'syncWindow', 'type': 'duration'}, + 'message_ttl': {'key': 'messageTtl', 'type': 'duration'}, + 'last_sync_time': {'key': 'lastSyncTime', 'type': 'iso-8601'}, + 'gateway_endpoint': {'key': 'gatewayEndpoint', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SyncProperties, self).__init__(**kwargs) + self.token_id = kwargs['token_id'] + self.schedule = kwargs.get('schedule', None) + self.sync_window = kwargs.get('sync_window', None) + self.message_ttl = kwargs['message_ttl'] + self.last_sync_time = None + self.gateway_endpoint = None + + +class SyncUpdateProperties(msrest.serialization.Model): + """The parameters for updating the sync properties of the connected registry with its parent. + + :param schedule: The cron expression indicating the schedule that the connected registry will + sync with its parent. + :type schedule: str + :param sync_window: The time window during which sync is enabled for each schedule occurrence. + Specify the duration using the format P[n]Y[n]M[n]DT[n]H[n]M[n]S as per ISO8601. + :type sync_window: ~datetime.timedelta + :param message_ttl: The period of time for which a message is available to sync before it is + expired. Specify the duration using the format P[n]Y[n]M[n]DT[n]H[n]M[n]S as per ISO8601. + :type message_ttl: ~datetime.timedelta + """ + + _attribute_map = { + 'schedule': {'key': 'schedule', 'type': 'str'}, + 'sync_window': {'key': 'syncWindow', 'type': 'duration'}, + 'message_ttl': {'key': 'messageTtl', 'type': 'duration'}, + } + + def __init__( + self, + **kwargs + ): + super(SyncUpdateProperties, self).__init__(**kwargs) + self.schedule = kwargs.get('schedule', None) + self.sync_window = kwargs.get('sync_window', None) + self.message_ttl = kwargs.get('message_ttl', None) + + +class SystemData(msrest.serialization.Model): + """Metadata pertaining to creation and last modification of the resource. + + :param created_by: The identity that created the resource. + :type created_by: str + :param created_by_type: The type of identity that created the resource. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :type created_by_type: str or + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.CreatedByType + :param created_at: The timestamp of resource creation (UTC). + :type created_at: ~datetime.datetime + :param last_modified_by: The identity that last modified the resource. + :type last_modified_by: str + :param last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :type last_modified_by_type: str or + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.LastModifiedByType + :param last_modified_at: The timestamp of resource modification (UTC). + :type last_modified_at: ~datetime.datetime + """ + + _attribute_map = { + 'created_by': {'key': 'createdBy', 'type': 'str'}, + 'created_by_type': {'key': 'createdByType', 'type': 'str'}, + 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, + 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, + 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, + 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + } + + def __init__( + self, + **kwargs + ): + super(SystemData, self).__init__(**kwargs) + self.created_by = kwargs.get('created_by', None) + self.created_by_type = kwargs.get('created_by_type', None) + self.created_at = kwargs.get('created_at', None) + self.last_modified_by = kwargs.get('last_modified_by', None) + self.last_modified_by_type = kwargs.get('last_modified_by_type', None) + self.last_modified_at = kwargs.get('last_modified_at', None) + + +class Target(msrest.serialization.Model): + """The target of the event. + + :param media_type: The MIME type of the referenced object. + :type media_type: str + :param size: The number of bytes of the content. Same as Length field. + :type size: long + :param digest: The digest of the content, as defined by the Registry V2 HTTP API Specification. + :type digest: str + :param length: The number of bytes of the content. Same as Size field. + :type length: long + :param repository: The repository name. + :type repository: str + :param url: The direct URL to the content. + :type url: str + :param tag: The tag name. + :type tag: str + :param name: The name of the artifact. + :type name: str + :param version: The version of the artifact. + :type version: str + """ + + _attribute_map = { + 'media_type': {'key': 'mediaType', 'type': 'str'}, + 'size': {'key': 'size', 'type': 'long'}, + 'digest': {'key': 'digest', 'type': 'str'}, + 'length': {'key': 'length', 'type': 'long'}, + 'repository': {'key': 'repository', 'type': 'str'}, + 'url': {'key': 'url', 'type': 'str'}, + 'tag': {'key': 'tag', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'version': {'key': 'version', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Target, self).__init__(**kwargs) + self.media_type = kwargs.get('media_type', None) + self.size = kwargs.get('size', None) + self.digest = kwargs.get('digest', None) + self.length = kwargs.get('length', None) + self.repository = kwargs.get('repository', None) + self.url = kwargs.get('url', None) + self.tag = kwargs.get('tag', None) + self.name = kwargs.get('name', None) + self.version = kwargs.get('version', None) + + +class TlsCertificateProperties(msrest.serialization.Model): + """The TLS certificate properties of the connected registry login server. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The type of certificate location. Possible values include: "LocalDirectory". + :vartype type: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.CertificateType + :ivar location: Indicates the location of the certificates. + :vartype location: str + """ + + _validation = { + 'type': {'readonly': True}, + 'location': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(TlsCertificateProperties, self).__init__(**kwargs) + self.type = None + self.location = None + + +class TlsProperties(msrest.serialization.Model): + """The TLS properties of the connected registry login server. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar status: Indicates whether HTTPS is enabled for the login server. Possible values include: + "Enabled", "Disabled". + :vartype status: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.TlsStatus + :ivar certificate: The certificate used to configure HTTPS for the login server. + :vartype certificate: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.TlsCertificateProperties + """ + + _validation = { + 'status': {'readonly': True}, + 'certificate': {'readonly': True}, + } + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + 'certificate': {'key': 'certificate', 'type': 'TlsCertificateProperties'}, + } + + def __init__( + self, + **kwargs + ): + super(TlsProperties, self).__init__(**kwargs) + self.status = None + self.certificate = None + + +class Token(ProxyResource): + """An object that represents a token for a container registry. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The resource ID. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.SystemData + :ivar creation_date: The creation date of scope map. + :vartype creation_date: ~datetime.datetime + :ivar provisioning_state: Provisioning state of the resource. Possible values include: + "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled". + :vartype provisioning_state: str or + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ProvisioningState + :param scope_map_id: The resource ID of the scope map to which the token will be associated + with. + :type scope_map_id: str + :param credentials: The credentials that can be used for authenticating the token. + :type credentials: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.TokenCredentialsProperties + :param status: The status of the token example enabled or disabled. Possible values include: + "enabled", "disabled". + :type status: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.TokenStatus + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'creation_date': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'creation_date': {'key': 'properties.creationDate', 'type': 'iso-8601'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'scope_map_id': {'key': 'properties.scopeMapId', 'type': 'str'}, + 'credentials': {'key': 'properties.credentials', 'type': 'TokenCredentialsProperties'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Token, self).__init__(**kwargs) + self.creation_date = None + self.provisioning_state = None + self.scope_map_id = kwargs.get('scope_map_id', None) + self.credentials = kwargs.get('credentials', None) + self.status = kwargs.get('status', None) + + +class TokenCertificate(msrest.serialization.Model): + """The properties of a certificate used for authenticating a token. + + :param name: Possible values include: "certificate1", "certificate2". + :type name: str or + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.TokenCertificateName + :param expiry: The expiry datetime of the certificate. + :type expiry: ~datetime.datetime + :param thumbprint: The thumbprint of the certificate. + :type thumbprint: str + :param encoded_pem_certificate: Base 64 encoded string of the public certificate1 in PEM format + that will be used for authenticating the token. + :type encoded_pem_certificate: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'expiry': {'key': 'expiry', 'type': 'iso-8601'}, + 'thumbprint': {'key': 'thumbprint', 'type': 'str'}, + 'encoded_pem_certificate': {'key': 'encodedPemCertificate', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(TokenCertificate, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.expiry = kwargs.get('expiry', None) + self.thumbprint = kwargs.get('thumbprint', None) + self.encoded_pem_certificate = kwargs.get('encoded_pem_certificate', None) + + +class TokenCredentialsProperties(msrest.serialization.Model): + """The properties of the credentials that can be used for authenticating the token. + + :param certificates: + :type certificates: + list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.TokenCertificate] + :param passwords: + :type passwords: list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.TokenPassword] + """ + + _attribute_map = { + 'certificates': {'key': 'certificates', 'type': '[TokenCertificate]'}, + 'passwords': {'key': 'passwords', 'type': '[TokenPassword]'}, + } + + def __init__( + self, + **kwargs + ): + super(TokenCredentialsProperties, self).__init__(**kwargs) + self.certificates = kwargs.get('certificates', None) + self.passwords = kwargs.get('passwords', None) + + +class TokenListResult(msrest.serialization.Model): + """The result of a request to list tokens for a container registry. + + :param value: The list of tokens. Since this list may be incomplete, the nextLink field should + be used to request the next list of tokens. + :type value: list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.Token] + :param next_link: The URI that can be used to request the next list of tokens. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Token]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(TokenListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class TokenPassword(msrest.serialization.Model): + """The password that will be used for authenticating the token of a container registry. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param creation_time: The creation datetime of the password. + :type creation_time: ~datetime.datetime + :param expiry: The expiry datetime of the password. + :type expiry: ~datetime.datetime + :param name: The password name "password1" or "password2". Possible values include: + "password1", "password2". + :type name: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.TokenPasswordName + :ivar value: The password value. + :vartype value: str + """ + + _validation = { + 'value': {'readonly': True}, + } + + _attribute_map = { + 'creation_time': {'key': 'creationTime', 'type': 'iso-8601'}, + 'expiry': {'key': 'expiry', 'type': 'iso-8601'}, + 'name': {'key': 'name', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(TokenPassword, self).__init__(**kwargs) + self.creation_time = kwargs.get('creation_time', None) + self.expiry = kwargs.get('expiry', None) + self.name = kwargs.get('name', None) + self.value = None + + +class TokenUpdateParameters(msrest.serialization.Model): + """The parameters for updating a token. + + :param scope_map_id: The resource ID of the scope map to which the token will be associated + with. + :type scope_map_id: str + :param status: The status of the token example enabled or disabled. Possible values include: + "enabled", "disabled". + :type status: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.TokenStatus + :param credentials: The credentials that can be used for authenticating the token. + :type credentials: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.TokenCredentialsProperties + """ + + _attribute_map = { + 'scope_map_id': {'key': 'properties.scopeMapId', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'credentials': {'key': 'properties.credentials', 'type': 'TokenCredentialsProperties'}, + } + + def __init__( + self, + **kwargs + ): + super(TokenUpdateParameters, self).__init__(**kwargs) + self.scope_map_id = kwargs.get('scope_map_id', None) + self.status = kwargs.get('status', None) + self.credentials = kwargs.get('credentials', None) + + +class TrustPolicy(msrest.serialization.Model): + """The content trust policy for a container registry. + + :param type: The type of trust policy. Possible values include: "Notary". Default value: + "Notary". + :type type: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.TrustPolicyType + :param status: The value that indicates whether the policy is enabled or not. Possible values + include: "enabled", "disabled". + :type status: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PolicyStatus + """ + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(TrustPolicy, self).__init__(**kwargs) + self.type = kwargs.get('type', "Notary") + self.status = kwargs.get('status', None) + + +class UserIdentityProperties(msrest.serialization.Model): + """UserIdentityProperties. + + :param principal_id: The principal id of user assigned identity. + :type principal_id: str + :param client_id: The client id of user assigned identity. + :type client_id: str + """ + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'client_id': {'key': 'clientId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(UserIdentityProperties, self).__init__(**kwargs) + self.principal_id = kwargs.get('principal_id', None) + self.client_id = kwargs.get('client_id', None) + + +class VirtualNetworkRule(msrest.serialization.Model): + """Virtual network rule. + + All required parameters must be populated in order to send to Azure. + + :param action: The action of virtual network rule. Possible values include: "Allow". + :type action: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.Action + :param virtual_network_resource_id: Required. Resource ID of a subnet, for example: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{vnetName}/subnets/{subnetName}. + :type virtual_network_resource_id: str + """ + + _validation = { + 'virtual_network_resource_id': {'required': True}, + } + + _attribute_map = { + 'action': {'key': 'action', 'type': 'str'}, + 'virtual_network_resource_id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(VirtualNetworkRule, self).__init__(**kwargs) + self.action = kwargs.get('action', None) + self.virtual_network_resource_id = kwargs['virtual_network_resource_id'] + + +class Webhook(Resource): + """An object that represents a webhook for a container registry. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The resource ID. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :param location: Required. The location of the resource. This cannot be changed after the + resource is created. + :type location: str + :param tags: A set of tags. The tags of the resource. + :type tags: dict[str, str] + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.SystemData + :param status: The status of the webhook at the time the operation was called. Possible values + include: "enabled", "disabled". + :type status: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.WebhookStatus + :param scope: The scope of repositories where the event can be triggered. For example, 'foo:*' + means events for all tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' only. + 'foo' is equivalent to 'foo:latest'. Empty means all events. + :type scope: str + :param actions: The list of actions that trigger the webhook to post notifications. + :type actions: list[str or + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.WebhookAction] + :ivar provisioning_state: The provisioning state of the webhook at the time the operation was + called. Possible values include: "Creating", "Updating", "Deleting", "Succeeded", "Failed", + "Canceled". + :vartype provisioning_state: str or + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ProvisioningState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'system_data': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'scope': {'key': 'properties.scope', 'type': 'str'}, + 'actions': {'key': 'properties.actions', 'type': '[str]'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Webhook, self).__init__(**kwargs) + self.status = kwargs.get('status', None) + self.scope = kwargs.get('scope', None) + self.actions = kwargs.get('actions', None) + self.provisioning_state = None + + +class WebhookCreateParameters(msrest.serialization.Model): + """The parameters for creating a webhook. + + All required parameters must be populated in order to send to Azure. + + :param tags: A set of tags. The tags for the webhook. + :type tags: dict[str, str] + :param location: Required. The location of the webhook. This cannot be changed after the + resource is created. + :type location: str + :param service_uri: The service URI for the webhook to post notifications. + :type service_uri: str + :param custom_headers: Custom headers that will be added to the webhook notifications. + :type custom_headers: dict[str, str] + :param status: The status of the webhook at the time the operation was called. Possible values + include: "enabled", "disabled". + :type status: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.WebhookStatus + :param scope: The scope of repositories where the event can be triggered. For example, 'foo:*' + means events for all tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' only. + 'foo' is equivalent to 'foo:latest'. Empty means all events. + :type scope: str + :param actions: The list of actions that trigger the webhook to post notifications. + :type actions: list[str or + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.WebhookAction] + """ + + _validation = { + 'location': {'required': True}, + } + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'service_uri': {'key': 'properties.serviceUri', 'type': 'str'}, + 'custom_headers': {'key': 'properties.customHeaders', 'type': '{str}'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'scope': {'key': 'properties.scope', 'type': 'str'}, + 'actions': {'key': 'properties.actions', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(WebhookCreateParameters, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + self.location = kwargs['location'] + self.service_uri = kwargs.get('service_uri', None) + self.custom_headers = kwargs.get('custom_headers', None) + self.status = kwargs.get('status', None) + self.scope = kwargs.get('scope', None) + self.actions = kwargs.get('actions', None) + + +class WebhookListResult(msrest.serialization.Model): + """The result of a request to list webhooks for a container registry. + + :param value: The list of webhooks. Since this list may be incomplete, the nextLink field + should be used to request the next list of webhooks. + :type value: list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.Webhook] + :param next_link: The URI that can be used to request the next list of webhooks. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Webhook]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(WebhookListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class WebhookUpdateParameters(msrest.serialization.Model): + """The parameters for updating a webhook. + + :param tags: A set of tags. The tags for the webhook. + :type tags: dict[str, str] + :param service_uri: The service URI for the webhook to post notifications. + :type service_uri: str + :param custom_headers: Custom headers that will be added to the webhook notifications. + :type custom_headers: dict[str, str] + :param status: The status of the webhook at the time the operation was called. Possible values + include: "enabled", "disabled". + :type status: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.WebhookStatus + :param scope: The scope of repositories where the event can be triggered. For example, 'foo:*' + means events for all tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' only. + 'foo' is equivalent to 'foo:latest'. Empty means all events. + :type scope: str + :param actions: The list of actions that trigger the webhook to post notifications. + :type actions: list[str or + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.WebhookAction] + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'service_uri': {'key': 'properties.serviceUri', 'type': 'str'}, + 'custom_headers': {'key': 'properties.customHeaders', 'type': '{str}'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'scope': {'key': 'properties.scope', 'type': 'str'}, + 'actions': {'key': 'properties.actions', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(WebhookUpdateParameters, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + self.service_uri = kwargs.get('service_uri', None) + self.custom_headers = kwargs.get('custom_headers', None) + self.status = kwargs.get('status', None) + self.scope = kwargs.get('scope', None) + self.actions = kwargs.get('actions', None) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/models/_models_py3.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/models/_models_py3.py new file mode 100644 index 000000000000..e79bfa7c8fb8 --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/models/_models_py3.py @@ -0,0 +1,4067 @@ +# 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. +# -------------------------------------------------------------------------- + +import datetime +from typing import Dict, List, Optional, Union + +from azure.core.exceptions import HttpResponseError +import msrest.serialization + +from ._container_registry_management_client_enums import * + + +class ActivationProperties(msrest.serialization.Model): + """The activation properties of the connected registry. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar status: The activation status of the connected registry. Possible values include: + "Active", "Inactive". + :vartype status: str or + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ActivationStatus + """ + + _validation = { + 'status': {'readonly': True}, + } + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ActivationProperties, self).__init__(**kwargs) + self.status = None + + +class ActiveDirectoryObject(msrest.serialization.Model): + """The Active Directory Object that will be used for authenticating the token of a container registry. + + :param object_id: The user/group/application object ID for Active Directory Object that will be + used for authenticating the token of a container registry. + :type object_id: str + :param tenant_id: The tenant ID of user/group/application object Active Directory Object that + will be used for authenticating the token of a container registry. + :type tenant_id: str + """ + + _attribute_map = { + 'object_id': {'key': 'objectId', 'type': 'str'}, + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + } + + def __init__( + self, + *, + object_id: Optional[str] = None, + tenant_id: Optional[str] = None, + **kwargs + ): + super(ActiveDirectoryObject, self).__init__(**kwargs) + self.object_id = object_id + self.tenant_id = tenant_id + + +class Actor(msrest.serialization.Model): + """The agent that initiated the event. For most situations, this could be from the authorization context of the request. + + :param name: The subject or username associated with the request context that generated the + event. + :type name: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + **kwargs + ): + super(Actor, self).__init__(**kwargs) + self.name = name + + +class CallbackConfig(msrest.serialization.Model): + """The configuration of service URI and custom headers for the webhook. + + All required parameters must be populated in order to send to Azure. + + :param service_uri: Required. The service URI for the webhook to post notifications. + :type service_uri: str + :param custom_headers: Custom headers that will be added to the webhook notifications. + :type custom_headers: dict[str, str] + """ + + _validation = { + 'service_uri': {'required': True}, + } + + _attribute_map = { + 'service_uri': {'key': 'serviceUri', 'type': 'str'}, + 'custom_headers': {'key': 'customHeaders', 'type': '{str}'}, + } + + def __init__( + self, + *, + service_uri: str, + custom_headers: Optional[Dict[str, str]] = None, + **kwargs + ): + super(CallbackConfig, self).__init__(**kwargs) + self.service_uri = service_uri + self.custom_headers = custom_headers + + +class ProxyResource(msrest.serialization.Model): + """The resource model definition for a ARM proxy resource. It will have everything other than required location and tags. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The resource ID. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.SystemData + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + } + + def __init__( + self, + **kwargs + ): + super(ProxyResource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.system_data = None + + +class ConnectedRegistry(ProxyResource): + """An object that represents a connected registry for a container registry. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The resource ID. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.SystemData + :ivar provisioning_state: Provisioning state of the resource. Possible values include: + "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled". + :vartype provisioning_state: str or + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ProvisioningState + :param mode: The mode of the connected registry resource that indicates the permissions of the + registry. Possible values include: "Registry", "Mirror". + :type mode: str or + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ConnectedRegistryMode + :ivar version: The current version of ACR runtime on the connected registry. + :vartype version: str + :ivar connection_state: The current connection state of the connected registry. Possible values + include: "Online", "Offline", "Syncing", "Unhealthy". + :vartype connection_state: str or + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ConnectionState + :ivar last_activity_time: The last activity time of the connected registry. + :vartype last_activity_time: ~datetime.datetime + :ivar activation: The activation properties of the connected registry. + :vartype activation: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ActivationProperties + :param parent: The parent of the connected registry. + :type parent: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ParentProperties + :param client_token_ids: The list of the ACR token resource IDs used to authenticate clients to + the connected registry. + :type client_token_ids: list[str] + :param login_server: The login server properties of the connected registry. + :type login_server: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.LoginServerProperties + :param logging: The logging properties of the connected registry. + :type logging: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.LoggingProperties + :ivar status_details: The list of current statuses of the connected registry. + :vartype status_details: + list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.StatusDetailProperties] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'version': {'readonly': True}, + 'connection_state': {'readonly': True}, + 'last_activity_time': {'readonly': True}, + 'activation': {'readonly': True}, + 'status_details': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'mode': {'key': 'properties.mode', 'type': 'str'}, + 'version': {'key': 'properties.version', 'type': 'str'}, + 'connection_state': {'key': 'properties.connectionState', 'type': 'str'}, + 'last_activity_time': {'key': 'properties.lastActivityTime', 'type': 'iso-8601'}, + 'activation': {'key': 'properties.activation', 'type': 'ActivationProperties'}, + 'parent': {'key': 'properties.parent', 'type': 'ParentProperties'}, + 'client_token_ids': {'key': 'properties.clientTokenIds', 'type': '[str]'}, + 'login_server': {'key': 'properties.loginServer', 'type': 'LoginServerProperties'}, + 'logging': {'key': 'properties.logging', 'type': 'LoggingProperties'}, + 'status_details': {'key': 'properties.statusDetails', 'type': '[StatusDetailProperties]'}, + } + + def __init__( + self, + *, + mode: Optional[Union[str, "ConnectedRegistryMode"]] = None, + parent: Optional["ParentProperties"] = None, + client_token_ids: Optional[List[str]] = None, + login_server: Optional["LoginServerProperties"] = None, + logging: Optional["LoggingProperties"] = None, + **kwargs + ): + super(ConnectedRegistry, self).__init__(**kwargs) + self.provisioning_state = None + self.mode = mode + self.version = None + self.connection_state = None + self.last_activity_time = None + self.activation = None + self.parent = parent + self.client_token_ids = client_token_ids + self.login_server = login_server + self.logging = logging + self.status_details = None + + +class ConnectedRegistryListResult(msrest.serialization.Model): + """The result of a request to list connected registries for a container registry. + + :param value: The list of connected registries. Since this list may be incomplete, the nextLink + field should be used to request the next list of connected registries. + :type value: list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.ConnectedRegistry] + :param next_link: The URI that can be used to request the next list of connected registries. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ConnectedRegistry]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["ConnectedRegistry"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(ConnectedRegistryListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ConnectedRegistryUpdateParameters(msrest.serialization.Model): + """The parameters for updating a connected registry. + + :param sync_properties: The sync properties of the connected registry with its parent. + :type sync_properties: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.SyncUpdateProperties + :param logging: The logging properties of the connected registry. + :type logging: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.LoggingProperties + :param client_token_ids: The list of the ACR token resource IDs used to authenticate clients to + the connected registry. + :type client_token_ids: list[str] + """ + + _attribute_map = { + 'sync_properties': {'key': 'properties.syncProperties', 'type': 'SyncUpdateProperties'}, + 'logging': {'key': 'properties.logging', 'type': 'LoggingProperties'}, + 'client_token_ids': {'key': 'properties.clientTokenIds', 'type': '[str]'}, + } + + def __init__( + self, + *, + sync_properties: Optional["SyncUpdateProperties"] = None, + logging: Optional["LoggingProperties"] = None, + client_token_ids: Optional[List[str]] = None, + **kwargs + ): + super(ConnectedRegistryUpdateParameters, self).__init__(**kwargs) + self.sync_properties = sync_properties + self.logging = logging + self.client_token_ids = client_token_ids + + +class EncryptionProperty(msrest.serialization.Model): + """EncryptionProperty. + + :param status: Indicates whether or not the encryption is enabled for container registry. + Possible values include: "enabled", "disabled". + :type status: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.EncryptionStatus + :param key_vault_properties: Key vault properties. + :type key_vault_properties: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.KeyVaultProperties + """ + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + 'key_vault_properties': {'key': 'keyVaultProperties', 'type': 'KeyVaultProperties'}, + } + + def __init__( + self, + *, + status: Optional[Union[str, "EncryptionStatus"]] = None, + key_vault_properties: Optional["KeyVaultProperties"] = None, + **kwargs + ): + super(EncryptionProperty, self).__init__(**kwargs) + self.status = status + self.key_vault_properties = key_vault_properties + + +class ErrorResponse(msrest.serialization.Model): + """An error response from the Azure Container Registry service. + + :param error: Azure container registry build API error body. + :type error: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ErrorResponseBody + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorResponseBody'}, + } + + def __init__( + self, + *, + error: Optional["ErrorResponseBody"] = None, + **kwargs + ): + super(ErrorResponse, self).__init__(**kwargs) + self.error = error + + +class ErrorResponseBody(msrest.serialization.Model): + """An error response from the Azure Container Registry service. + + All required parameters must be populated in order to send to Azure. + + :param code: Required. error code. + :type code: str + :param message: Required. error message. + :type message: str + :param target: target of the particular error. + :type target: str + :param details: an array of additional nested error response info objects, as described by this + contract. + :type details: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.InnerErrorDescription + """ + + _validation = { + 'code': {'required': True}, + 'message': {'required': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': 'InnerErrorDescription'}, + } + + def __init__( + self, + *, + code: str, + message: str, + target: Optional[str] = None, + details: Optional["InnerErrorDescription"] = None, + **kwargs + ): + super(ErrorResponseBody, self).__init__(**kwargs) + self.code = code + self.message = message + self.target = target + self.details = details + + +class EventInfo(msrest.serialization.Model): + """The basic information of an event. + + :param id: The event ID. + :type id: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + **kwargs + ): + super(EventInfo, self).__init__(**kwargs) + self.id = id + + +class Event(EventInfo): + """The event for a webhook. + + :param id: The event ID. + :type id: str + :param event_request_message: The event request message sent to the service URI. + :type event_request_message: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.EventRequestMessage + :param event_response_message: The event response message received from the service URI. + :type event_response_message: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.EventResponseMessage + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'event_request_message': {'key': 'eventRequestMessage', 'type': 'EventRequestMessage'}, + 'event_response_message': {'key': 'eventResponseMessage', 'type': 'EventResponseMessage'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + event_request_message: Optional["EventRequestMessage"] = None, + event_response_message: Optional["EventResponseMessage"] = None, + **kwargs + ): + super(Event, self).__init__(id=id, **kwargs) + self.event_request_message = event_request_message + self.event_response_message = event_response_message + + +class EventContent(msrest.serialization.Model): + """The content of the event request message. + + :param id: The event ID. + :type id: str + :param timestamp: The time at which the event occurred. + :type timestamp: ~datetime.datetime + :param action: The action that encompasses the provided event. + :type action: str + :param target: The target of the event. + :type target: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.Target + :param request: The request that generated the event. + :type request: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.Request + :param actor: The agent that initiated the event. For most situations, this could be from the + authorization context of the request. + :type actor: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.Actor + :param source: The registry node that generated the event. Put differently, while the actor + initiates the event, the source generates it. + :type source: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.Source + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'timestamp': {'key': 'timestamp', 'type': 'iso-8601'}, + 'action': {'key': 'action', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'Target'}, + 'request': {'key': 'request', 'type': 'Request'}, + 'actor': {'key': 'actor', 'type': 'Actor'}, + 'source': {'key': 'source', 'type': 'Source'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + timestamp: Optional[datetime.datetime] = None, + action: Optional[str] = None, + target: Optional["Target"] = None, + request: Optional["Request"] = None, + actor: Optional["Actor"] = None, + source: Optional["Source"] = None, + **kwargs + ): + super(EventContent, self).__init__(**kwargs) + self.id = id + self.timestamp = timestamp + self.action = action + self.target = target + self.request = request + self.actor = actor + self.source = source + + +class EventListResult(msrest.serialization.Model): + """The result of a request to list events for a webhook. + + :param value: The list of events. Since this list may be incomplete, the nextLink field should + be used to request the next list of events. + :type value: list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.Event] + :param next_link: The URI that can be used to request the next list of events. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Event]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["Event"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(EventListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class EventRequestMessage(msrest.serialization.Model): + """The event request message sent to the service URI. + + :param content: The content of the event request message. + :type content: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.EventContent + :param headers: The headers of the event request message. + :type headers: dict[str, str] + :param method: The HTTP method used to send the event request message. + :type method: str + :param request_uri: The URI used to send the event request message. + :type request_uri: str + :param version: The HTTP message version. + :type version: str + """ + + _attribute_map = { + 'content': {'key': 'content', 'type': 'EventContent'}, + 'headers': {'key': 'headers', 'type': '{str}'}, + 'method': {'key': 'method', 'type': 'str'}, + 'request_uri': {'key': 'requestUri', 'type': 'str'}, + 'version': {'key': 'version', 'type': 'str'}, + } + + def __init__( + self, + *, + content: Optional["EventContent"] = None, + headers: Optional[Dict[str, str]] = None, + method: Optional[str] = None, + request_uri: Optional[str] = None, + version: Optional[str] = None, + **kwargs + ): + super(EventRequestMessage, self).__init__(**kwargs) + self.content = content + self.headers = headers + self.method = method + self.request_uri = request_uri + self.version = version + + +class EventResponseMessage(msrest.serialization.Model): + """The event response message received from the service URI. + + :param content: The content of the event response message. + :type content: str + :param headers: The headers of the event response message. + :type headers: dict[str, str] + :param reason_phrase: The reason phrase of the event response message. + :type reason_phrase: str + :param status_code: The status code of the event response message. + :type status_code: str + :param version: The HTTP message version. + :type version: str + """ + + _attribute_map = { + 'content': {'key': 'content', 'type': 'str'}, + 'headers': {'key': 'headers', 'type': '{str}'}, + 'reason_phrase': {'key': 'reasonPhrase', 'type': 'str'}, + 'status_code': {'key': 'statusCode', 'type': 'str'}, + 'version': {'key': 'version', 'type': 'str'}, + } + + def __init__( + self, + *, + content: Optional[str] = None, + headers: Optional[Dict[str, str]] = None, + reason_phrase: Optional[str] = None, + status_code: Optional[str] = None, + version: Optional[str] = None, + **kwargs + ): + super(EventResponseMessage, self).__init__(**kwargs) + self.content = content + self.headers = headers + self.reason_phrase = reason_phrase + self.status_code = status_code + self.version = version + + +class ExportPipeline(ProxyResource): + """An object that represents an export pipeline for a container registry. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The resource ID. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.SystemData + :param location: The location of the export pipeline. + :type location: str + :param identity: The identity of the export pipeline. + :type identity: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.IdentityProperties + :param target: The target properties of the export pipeline. + :type target: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ExportPipelineTargetProperties + :param options: The list of all options configured for the pipeline. + :type options: list[str or + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PipelineOptions] + :ivar provisioning_state: The provisioning state of the pipeline at the time the operation was + called. Possible values include: "Creating", "Updating", "Deleting", "Succeeded", "Failed", + "Canceled". + :vartype provisioning_state: str or + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ProvisioningState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'location': {'key': 'location', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'IdentityProperties'}, + 'target': {'key': 'properties.target', 'type': 'ExportPipelineTargetProperties'}, + 'options': {'key': 'properties.options', 'type': '[str]'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + identity: Optional["IdentityProperties"] = None, + target: Optional["ExportPipelineTargetProperties"] = None, + options: Optional[List[Union[str, "PipelineOptions"]]] = None, + **kwargs + ): + super(ExportPipeline, self).__init__(**kwargs) + self.location = location + self.identity = identity + self.target = target + self.options = options + self.provisioning_state = None + + +class ExportPipelineListResult(msrest.serialization.Model): + """The result of a request to list export pipelines for a container registry. + + :param value: The list of export pipelines. Since this list may be incomplete, the nextLink + field should be used to request the next list of export pipelines. + :type value: list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.ExportPipeline] + :param next_link: The URI that can be used to request the next list of pipeline runs. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ExportPipeline]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["ExportPipeline"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(ExportPipelineListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ExportPipelineTargetProperties(msrest.serialization.Model): + """The properties of the export pipeline target. + + All required parameters must be populated in order to send to Azure. + + :param type: The type of target for the export pipeline. + :type type: str + :param uri: The target uri of the export pipeline. + When 'AzureStorageBlob': "https://accountName.blob.core.windows.net/containerName/blobName" + When 'AzureStorageBlobContainer': "https://accountName.blob.core.windows.net/containerName". + :type uri: str + :param key_vault_uri: Required. They key vault secret uri to obtain the target storage SAS + token. + :type key_vault_uri: str + """ + + _validation = { + 'key_vault_uri': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'uri': {'key': 'uri', 'type': 'str'}, + 'key_vault_uri': {'key': 'keyVaultUri', 'type': 'str'}, + } + + def __init__( + self, + *, + key_vault_uri: str, + type: Optional[str] = None, + uri: Optional[str] = None, + **kwargs + ): + super(ExportPipelineTargetProperties, self).__init__(**kwargs) + self.type = type + self.uri = uri + self.key_vault_uri = key_vault_uri + + +class ExportPolicy(msrest.serialization.Model): + """The export policy for a container registry. + + :param status: The value that indicates whether the policy is enabled or not. Possible values + include: "enabled", "disabled". Default value: "enabled". + :type status: str or + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ExportPolicyStatus + """ + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + } + + def __init__( + self, + *, + status: Optional[Union[str, "ExportPolicyStatus"]] = "enabled", + **kwargs + ): + super(ExportPolicy, self).__init__(**kwargs) + self.status = status + + +class GenerateCredentialsParameters(msrest.serialization.Model): + """The parameters used to generate credentials for a specified token or user of a container registry. + + :param token_id: The resource ID of the token for which credentials have to be generated. + :type token_id: str + :param expiry: The expiry date of the generated credentials after which the credentials become + invalid. + :type expiry: ~datetime.datetime + :param name: Specifies name of the password which should be regenerated if any -- password1 or + password2. Possible values include: "password1", "password2". + :type name: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.TokenPasswordName + """ + + _attribute_map = { + 'token_id': {'key': 'tokenId', 'type': 'str'}, + 'expiry': {'key': 'expiry', 'type': 'iso-8601'}, + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + *, + token_id: Optional[str] = None, + expiry: Optional[datetime.datetime] = None, + name: Optional[Union[str, "TokenPasswordName"]] = None, + **kwargs + ): + super(GenerateCredentialsParameters, self).__init__(**kwargs) + self.token_id = token_id + self.expiry = expiry + self.name = name + + +class GenerateCredentialsResult(msrest.serialization.Model): + """The response from the GenerateCredentials operation. + + :param username: The username for a container registry. + :type username: str + :param passwords: The list of passwords for a container registry. + :type passwords: list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.TokenPassword] + """ + + _attribute_map = { + 'username': {'key': 'username', 'type': 'str'}, + 'passwords': {'key': 'passwords', 'type': '[TokenPassword]'}, + } + + def __init__( + self, + *, + username: Optional[str] = None, + passwords: Optional[List["TokenPassword"]] = None, + **kwargs + ): + super(GenerateCredentialsResult, self).__init__(**kwargs) + self.username = username + self.passwords = passwords + + +class IdentityProperties(msrest.serialization.Model): + """Managed identity for the resource. + + :param principal_id: The principal ID of resource identity. + :type principal_id: str + :param tenant_id: The tenant ID of resource. + :type tenant_id: str + :param type: The identity type. Possible values include: "SystemAssigned", "UserAssigned", + "SystemAssigned, UserAssigned", "None". + :type type: str or + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ResourceIdentityType + :param user_assigned_identities: The list of user identities associated with the resource. The + user identity + dictionary key references will be ARM resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/ + providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + :type user_assigned_identities: dict[str, + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.UserIdentityProperties] + """ + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{UserIdentityProperties}'}, + } + + def __init__( + self, + *, + principal_id: Optional[str] = None, + tenant_id: Optional[str] = None, + type: Optional[Union[str, "ResourceIdentityType"]] = None, + user_assigned_identities: Optional[Dict[str, "UserIdentityProperties"]] = None, + **kwargs + ): + super(IdentityProperties, self).__init__(**kwargs) + self.principal_id = principal_id + self.tenant_id = tenant_id + self.type = type + self.user_assigned_identities = user_assigned_identities + + +class ImportImageParameters(msrest.serialization.Model): + """ImportImageParameters. + + All required parameters must be populated in order to send to Azure. + + :param source: Required. The source of the image. + :type source: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ImportSource + :param target_tags: List of strings of the form repo[:tag]. When tag is omitted the source will + be used (or 'latest' if source tag is also omitted). + :type target_tags: list[str] + :param untagged_target_repositories: List of strings of repository names to do a manifest only + copy. No tag will be created. + :type untagged_target_repositories: list[str] + :param mode: When Force, any existing target tags will be overwritten. When NoForce, any + existing target tags will fail the operation before any copying begins. Possible values + include: "NoForce", "Force". Default value: "NoForce". + :type mode: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ImportMode + """ + + _validation = { + 'source': {'required': True}, + } + + _attribute_map = { + 'source': {'key': 'source', 'type': 'ImportSource'}, + 'target_tags': {'key': 'targetTags', 'type': '[str]'}, + 'untagged_target_repositories': {'key': 'untaggedTargetRepositories', 'type': '[str]'}, + 'mode': {'key': 'mode', 'type': 'str'}, + } + + def __init__( + self, + *, + source: "ImportSource", + target_tags: Optional[List[str]] = None, + untagged_target_repositories: Optional[List[str]] = None, + mode: Optional[Union[str, "ImportMode"]] = "NoForce", + **kwargs + ): + super(ImportImageParameters, self).__init__(**kwargs) + self.source = source + self.target_tags = target_tags + self.untagged_target_repositories = untagged_target_repositories + self.mode = mode + + +class ImportPipeline(ProxyResource): + """An object that represents an import pipeline for a container registry. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The resource ID. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.SystemData + :param location: The location of the import pipeline. + :type location: str + :param identity: The identity of the import pipeline. + :type identity: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.IdentityProperties + :param source: The source properties of the import pipeline. + :type source: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ImportPipelineSourceProperties + :param trigger: The properties that describe the trigger of the import pipeline. + :type trigger: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PipelineTriggerProperties + :param options: The list of all options configured for the pipeline. + :type options: list[str or + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PipelineOptions] + :ivar provisioning_state: The provisioning state of the pipeline at the time the operation was + called. Possible values include: "Creating", "Updating", "Deleting", "Succeeded", "Failed", + "Canceled". + :vartype provisioning_state: str or + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ProvisioningState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'location': {'key': 'location', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'IdentityProperties'}, + 'source': {'key': 'properties.source', 'type': 'ImportPipelineSourceProperties'}, + 'trigger': {'key': 'properties.trigger', 'type': 'PipelineTriggerProperties'}, + 'options': {'key': 'properties.options', 'type': '[str]'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + identity: Optional["IdentityProperties"] = None, + source: Optional["ImportPipelineSourceProperties"] = None, + trigger: Optional["PipelineTriggerProperties"] = None, + options: Optional[List[Union[str, "PipelineOptions"]]] = None, + **kwargs + ): + super(ImportPipeline, self).__init__(**kwargs) + self.location = location + self.identity = identity + self.source = source + self.trigger = trigger + self.options = options + self.provisioning_state = None + + +class ImportPipelineListResult(msrest.serialization.Model): + """The result of a request to list import pipelines for a container registry. + + :param value: The list of import pipelines. Since this list may be incomplete, the nextLink + field should be used to request the next list of import pipelines. + :type value: list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.ImportPipeline] + :param next_link: The URI that can be used to request the next list of pipeline runs. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ImportPipeline]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["ImportPipeline"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(ImportPipelineListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ImportPipelineSourceProperties(msrest.serialization.Model): + """The properties of the import pipeline source. + + All required parameters must be populated in order to send to Azure. + + :param type: The type of source for the import pipeline. Possible values include: + "AzureStorageBlobContainer". Default value: "AzureStorageBlobContainer". + :type type: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PipelineSourceType + :param uri: The source uri of the import pipeline. + When 'AzureStorageBlob': "https://accountName.blob.core.windows.net/containerName/blobName" + When 'AzureStorageBlobContainer': "https://accountName.blob.core.windows.net/containerName". + :type uri: str + :param key_vault_uri: Required. They key vault secret uri to obtain the source storage SAS + token. + :type key_vault_uri: str + """ + + _validation = { + 'key_vault_uri': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'uri': {'key': 'uri', 'type': 'str'}, + 'key_vault_uri': {'key': 'keyVaultUri', 'type': 'str'}, + } + + def __init__( + self, + *, + key_vault_uri: str, + type: Optional[Union[str, "PipelineSourceType"]] = "AzureStorageBlobContainer", + uri: Optional[str] = None, + **kwargs + ): + super(ImportPipelineSourceProperties, self).__init__(**kwargs) + self.type = type + self.uri = uri + self.key_vault_uri = key_vault_uri + + +class ImportSource(msrest.serialization.Model): + """ImportSource. + + All required parameters must be populated in order to send to Azure. + + :param resource_id: The resource identifier of the source Azure Container Registry. + :type resource_id: str + :param registry_uri: The address of the source registry (e.g. 'mcr.microsoft.com'). + :type registry_uri: str + :param credentials: Credentials used when importing from a registry uri. + :type credentials: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ImportSourceCredentials + :param source_image: Required. Repository name of the source image. + Specify an image by repository ('hello-world'). This will use the 'latest' tag. + Specify an image by tag ('hello-world:latest'). + Specify an image by sha256-based manifest digest ('hello-world@sha256:abc123'). + :type source_image: str + """ + + _validation = { + 'source_image': {'required': True}, + } + + _attribute_map = { + 'resource_id': {'key': 'resourceId', 'type': 'str'}, + 'registry_uri': {'key': 'registryUri', 'type': 'str'}, + 'credentials': {'key': 'credentials', 'type': 'ImportSourceCredentials'}, + 'source_image': {'key': 'sourceImage', 'type': 'str'}, + } + + def __init__( + self, + *, + source_image: str, + resource_id: Optional[str] = None, + registry_uri: Optional[str] = None, + credentials: Optional["ImportSourceCredentials"] = None, + **kwargs + ): + super(ImportSource, self).__init__(**kwargs) + self.resource_id = resource_id + self.registry_uri = registry_uri + self.credentials = credentials + self.source_image = source_image + + +class ImportSourceCredentials(msrest.serialization.Model): + """ImportSourceCredentials. + + All required parameters must be populated in order to send to Azure. + + :param username: The username to authenticate with the source registry. + :type username: str + :param password: Required. The password used to authenticate with the source registry. + :type password: str + """ + + _validation = { + 'password': {'required': True}, + } + + _attribute_map = { + 'username': {'key': 'username', 'type': 'str'}, + 'password': {'key': 'password', 'type': 'str'}, + } + + def __init__( + self, + *, + password: str, + username: Optional[str] = None, + **kwargs + ): + super(ImportSourceCredentials, self).__init__(**kwargs) + self.username = username + self.password = password + + +class InnerErrorDescription(msrest.serialization.Model): + """inner error. + + All required parameters must be populated in order to send to Azure. + + :param code: Required. error code. + :type code: str + :param message: Required. error message. + :type message: str + :param target: target of the particular error. + :type target: str + """ + + _validation = { + 'code': {'required': True}, + 'message': {'required': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + } + + def __init__( + self, + *, + code: str, + message: str, + target: Optional[str] = None, + **kwargs + ): + super(InnerErrorDescription, self).__init__(**kwargs) + self.code = code + self.message = message + self.target = target + + +class IPRule(msrest.serialization.Model): + """IP rule with specific IP or IP range in CIDR format. + + All required parameters must be populated in order to send to Azure. + + :param action: The action of IP ACL rule. Possible values include: "Allow". + :type action: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.Action + :param ip_address_or_range: Required. Specifies the IP or IP range in CIDR format. Only IPV4 + address is allowed. + :type ip_address_or_range: str + """ + + _validation = { + 'ip_address_or_range': {'required': True}, + } + + _attribute_map = { + 'action': {'key': 'action', 'type': 'str'}, + 'ip_address_or_range': {'key': 'value', 'type': 'str'}, + } + + def __init__( + self, + *, + ip_address_or_range: str, + action: Optional[Union[str, "Action"]] = None, + **kwargs + ): + super(IPRule, self).__init__(**kwargs) + self.action = action + self.ip_address_or_range = ip_address_or_range + + +class KeyVaultProperties(msrest.serialization.Model): + """KeyVaultProperties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param key_identifier: Key vault uri to access the encryption key. + :type key_identifier: str + :ivar versioned_key_identifier: The fully qualified key identifier that includes the version of + the key that is actually used for encryption. + :vartype versioned_key_identifier: str + :param identity: The client id of the identity which will be used to access key vault. + :type identity: str + :ivar key_rotation_enabled: Auto key rotation status for a CMK enabled registry. + :vartype key_rotation_enabled: bool + :ivar last_key_rotation_timestamp: Timestamp of the last successful key rotation. + :vartype last_key_rotation_timestamp: ~datetime.datetime + """ + + _validation = { + 'versioned_key_identifier': {'readonly': True}, + 'key_rotation_enabled': {'readonly': True}, + 'last_key_rotation_timestamp': {'readonly': True}, + } + + _attribute_map = { + 'key_identifier': {'key': 'keyIdentifier', 'type': 'str'}, + 'versioned_key_identifier': {'key': 'versionedKeyIdentifier', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'str'}, + 'key_rotation_enabled': {'key': 'keyRotationEnabled', 'type': 'bool'}, + 'last_key_rotation_timestamp': {'key': 'lastKeyRotationTimestamp', 'type': 'iso-8601'}, + } + + def __init__( + self, + *, + key_identifier: Optional[str] = None, + identity: Optional[str] = None, + **kwargs + ): + super(KeyVaultProperties, self).__init__(**kwargs) + self.key_identifier = key_identifier + self.versioned_key_identifier = None + self.identity = identity + self.key_rotation_enabled = None + self.last_key_rotation_timestamp = None + + +class LoggingProperties(msrest.serialization.Model): + """The logging properties of the connected registry. + + :param log_level: The verbosity of logs persisted on the connected registry. Possible values + include: "Debug", "Information", "Warning", "Error", "None". Default value: "Information". + :type log_level: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.LogLevel + :param audit_log_status: Indicates whether audit logs are enabled on the connected registry. + Possible values include: "Enabled", "Disabled". Default value: "Disabled". + :type audit_log_status: str or + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.AuditLogStatus + """ + + _attribute_map = { + 'log_level': {'key': 'logLevel', 'type': 'str'}, + 'audit_log_status': {'key': 'auditLogStatus', 'type': 'str'}, + } + + def __init__( + self, + *, + log_level: Optional[Union[str, "LogLevel"]] = "Information", + audit_log_status: Optional[Union[str, "AuditLogStatus"]] = "Disabled", + **kwargs + ): + super(LoggingProperties, self).__init__(**kwargs) + self.log_level = log_level + self.audit_log_status = audit_log_status + + +class LoginServerProperties(msrest.serialization.Model): + """The login server properties of the connected registry. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar host: The host of the connected registry. Can be FQDN or IP. + :vartype host: str + :ivar tls: The TLS properties of the connected registry login server. + :vartype tls: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.TlsProperties + """ + + _validation = { + 'host': {'readonly': True}, + 'tls': {'readonly': True}, + } + + _attribute_map = { + 'host': {'key': 'host', 'type': 'str'}, + 'tls': {'key': 'tls', 'type': 'TlsProperties'}, + } + + def __init__( + self, + **kwargs + ): + super(LoginServerProperties, self).__init__(**kwargs) + self.host = None + self.tls = None + + +class NetworkRuleSet(msrest.serialization.Model): + """The network rule set for a container registry. + + All required parameters must be populated in order to send to Azure. + + :param default_action: Required. The default action of allow or deny when no other rules match. + Possible values include: "Allow", "Deny". Default value: "Allow". + :type default_action: str or + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.DefaultAction + :param virtual_network_rules: The virtual network rules. + :type virtual_network_rules: + list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.VirtualNetworkRule] + :param ip_rules: The IP ACL rules. + :type ip_rules: list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.IPRule] + """ + + _validation = { + 'default_action': {'required': True}, + } + + _attribute_map = { + 'default_action': {'key': 'defaultAction', 'type': 'str'}, + 'virtual_network_rules': {'key': 'virtualNetworkRules', 'type': '[VirtualNetworkRule]'}, + 'ip_rules': {'key': 'ipRules', 'type': '[IPRule]'}, + } + + def __init__( + self, + *, + default_action: Union[str, "DefaultAction"] = "Allow", + virtual_network_rules: Optional[List["VirtualNetworkRule"]] = None, + ip_rules: Optional[List["IPRule"]] = None, + **kwargs + ): + super(NetworkRuleSet, self).__init__(**kwargs) + self.default_action = default_action + self.virtual_network_rules = virtual_network_rules + self.ip_rules = ip_rules + + +class OperationDefinition(msrest.serialization.Model): + """The definition of a container registry operation. + + :param origin: The origin information of the container registry operation. + :type origin: str + :param name: Operation name: {provider}/{resource}/{operation}. + :type name: str + :param display: The display information for the container registry operation. + :type display: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.OperationDisplayDefinition + :param is_data_action: This property indicates if the operation is an action or a data action + ref: + https://docs.microsoft.com/en-us/azure/role-based-access-control/role-definitions#management-and-data-operations. + :type is_data_action: bool + :param service_specification: The definition of Azure Monitoring service. + :type service_specification: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.OperationServiceSpecificationDefinition + """ + + _attribute_map = { + 'origin': {'key': 'origin', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplayDefinition'}, + 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, + 'service_specification': {'key': 'properties.serviceSpecification', 'type': 'OperationServiceSpecificationDefinition'}, + } + + def __init__( + self, + *, + origin: Optional[str] = None, + name: Optional[str] = None, + display: Optional["OperationDisplayDefinition"] = None, + is_data_action: Optional[bool] = None, + service_specification: Optional["OperationServiceSpecificationDefinition"] = None, + **kwargs + ): + super(OperationDefinition, self).__init__(**kwargs) + self.origin = origin + self.name = name + self.display = display + self.is_data_action = is_data_action + self.service_specification = service_specification + + +class OperationDisplayDefinition(msrest.serialization.Model): + """The display information for a container registry operation. + + :param provider: The resource provider name: Microsoft.ContainerRegistry. + :type provider: str + :param resource: The resource on which the operation is performed. + :type resource: str + :param operation: The operation that users can perform. + :type operation: str + :param description: The description for the operation. + :type description: str + """ + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__( + self, + *, + provider: Optional[str] = None, + resource: Optional[str] = None, + operation: Optional[str] = None, + description: Optional[str] = None, + **kwargs + ): + super(OperationDisplayDefinition, self).__init__(**kwargs) + self.provider = provider + self.resource = resource + self.operation = operation + self.description = description + + +class OperationListResult(msrest.serialization.Model): + """The result of a request to list container registry operations. + + :param value: The list of container registry operations. Since this list may be incomplete, the + nextLink field should be used to request the next list of operations. + :type value: list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.OperationDefinition] + :param next_link: The URI that can be used to request the next list of container registry + operations. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[OperationDefinition]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["OperationDefinition"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(OperationListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class OperationLogSpecificationDefinition(msrest.serialization.Model): + """The definition of Azure Monitoring log. + + :param name: Log name. + :type name: str + :param display_name: Log display name. + :type display_name: str + :param blob_duration: Log blob duration. + :type blob_duration: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'blob_duration': {'key': 'blobDuration', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + display_name: Optional[str] = None, + blob_duration: Optional[str] = None, + **kwargs + ): + super(OperationLogSpecificationDefinition, self).__init__(**kwargs) + self.name = name + self.display_name = display_name + self.blob_duration = blob_duration + + +class OperationMetricSpecificationDefinition(msrest.serialization.Model): + """The definition of Azure Monitoring metric. + + :param name: Metric name. + :type name: str + :param display_name: Metric display name. + :type display_name: str + :param display_description: Metric description. + :type display_description: str + :param unit: Metric unit. + :type unit: str + :param aggregation_type: Metric aggregation type. + :type aggregation_type: str + :param internal_metric_name: Internal metric name. + :type internal_metric_name: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'display_description': {'key': 'displayDescription', 'type': 'str'}, + 'unit': {'key': 'unit', 'type': 'str'}, + 'aggregation_type': {'key': 'aggregationType', 'type': 'str'}, + 'internal_metric_name': {'key': 'internalMetricName', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + display_name: Optional[str] = None, + display_description: Optional[str] = None, + unit: Optional[str] = None, + aggregation_type: Optional[str] = None, + internal_metric_name: Optional[str] = None, + **kwargs + ): + super(OperationMetricSpecificationDefinition, self).__init__(**kwargs) + self.name = name + self.display_name = display_name + self.display_description = display_description + self.unit = unit + self.aggregation_type = aggregation_type + self.internal_metric_name = internal_metric_name + + +class OperationServiceSpecificationDefinition(msrest.serialization.Model): + """The definition of Azure Monitoring list. + + :param metric_specifications: A list of Azure Monitoring metrics definition. + :type metric_specifications: + list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.OperationMetricSpecificationDefinition] + :param log_specifications: A list of Azure Monitoring log definitions. + :type log_specifications: + list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.OperationLogSpecificationDefinition] + """ + + _attribute_map = { + 'metric_specifications': {'key': 'metricSpecifications', 'type': '[OperationMetricSpecificationDefinition]'}, + 'log_specifications': {'key': 'logSpecifications', 'type': '[OperationLogSpecificationDefinition]'}, + } + + def __init__( + self, + *, + metric_specifications: Optional[List["OperationMetricSpecificationDefinition"]] = None, + log_specifications: Optional[List["OperationLogSpecificationDefinition"]] = None, + **kwargs + ): + super(OperationServiceSpecificationDefinition, self).__init__(**kwargs) + self.metric_specifications = metric_specifications + self.log_specifications = log_specifications + + +class ParentProperties(msrest.serialization.Model): + """The properties of the connected registry parent. + + All required parameters must be populated in order to send to Azure. + + :param id: The resource ID of the parent to which the connected registry will be associated. + :type id: str + :param sync_properties: Required. The sync properties of the connected registry with its + parent. + :type sync_properties: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.SyncProperties + """ + + _validation = { + 'sync_properties': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'sync_properties': {'key': 'syncProperties', 'type': 'SyncProperties'}, + } + + def __init__( + self, + *, + sync_properties: "SyncProperties", + id: Optional[str] = None, + **kwargs + ): + super(ParentProperties, self).__init__(**kwargs) + self.id = id + self.sync_properties = sync_properties + + +class PipelineRun(ProxyResource): + """An object that represents a pipeline run for a container registry. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The resource ID. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.SystemData + :ivar provisioning_state: The provisioning state of a pipeline run. Possible values include: + "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled". + :vartype provisioning_state: str or + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ProvisioningState + :param request: The request parameters for a pipeline run. + :type request: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PipelineRunRequest + :ivar response: The response of a pipeline run. + :vartype response: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PipelineRunResponse + :param force_update_tag: How the pipeline run should be forced to recreate even if the pipeline + run configuration has not changed. + :type force_update_tag: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'response': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'request': {'key': 'properties.request', 'type': 'PipelineRunRequest'}, + 'response': {'key': 'properties.response', 'type': 'PipelineRunResponse'}, + 'force_update_tag': {'key': 'properties.forceUpdateTag', 'type': 'str'}, + } + + def __init__( + self, + *, + request: Optional["PipelineRunRequest"] = None, + force_update_tag: Optional[str] = None, + **kwargs + ): + super(PipelineRun, self).__init__(**kwargs) + self.provisioning_state = None + self.request = request + self.response = None + self.force_update_tag = force_update_tag + + +class PipelineRunListResult(msrest.serialization.Model): + """The result of a request to list pipeline runs for a container registry. + + :param value: The list of pipeline runs. Since this list may be incomplete, the nextLink field + should be used to request the next list of pipeline runs. + :type value: list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.PipelineRun] + :param next_link: The URI that can be used to request the next list of pipeline runs. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[PipelineRun]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["PipelineRun"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(PipelineRunListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class PipelineRunRequest(msrest.serialization.Model): + """The request properties provided for a pipeline run. + + :param pipeline_resource_id: The resource ID of the pipeline to run. + :type pipeline_resource_id: str + :param artifacts: List of source artifacts to be transferred by the pipeline. + Specify an image by repository ('hello-world'). This will use the 'latest' tag. + Specify an image by tag ('hello-world:latest'). + Specify an image by sha256-based manifest digest ('hello-world@sha256:abc123'). + :type artifacts: list[str] + :param source: The source properties of the pipeline run. + :type source: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PipelineRunSourceProperties + :param target: The target properties of the pipeline run. + :type target: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PipelineRunTargetProperties + :param catalog_digest: The digest of the tar used to transfer the artifacts. + :type catalog_digest: str + """ + + _attribute_map = { + 'pipeline_resource_id': {'key': 'pipelineResourceId', 'type': 'str'}, + 'artifacts': {'key': 'artifacts', 'type': '[str]'}, + 'source': {'key': 'source', 'type': 'PipelineRunSourceProperties'}, + 'target': {'key': 'target', 'type': 'PipelineRunTargetProperties'}, + 'catalog_digest': {'key': 'catalogDigest', 'type': 'str'}, + } + + def __init__( + self, + *, + pipeline_resource_id: Optional[str] = None, + artifacts: Optional[List[str]] = None, + source: Optional["PipelineRunSourceProperties"] = None, + target: Optional["PipelineRunTargetProperties"] = None, + catalog_digest: Optional[str] = None, + **kwargs + ): + super(PipelineRunRequest, self).__init__(**kwargs) + self.pipeline_resource_id = pipeline_resource_id + self.artifacts = artifacts + self.source = source + self.target = target + self.catalog_digest = catalog_digest + + +class PipelineRunResponse(msrest.serialization.Model): + """The response properties returned for a pipeline run. + + :param status: The current status of the pipeline run. + :type status: str + :param imported_artifacts: The artifacts imported in the pipeline run. + :type imported_artifacts: list[str] + :param progress: The current progress of the copy operation. + :type progress: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ProgressProperties + :param start_time: The time the pipeline run started. + :type start_time: ~datetime.datetime + :param finish_time: The time the pipeline run finished. + :type finish_time: ~datetime.datetime + :param source: The source of the pipeline run. + :type source: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ImportPipelineSourceProperties + :param target: The target of the pipeline run. + :type target: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ExportPipelineTargetProperties + :param catalog_digest: The digest of the tar used to transfer the artifacts. + :type catalog_digest: str + :param trigger: The trigger that caused the pipeline run. + :type trigger: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PipelineTriggerDescriptor + :param pipeline_run_error_message: The detailed error message for the pipeline run in the case + of failure. + :type pipeline_run_error_message: str + """ + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + 'imported_artifacts': {'key': 'importedArtifacts', 'type': '[str]'}, + 'progress': {'key': 'progress', 'type': 'ProgressProperties'}, + 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, + 'finish_time': {'key': 'finishTime', 'type': 'iso-8601'}, + 'source': {'key': 'source', 'type': 'ImportPipelineSourceProperties'}, + 'target': {'key': 'target', 'type': 'ExportPipelineTargetProperties'}, + 'catalog_digest': {'key': 'catalogDigest', 'type': 'str'}, + 'trigger': {'key': 'trigger', 'type': 'PipelineTriggerDescriptor'}, + 'pipeline_run_error_message': {'key': 'pipelineRunErrorMessage', 'type': 'str'}, + } + + def __init__( + self, + *, + status: Optional[str] = None, + imported_artifacts: Optional[List[str]] = None, + progress: Optional["ProgressProperties"] = None, + start_time: Optional[datetime.datetime] = None, + finish_time: Optional[datetime.datetime] = None, + source: Optional["ImportPipelineSourceProperties"] = None, + target: Optional["ExportPipelineTargetProperties"] = None, + catalog_digest: Optional[str] = None, + trigger: Optional["PipelineTriggerDescriptor"] = None, + pipeline_run_error_message: Optional[str] = None, + **kwargs + ): + super(PipelineRunResponse, self).__init__(**kwargs) + self.status = status + self.imported_artifacts = imported_artifacts + self.progress = progress + self.start_time = start_time + self.finish_time = finish_time + self.source = source + self.target = target + self.catalog_digest = catalog_digest + self.trigger = trigger + self.pipeline_run_error_message = pipeline_run_error_message + + +class PipelineRunSourceProperties(msrest.serialization.Model): + """PipelineRunSourceProperties. + + :param type: The type of the source. Possible values include: "AzureStorageBlob". Default + value: "AzureStorageBlob". + :type type: str or + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PipelineRunSourceType + :param name: The name of the source. + :type name: str + """ + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + *, + type: Optional[Union[str, "PipelineRunSourceType"]] = "AzureStorageBlob", + name: Optional[str] = None, + **kwargs + ): + super(PipelineRunSourceProperties, self).__init__(**kwargs) + self.type = type + self.name = name + + +class PipelineRunTargetProperties(msrest.serialization.Model): + """PipelineRunTargetProperties. + + :param type: The type of the target. Possible values include: "AzureStorageBlob". Default + value: "AzureStorageBlob". + :type type: str or + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PipelineRunTargetType + :param name: The name of the target. + :type name: str + """ + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + *, + type: Optional[Union[str, "PipelineRunTargetType"]] = "AzureStorageBlob", + name: Optional[str] = None, + **kwargs + ): + super(PipelineRunTargetProperties, self).__init__(**kwargs) + self.type = type + self.name = name + + +class PipelineSourceTriggerDescriptor(msrest.serialization.Model): + """PipelineSourceTriggerDescriptor. + + :param timestamp: The timestamp when the source update happened. + :type timestamp: ~datetime.datetime + """ + + _attribute_map = { + 'timestamp': {'key': 'timestamp', 'type': 'iso-8601'}, + } + + def __init__( + self, + *, + timestamp: Optional[datetime.datetime] = None, + **kwargs + ): + super(PipelineSourceTriggerDescriptor, self).__init__(**kwargs) + self.timestamp = timestamp + + +class PipelineSourceTriggerProperties(msrest.serialization.Model): + """PipelineSourceTriggerProperties. + + All required parameters must be populated in order to send to Azure. + + :param status: Required. The current status of the source trigger. Possible values include: + "Enabled", "Disabled". Default value: "Enabled". + :type status: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.TriggerStatus + """ + + _validation = { + 'status': {'required': True}, + } + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + } + + def __init__( + self, + *, + status: Union[str, "TriggerStatus"] = "Enabled", + **kwargs + ): + super(PipelineSourceTriggerProperties, self).__init__(**kwargs) + self.status = status + + +class PipelineTriggerDescriptor(msrest.serialization.Model): + """PipelineTriggerDescriptor. + + :param source_trigger: The source trigger that caused the pipeline run. + :type source_trigger: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PipelineSourceTriggerDescriptor + """ + + _attribute_map = { + 'source_trigger': {'key': 'sourceTrigger', 'type': 'PipelineSourceTriggerDescriptor'}, + } + + def __init__( + self, + *, + source_trigger: Optional["PipelineSourceTriggerDescriptor"] = None, + **kwargs + ): + super(PipelineTriggerDescriptor, self).__init__(**kwargs) + self.source_trigger = source_trigger + + +class PipelineTriggerProperties(msrest.serialization.Model): + """PipelineTriggerProperties. + + :param source_trigger: The source trigger properties of the pipeline. + :type source_trigger: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PipelineSourceTriggerProperties + """ + + _attribute_map = { + 'source_trigger': {'key': 'sourceTrigger', 'type': 'PipelineSourceTriggerProperties'}, + } + + def __init__( + self, + *, + source_trigger: Optional["PipelineSourceTriggerProperties"] = None, + **kwargs + ): + super(PipelineTriggerProperties, self).__init__(**kwargs) + self.source_trigger = source_trigger + + +class Policies(msrest.serialization.Model): + """The policies for a container registry. + + :param quarantine_policy: The quarantine policy for a container registry. + :type quarantine_policy: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.QuarantinePolicy + :param trust_policy: The content trust policy for a container registry. + :type trust_policy: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.TrustPolicy + :param retention_policy: The retention policy for a container registry. + :type retention_policy: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.RetentionPolicy + :param export_policy: The export policy for a container registry. + :type export_policy: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ExportPolicy + """ + + _attribute_map = { + 'quarantine_policy': {'key': 'quarantinePolicy', 'type': 'QuarantinePolicy'}, + 'trust_policy': {'key': 'trustPolicy', 'type': 'TrustPolicy'}, + 'retention_policy': {'key': 'retentionPolicy', 'type': 'RetentionPolicy'}, + 'export_policy': {'key': 'exportPolicy', 'type': 'ExportPolicy'}, + } + + def __init__( + self, + *, + quarantine_policy: Optional["QuarantinePolicy"] = None, + trust_policy: Optional["TrustPolicy"] = None, + retention_policy: Optional["RetentionPolicy"] = None, + export_policy: Optional["ExportPolicy"] = None, + **kwargs + ): + super(Policies, self).__init__(**kwargs) + self.quarantine_policy = quarantine_policy + self.trust_policy = trust_policy + self.retention_policy = retention_policy + self.export_policy = export_policy + + +class PrivateEndpoint(msrest.serialization.Model): + """The Private Endpoint resource. + + :param id: This is private endpoint resource created with Microsoft.Network resource provider. + :type id: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + **kwargs + ): + super(PrivateEndpoint, self).__init__(**kwargs) + self.id = id + + +class PrivateEndpointConnection(ProxyResource): + """An object that represents a private endpoint connection for a container registry. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The resource ID. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.SystemData + :param private_endpoint: The resource of private endpoint. + :type private_endpoint: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PrivateEndpoint + :param private_link_service_connection_state: A collection of information about the state of + the connection between service consumer and provider. + :type private_link_service_connection_state: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PrivateLinkServiceConnectionState + :ivar provisioning_state: The provisioning state of private endpoint connection resource. + Possible values include: "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled". + :vartype provisioning_state: str or + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ProvisioningState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, + 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + *, + private_endpoint: Optional["PrivateEndpoint"] = None, + private_link_service_connection_state: Optional["PrivateLinkServiceConnectionState"] = None, + **kwargs + ): + super(PrivateEndpointConnection, self).__init__(**kwargs) + self.private_endpoint = private_endpoint + self.private_link_service_connection_state = private_link_service_connection_state + self.provisioning_state = None + + +class PrivateEndpointConnectionListResult(msrest.serialization.Model): + """The result of a request to list private endpoint connections for a container registry. + + :param value: The list of private endpoint connections. Since this list may be incomplete, the + nextLink field should be used to request the next list of private endpoint connections. + :type value: + list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.PrivateEndpointConnection] + :param next_link: The URI that can be used to request the next list of private endpoint + connections. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[PrivateEndpointConnection]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["PrivateEndpointConnection"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(PrivateEndpointConnectionListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class PrivateLinkResource(msrest.serialization.Model): + """A resource that supports private link capabilities. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The resource type is private link resource. + :vartype type: str + :param id: The resource ID. + :type id: str + :param name: The name of the resource. + :type name: str + :param group_id: The private link resource group id. + :type group_id: str + :param required_members: The private link resource required member names. + :type required_members: list[str] + :param required_zone_names: The private link resource Private link DNS zone name. + :type required_zone_names: list[str] + """ + + _validation = { + 'type': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'group_id': {'key': 'properties.groupId', 'type': 'str'}, + 'required_members': {'key': 'properties.requiredMembers', 'type': '[str]'}, + 'required_zone_names': {'key': 'properties.requiredZoneNames', 'type': '[str]'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + name: Optional[str] = None, + group_id: Optional[str] = None, + required_members: Optional[List[str]] = None, + required_zone_names: Optional[List[str]] = None, + **kwargs + ): + super(PrivateLinkResource, self).__init__(**kwargs) + self.type = None + self.id = id + self.name = name + self.group_id = group_id + self.required_members = required_members + self.required_zone_names = required_zone_names + + +class PrivateLinkResourceListResult(msrest.serialization.Model): + """The result of a request to list private link resources for a container registry. + + :param value: The list of private link resources. Since this list may be incomplete, the + nextLink field should be used to request the next list of private link resources. + :type value: list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.PrivateLinkResource] + :param next_link: The URI that can be used to request the next list of private link resources. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[PrivateLinkResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["PrivateLinkResource"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(PrivateLinkResourceListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class PrivateLinkServiceConnectionState(msrest.serialization.Model): + """The state of a private link service connection. + + :param status: The private link service connection status. Possible values include: "Approved", + "Pending", "Rejected", "Disconnected". + :type status: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ConnectionStatus + :param description: The description for connection status. For example if connection is + rejected it can indicate reason for rejection. + :type description: str + :param actions_required: A message indicating if changes on the service provider require any + updates on the consumer. Possible values include: "None", "Recreate". + :type actions_required: str or + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ActionsRequired + """ + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'actions_required': {'key': 'actionsRequired', 'type': 'str'}, + } + + def __init__( + self, + *, + status: Optional[Union[str, "ConnectionStatus"]] = None, + description: Optional[str] = None, + actions_required: Optional[Union[str, "ActionsRequired"]] = None, + **kwargs + ): + super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) + self.status = status + self.description = description + self.actions_required = actions_required + + +class ProgressProperties(msrest.serialization.Model): + """ProgressProperties. + + :param percentage: The percentage complete of the copy operation. + :type percentage: str + """ + + _attribute_map = { + 'percentage': {'key': 'percentage', 'type': 'str'}, + } + + def __init__( + self, + *, + percentage: Optional[str] = None, + **kwargs + ): + super(ProgressProperties, self).__init__(**kwargs) + self.percentage = percentage + + +class QuarantinePolicy(msrest.serialization.Model): + """The quarantine policy for a container registry. + + :param status: The value that indicates whether the policy is enabled or not. Possible values + include: "enabled", "disabled". + :type status: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PolicyStatus + """ + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + } + + def __init__( + self, + *, + status: Optional[Union[str, "PolicyStatus"]] = None, + **kwargs + ): + super(QuarantinePolicy, self).__init__(**kwargs) + self.status = status + + +class RegenerateCredentialParameters(msrest.serialization.Model): + """The parameters used to regenerate the login credential. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. Specifies name of the password which should be regenerated -- password + or password2. Possible values include: "password", "password2". + :type name: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PasswordName + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Union[str, "PasswordName"], + **kwargs + ): + super(RegenerateCredentialParameters, self).__init__(**kwargs) + self.name = name + + +class Resource(msrest.serialization.Model): + """An Azure resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The resource ID. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :param location: Required. The location of the resource. This cannot be changed after the + resource is created. + :type location: str + :param tags: A set of tags. The tags of the resource. + :type tags: dict[str, str] + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.SystemData + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = location + self.tags = tags + self.system_data = None + + +class Registry(Resource): + """An object that represents a container registry. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The resource ID. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :param location: Required. The location of the resource. This cannot be changed after the + resource is created. + :type location: str + :param tags: A set of tags. The tags of the resource. + :type tags: dict[str, str] + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.SystemData + :param sku: Required. The SKU of the container registry. + :type sku: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.Sku + :param identity: The identity of the container registry. + :type identity: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.IdentityProperties + :ivar login_server: The URL that can be used to log into the container registry. + :vartype login_server: str + :ivar creation_date: The creation date of the container registry in ISO8601 format. + :vartype creation_date: ~datetime.datetime + :ivar provisioning_state: The provisioning state of the container registry at the time the + operation was called. Possible values include: "Creating", "Updating", "Deleting", "Succeeded", + "Failed", "Canceled". + :vartype provisioning_state: str or + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ProvisioningState + :ivar status: The status of the container registry at the time the operation was called. + :vartype status: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.Status + :param admin_user_enabled: The value that indicates whether the admin user is enabled. + :type admin_user_enabled: bool + :param network_rule_set: The network rule set for a container registry. + :type network_rule_set: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.NetworkRuleSet + :param policies: The policies for a container registry. + :type policies: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.Policies + :param encryption: The encryption settings of container registry. + :type encryption: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.EncryptionProperty + :param data_endpoint_enabled: Enable a single data endpoint per region for serving data. + :type data_endpoint_enabled: bool + :ivar data_endpoint_host_names: List of host names that will serve data when + dataEndpointEnabled is true. + :vartype data_endpoint_host_names: list[str] + :ivar private_endpoint_connections: List of private endpoint connections for a container + registry. + :vartype private_endpoint_connections: + list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.PrivateEndpointConnection] + :param public_network_access: Whether or not public network access is allowed for the container + registry. Possible values include: "Enabled", "Disabled". + :type public_network_access: str or + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PublicNetworkAccess + :param network_rule_bypass_options: Whether to allow trusted Azure services to access a network + restricted registry. Possible values include: "AzureServices", "None". + :type network_rule_bypass_options: str or + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.NetworkRuleBypassOptions + :param zone_redundancy: Whether or not zone redundancy is enabled for this container registry. + Possible values include: "Enabled", "Disabled". + :type zone_redundancy: str or + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ZoneRedundancy + :param anonymous_pull_enabled: Enables registry-wide pull from unauthenticated clients. + :type anonymous_pull_enabled: bool + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'system_data': {'readonly': True}, + 'sku': {'required': True}, + 'login_server': {'readonly': True}, + 'creation_date': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'status': {'readonly': True}, + 'data_endpoint_host_names': {'readonly': True}, + 'private_endpoint_connections': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'identity': {'key': 'identity', 'type': 'IdentityProperties'}, + 'login_server': {'key': 'properties.loginServer', 'type': 'str'}, + 'creation_date': {'key': 'properties.creationDate', 'type': 'iso-8601'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'Status'}, + 'admin_user_enabled': {'key': 'properties.adminUserEnabled', 'type': 'bool'}, + 'network_rule_set': {'key': 'properties.networkRuleSet', 'type': 'NetworkRuleSet'}, + 'policies': {'key': 'properties.policies', 'type': 'Policies'}, + 'encryption': {'key': 'properties.encryption', 'type': 'EncryptionProperty'}, + 'data_endpoint_enabled': {'key': 'properties.dataEndpointEnabled', 'type': 'bool'}, + 'data_endpoint_host_names': {'key': 'properties.dataEndpointHostNames', 'type': '[str]'}, + 'private_endpoint_connections': {'key': 'properties.privateEndpointConnections', 'type': '[PrivateEndpointConnection]'}, + 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, + 'network_rule_bypass_options': {'key': 'properties.networkRuleBypassOptions', 'type': 'str'}, + 'zone_redundancy': {'key': 'properties.zoneRedundancy', 'type': 'str'}, + 'anonymous_pull_enabled': {'key': 'properties.anonymousPullEnabled', 'type': 'bool'}, + } + + def __init__( + self, + *, + location: str, + sku: "Sku", + tags: Optional[Dict[str, str]] = None, + identity: Optional["IdentityProperties"] = None, + admin_user_enabled: Optional[bool] = False, + network_rule_set: Optional["NetworkRuleSet"] = None, + policies: Optional["Policies"] = None, + encryption: Optional["EncryptionProperty"] = None, + data_endpoint_enabled: Optional[bool] = None, + public_network_access: Optional[Union[str, "PublicNetworkAccess"]] = None, + network_rule_bypass_options: Optional[Union[str, "NetworkRuleBypassOptions"]] = None, + zone_redundancy: Optional[Union[str, "ZoneRedundancy"]] = None, + anonymous_pull_enabled: Optional[bool] = False, + **kwargs + ): + super(Registry, self).__init__(location=location, tags=tags, **kwargs) + self.sku = sku + self.identity = identity + self.login_server = None + self.creation_date = None + self.provisioning_state = None + self.status = None + self.admin_user_enabled = admin_user_enabled + self.network_rule_set = network_rule_set + self.policies = policies + self.encryption = encryption + self.data_endpoint_enabled = data_endpoint_enabled + self.data_endpoint_host_names = None + self.private_endpoint_connections = None + self.public_network_access = public_network_access + self.network_rule_bypass_options = network_rule_bypass_options + self.zone_redundancy = zone_redundancy + self.anonymous_pull_enabled = anonymous_pull_enabled + + +class RegistryListCredentialsResult(msrest.serialization.Model): + """The response from the ListCredentials operation. + + :param username: The username for a container registry. + :type username: str + :param passwords: The list of passwords for a container registry. + :type passwords: + list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.RegistryPassword] + """ + + _attribute_map = { + 'username': {'key': 'username', 'type': 'str'}, + 'passwords': {'key': 'passwords', 'type': '[RegistryPassword]'}, + } + + def __init__( + self, + *, + username: Optional[str] = None, + passwords: Optional[List["RegistryPassword"]] = None, + **kwargs + ): + super(RegistryListCredentialsResult, self).__init__(**kwargs) + self.username = username + self.passwords = passwords + + +class RegistryListResult(msrest.serialization.Model): + """The result of a request to list container registries. + + :param value: The list of container registries. Since this list may be incomplete, the nextLink + field should be used to request the next list of container registries. + :type value: list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.Registry] + :param next_link: The URI that can be used to request the next list of container registries. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Registry]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["Registry"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(RegistryListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class RegistryNameCheckRequest(msrest.serialization.Model): + """A request to check whether a container registry name is available. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the container registry. + :type name: str + :ivar type: The resource type of the container registry. This field must be set to + 'Microsoft.ContainerRegistry/registries'. Has constant value: + "Microsoft.ContainerRegistry/registries". + :vartype type: str + """ + + _validation = { + 'name': {'required': True, 'max_length': 50, 'min_length': 5, 'pattern': r'^[a-zA-Z0-9]*$'}, + 'type': {'required': True, 'constant': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + type = "Microsoft.ContainerRegistry/registries" + + def __init__( + self, + *, + name: str, + **kwargs + ): + super(RegistryNameCheckRequest, self).__init__(**kwargs) + self.name = name + + +class RegistryNameStatus(msrest.serialization.Model): + """The result of a request to check the availability of a container registry name. + + :param name_available: The value that indicates whether the name is available. + :type name_available: bool + :param reason: If any, the reason that the name is not available. + :type reason: str + :param message: If any, the error message that provides more detail for the reason that the + name is not available. + :type message: str + """ + + _attribute_map = { + 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, + 'reason': {'key': 'reason', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__( + self, + *, + name_available: Optional[bool] = None, + reason: Optional[str] = None, + message: Optional[str] = None, + **kwargs + ): + super(RegistryNameStatus, self).__init__(**kwargs) + self.name_available = name_available + self.reason = reason + self.message = message + + +class RegistryPassword(msrest.serialization.Model): + """The login password for the container registry. + + :param name: The password name. Possible values include: "password", "password2". + :type name: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PasswordName + :param value: The password value. + :type value: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[Union[str, "PasswordName"]] = None, + value: Optional[str] = None, + **kwargs + ): + super(RegistryPassword, self).__init__(**kwargs) + self.name = name + self.value = value + + +class RegistryUpdateParameters(msrest.serialization.Model): + """The parameters for updating a container registry. + + :param identity: The identity of the container registry. + :type identity: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.IdentityProperties + :param tags: A set of tags. The tags for the container registry. + :type tags: dict[str, str] + :param sku: The SKU of the container registry. + :type sku: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.Sku + :param admin_user_enabled: The value that indicates whether the admin user is enabled. + :type admin_user_enabled: bool + :param network_rule_set: The network rule set for a container registry. + :type network_rule_set: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.NetworkRuleSet + :param policies: The policies for a container registry. + :type policies: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.Policies + :param encryption: The encryption settings of container registry. + :type encryption: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.EncryptionProperty + :param data_endpoint_enabled: Enable a single data endpoint per region for serving data. + :type data_endpoint_enabled: bool + :param public_network_access: Whether or not public network access is allowed for the container + registry. Possible values include: "Enabled", "Disabled". + :type public_network_access: str or + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PublicNetworkAccess + :param network_rule_bypass_options: Whether to allow trusted Azure services to access a network + restricted registry. Possible values include: "AzureServices", "None". + :type network_rule_bypass_options: str or + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.NetworkRuleBypassOptions + :param anonymous_pull_enabled: Enables registry-wide pull from unauthenticated clients. + :type anonymous_pull_enabled: bool + """ + + _attribute_map = { + 'identity': {'key': 'identity', 'type': 'IdentityProperties'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'admin_user_enabled': {'key': 'properties.adminUserEnabled', 'type': 'bool'}, + 'network_rule_set': {'key': 'properties.networkRuleSet', 'type': 'NetworkRuleSet'}, + 'policies': {'key': 'properties.policies', 'type': 'Policies'}, + 'encryption': {'key': 'properties.encryption', 'type': 'EncryptionProperty'}, + 'data_endpoint_enabled': {'key': 'properties.dataEndpointEnabled', 'type': 'bool'}, + 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, + 'network_rule_bypass_options': {'key': 'properties.networkRuleBypassOptions', 'type': 'str'}, + 'anonymous_pull_enabled': {'key': 'properties.anonymousPullEnabled', 'type': 'bool'}, + } + + def __init__( + self, + *, + identity: Optional["IdentityProperties"] = None, + tags: Optional[Dict[str, str]] = None, + sku: Optional["Sku"] = None, + admin_user_enabled: Optional[bool] = None, + network_rule_set: Optional["NetworkRuleSet"] = None, + policies: Optional["Policies"] = None, + encryption: Optional["EncryptionProperty"] = None, + data_endpoint_enabled: Optional[bool] = None, + public_network_access: Optional[Union[str, "PublicNetworkAccess"]] = None, + network_rule_bypass_options: Optional[Union[str, "NetworkRuleBypassOptions"]] = None, + anonymous_pull_enabled: Optional[bool] = None, + **kwargs + ): + super(RegistryUpdateParameters, self).__init__(**kwargs) + self.identity = identity + self.tags = tags + self.sku = sku + self.admin_user_enabled = admin_user_enabled + self.network_rule_set = network_rule_set + self.policies = policies + self.encryption = encryption + self.data_endpoint_enabled = data_endpoint_enabled + self.public_network_access = public_network_access + self.network_rule_bypass_options = network_rule_bypass_options + self.anonymous_pull_enabled = anonymous_pull_enabled + + +class RegistryUsage(msrest.serialization.Model): + """The quota usage for a container registry. + + :param name: The name of the usage. + :type name: str + :param limit: The limit of the usage. + :type limit: long + :param current_value: The current value of the usage. + :type current_value: long + :param unit: The unit of measurement. Possible values include: "Count", "Bytes". + :type unit: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.RegistryUsageUnit + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'limit': {'key': 'limit', 'type': 'long'}, + 'current_value': {'key': 'currentValue', 'type': 'long'}, + 'unit': {'key': 'unit', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + limit: Optional[int] = None, + current_value: Optional[int] = None, + unit: Optional[Union[str, "RegistryUsageUnit"]] = None, + **kwargs + ): + super(RegistryUsage, self).__init__(**kwargs) + self.name = name + self.limit = limit + self.current_value = current_value + self.unit = unit + + +class RegistryUsageListResult(msrest.serialization.Model): + """The result of a request to get container registry quota usages. + + :param value: The list of container registry quota usages. + :type value: list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.RegistryUsage] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[RegistryUsage]'}, + } + + def __init__( + self, + *, + value: Optional[List["RegistryUsage"]] = None, + **kwargs + ): + super(RegistryUsageListResult, self).__init__(**kwargs) + self.value = value + + +class Replication(Resource): + """An object that represents a replication for a container registry. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The resource ID. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :param location: Required. The location of the resource. This cannot be changed after the + resource is created. + :type location: str + :param tags: A set of tags. The tags of the resource. + :type tags: dict[str, str] + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.SystemData + :ivar provisioning_state: The provisioning state of the replication at the time the operation + was called. Possible values include: "Creating", "Updating", "Deleting", "Succeeded", "Failed", + "Canceled". + :vartype provisioning_state: str or + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ProvisioningState + :ivar status: The status of the replication at the time the operation was called. + :vartype status: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.Status + :param region_endpoint_enabled: Specifies whether the replication's regional endpoint is + enabled. Requests will not be routed to a replication whose regional endpoint is disabled, + however its data will continue to be synced with other replications. + :type region_endpoint_enabled: bool + :param zone_redundancy: Whether or not zone redundancy is enabled for this container registry + replication. Possible values include: "Enabled", "Disabled". + :type zone_redundancy: str or + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ZoneRedundancy + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'system_data': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'status': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'Status'}, + 'region_endpoint_enabled': {'key': 'properties.regionEndpointEnabled', 'type': 'bool'}, + 'zone_redundancy': {'key': 'properties.zoneRedundancy', 'type': 'str'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + region_endpoint_enabled: Optional[bool] = True, + zone_redundancy: Optional[Union[str, "ZoneRedundancy"]] = None, + **kwargs + ): + super(Replication, self).__init__(location=location, tags=tags, **kwargs) + self.provisioning_state = None + self.status = None + self.region_endpoint_enabled = region_endpoint_enabled + self.zone_redundancy = zone_redundancy + + +class ReplicationListResult(msrest.serialization.Model): + """The result of a request to list replications for a container registry. + + :param value: The list of replications. Since this list may be incomplete, the nextLink field + should be used to request the next list of replications. + :type value: list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.Replication] + :param next_link: The URI that can be used to request the next list of replications. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Replication]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["Replication"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(ReplicationListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ReplicationUpdateParameters(msrest.serialization.Model): + """The parameters for updating a replication. + + :param tags: A set of tags. The tags for the replication. + :type tags: dict[str, str] + :param region_endpoint_enabled: Specifies whether the replication's regional endpoint is + enabled. Requests will not be routed to a replication whose regional endpoint is disabled, + however its data will continue to be synced with other replications. + :type region_endpoint_enabled: bool + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'region_endpoint_enabled': {'key': 'properties.regionEndpointEnabled', 'type': 'bool'}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + region_endpoint_enabled: Optional[bool] = None, + **kwargs + ): + super(ReplicationUpdateParameters, self).__init__(**kwargs) + self.tags = tags + self.region_endpoint_enabled = region_endpoint_enabled + + +class Request(msrest.serialization.Model): + """The request that generated the event. + + :param id: The ID of the request that initiated the event. + :type id: str + :param addr: The IP or hostname and possibly port of the client connection that initiated the + event. This is the RemoteAddr from the standard http request. + :type addr: str + :param host: The externally accessible hostname of the registry instance, as specified by the + http host header on incoming requests. + :type host: str + :param method: The request method that generated the event. + :type method: str + :param useragent: The user agent header of the request. + :type useragent: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'addr': {'key': 'addr', 'type': 'str'}, + 'host': {'key': 'host', 'type': 'str'}, + 'method': {'key': 'method', 'type': 'str'}, + 'useragent': {'key': 'useragent', 'type': 'str'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + addr: Optional[str] = None, + host: Optional[str] = None, + method: Optional[str] = None, + useragent: Optional[str] = None, + **kwargs + ): + super(Request, self).__init__(**kwargs) + self.id = id + self.addr = addr + self.host = host + self.method = method + self.useragent = useragent + + +class RetentionPolicy(msrest.serialization.Model): + """The retention policy for a container registry. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param days: The number of days to retain an untagged manifest after which it gets purged. + :type days: int + :ivar last_updated_time: The timestamp when the policy was last updated. + :vartype last_updated_time: ~datetime.datetime + :param status: The value that indicates whether the policy is enabled or not. Possible values + include: "enabled", "disabled". + :type status: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PolicyStatus + """ + + _validation = { + 'last_updated_time': {'readonly': True}, + } + + _attribute_map = { + 'days': {'key': 'days', 'type': 'int'}, + 'last_updated_time': {'key': 'lastUpdatedTime', 'type': 'iso-8601'}, + 'status': {'key': 'status', 'type': 'str'}, + } + + def __init__( + self, + *, + days: Optional[int] = 7, + status: Optional[Union[str, "PolicyStatus"]] = None, + **kwargs + ): + super(RetentionPolicy, self).__init__(**kwargs) + self.days = days + self.last_updated_time = None + self.status = status + + +class ScopeMap(ProxyResource): + """An object that represents a scope map for a container registry. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The resource ID. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.SystemData + :param description: The user friendly description of the scope map. + :type description: str + :ivar type_properties_type: The type of the scope map. E.g. BuildIn scope map. + :vartype type_properties_type: str + :ivar creation_date: The creation date of scope map. + :vartype creation_date: ~datetime.datetime + :ivar provisioning_state: Provisioning state of the resource. Possible values include: + "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled". + :vartype provisioning_state: str or + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ProvisioningState + :param actions: The list of scoped permissions for registry artifacts. + E.g. repositories/repository-name/content/read, + repositories/repository-name/metadata/write. + :type actions: list[str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'type_properties_type': {'readonly': True}, + 'creation_date': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'type_properties_type': {'key': 'properties.type', 'type': 'str'}, + 'creation_date': {'key': 'properties.creationDate', 'type': 'iso-8601'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'actions': {'key': 'properties.actions', 'type': '[str]'}, + } + + def __init__( + self, + *, + description: Optional[str] = None, + actions: Optional[List[str]] = None, + **kwargs + ): + super(ScopeMap, self).__init__(**kwargs) + self.description = description + self.type_properties_type = None + self.creation_date = None + self.provisioning_state = None + self.actions = actions + + +class ScopeMapListResult(msrest.serialization.Model): + """The result of a request to list scope maps for a container registry. + + :param value: The list of scope maps. Since this list may be incomplete, the nextLink field + should be used to request the next list of scope maps. + :type value: list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.ScopeMap] + :param next_link: The URI that can be used to request the next list of scope maps. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ScopeMap]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["ScopeMap"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(ScopeMapListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ScopeMapUpdateParameters(msrest.serialization.Model): + """The properties for updating the scope map. + + :param description: The user friendly description of the scope map. + :type description: str + :param actions: The list of scope permissions for registry artifacts. + E.g. repositories/repository-name/pull, + repositories/repository-name/delete. + :type actions: list[str] + """ + + _attribute_map = { + 'description': {'key': 'properties.description', 'type': 'str'}, + 'actions': {'key': 'properties.actions', 'type': '[str]'}, + } + + def __init__( + self, + *, + description: Optional[str] = None, + actions: Optional[List[str]] = None, + **kwargs + ): + super(ScopeMapUpdateParameters, self).__init__(**kwargs) + self.description = description + self.actions = actions + + +class Sku(msrest.serialization.Model): + """The SKU of a container registry. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The SKU name of the container registry. Required for registry creation. + Possible values include: "Classic", "Basic", "Standard", "Premium". + :type name: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.SkuName + :ivar tier: The SKU tier based on the SKU name. Possible values include: "Classic", "Basic", + "Standard", "Premium". + :vartype tier: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.SkuTier + """ + + _validation = { + 'name': {'required': True}, + 'tier': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'tier': {'key': 'tier', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Union[str, "SkuName"], + **kwargs + ): + super(Sku, self).__init__(**kwargs) + self.name = name + self.tier = None + + +class Source(msrest.serialization.Model): + """The registry node that generated the event. Put differently, while the actor initiates the event, the source generates it. + + :param addr: The IP or hostname and the port of the registry node that generated the event. + Generally, this will be resolved by os.Hostname() along with the running port. + :type addr: str + :param instance_id: The running instance of an application. Changes after each restart. + :type instance_id: str + """ + + _attribute_map = { + 'addr': {'key': 'addr', 'type': 'str'}, + 'instance_id': {'key': 'instanceID', 'type': 'str'}, + } + + def __init__( + self, + *, + addr: Optional[str] = None, + instance_id: Optional[str] = None, + **kwargs + ): + super(Source, self).__init__(**kwargs) + self.addr = addr + self.instance_id = instance_id + + +class Status(msrest.serialization.Model): + """The status of an Azure resource at the time the operation was called. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar display_status: The short label for the status. + :vartype display_status: str + :ivar message: The detailed message for the status, including alerts and error messages. + :vartype message: str + :ivar timestamp: The timestamp when the status was changed to the current value. + :vartype timestamp: ~datetime.datetime + """ + + _validation = { + 'display_status': {'readonly': True}, + 'message': {'readonly': True}, + 'timestamp': {'readonly': True}, + } + + _attribute_map = { + 'display_status': {'key': 'displayStatus', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'timestamp': {'key': 'timestamp', 'type': 'iso-8601'}, + } + + def __init__( + self, + **kwargs + ): + super(Status, self).__init__(**kwargs) + self.display_status = None + self.message = None + self.timestamp = None + + +class StatusDetailProperties(msrest.serialization.Model): + """The status detail properties of the connected registry. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The component of the connected registry corresponding to the status. + :vartype type: str + :ivar code: The code of the status. + :vartype code: str + :ivar description: The description of the status. + :vartype description: str + :ivar timestamp: The timestamp of the status. + :vartype timestamp: ~datetime.datetime + :ivar correlation_id: The correlation ID of the status. + :vartype correlation_id: str + """ + + _validation = { + 'type': {'readonly': True}, + 'code': {'readonly': True}, + 'description': {'readonly': True}, + 'timestamp': {'readonly': True}, + 'correlation_id': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'code': {'key': 'code', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'timestamp': {'key': 'timestamp', 'type': 'iso-8601'}, + 'correlation_id': {'key': 'correlationId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(StatusDetailProperties, self).__init__(**kwargs) + self.type = None + self.code = None + self.description = None + self.timestamp = None + self.correlation_id = None + + +class SyncProperties(msrest.serialization.Model): + """The sync properties of the connected registry with its parent. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param token_id: Required. The resource ID of the ACR token used to authenticate the connected + registry to its parent during sync. + :type token_id: str + :param schedule: The cron expression indicating the schedule that the connected registry will + sync with its parent. + :type schedule: str + :param sync_window: The time window during which sync is enabled for each schedule occurrence. + Specify the duration using the format P[n]Y[n]M[n]DT[n]H[n]M[n]S as per ISO8601. + :type sync_window: ~datetime.timedelta + :param message_ttl: Required. The period of time for which a message is available to sync + before it is expired. Specify the duration using the format P[n]Y[n]M[n]DT[n]H[n]M[n]S as per + ISO8601. + :type message_ttl: ~datetime.timedelta + :ivar last_sync_time: The last time a sync occurred between the connected registry and its + parent. + :vartype last_sync_time: ~datetime.datetime + :ivar gateway_endpoint: The gateway endpoint used by the connected registry to communicate with + its parent. + :vartype gateway_endpoint: str + """ + + _validation = { + 'token_id': {'required': True}, + 'message_ttl': {'required': True}, + 'last_sync_time': {'readonly': True}, + 'gateway_endpoint': {'readonly': True}, + } + + _attribute_map = { + 'token_id': {'key': 'tokenId', 'type': 'str'}, + 'schedule': {'key': 'schedule', 'type': 'str'}, + 'sync_window': {'key': 'syncWindow', 'type': 'duration'}, + 'message_ttl': {'key': 'messageTtl', 'type': 'duration'}, + 'last_sync_time': {'key': 'lastSyncTime', 'type': 'iso-8601'}, + 'gateway_endpoint': {'key': 'gatewayEndpoint', 'type': 'str'}, + } + + def __init__( + self, + *, + token_id: str, + message_ttl: datetime.timedelta, + schedule: Optional[str] = None, + sync_window: Optional[datetime.timedelta] = None, + **kwargs + ): + super(SyncProperties, self).__init__(**kwargs) + self.token_id = token_id + self.schedule = schedule + self.sync_window = sync_window + self.message_ttl = message_ttl + self.last_sync_time = None + self.gateway_endpoint = None + + +class SyncUpdateProperties(msrest.serialization.Model): + """The parameters for updating the sync properties of the connected registry with its parent. + + :param schedule: The cron expression indicating the schedule that the connected registry will + sync with its parent. + :type schedule: str + :param sync_window: The time window during which sync is enabled for each schedule occurrence. + Specify the duration using the format P[n]Y[n]M[n]DT[n]H[n]M[n]S as per ISO8601. + :type sync_window: ~datetime.timedelta + :param message_ttl: The period of time for which a message is available to sync before it is + expired. Specify the duration using the format P[n]Y[n]M[n]DT[n]H[n]M[n]S as per ISO8601. + :type message_ttl: ~datetime.timedelta + """ + + _attribute_map = { + 'schedule': {'key': 'schedule', 'type': 'str'}, + 'sync_window': {'key': 'syncWindow', 'type': 'duration'}, + 'message_ttl': {'key': 'messageTtl', 'type': 'duration'}, + } + + def __init__( + self, + *, + schedule: Optional[str] = None, + sync_window: Optional[datetime.timedelta] = None, + message_ttl: Optional[datetime.timedelta] = None, + **kwargs + ): + super(SyncUpdateProperties, self).__init__(**kwargs) + self.schedule = schedule + self.sync_window = sync_window + self.message_ttl = message_ttl + + +class SystemData(msrest.serialization.Model): + """Metadata pertaining to creation and last modification of the resource. + + :param created_by: The identity that created the resource. + :type created_by: str + :param created_by_type: The type of identity that created the resource. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :type created_by_type: str or + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.CreatedByType + :param created_at: The timestamp of resource creation (UTC). + :type created_at: ~datetime.datetime + :param last_modified_by: The identity that last modified the resource. + :type last_modified_by: str + :param last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :type last_modified_by_type: str or + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.LastModifiedByType + :param last_modified_at: The timestamp of resource modification (UTC). + :type last_modified_at: ~datetime.datetime + """ + + _attribute_map = { + 'created_by': {'key': 'createdBy', 'type': 'str'}, + 'created_by_type': {'key': 'createdByType', 'type': 'str'}, + 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, + 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, + 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, + 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + } + + def __init__( + self, + *, + created_by: Optional[str] = None, + created_by_type: Optional[Union[str, "CreatedByType"]] = None, + created_at: Optional[datetime.datetime] = None, + last_modified_by: Optional[str] = None, + last_modified_by_type: Optional[Union[str, "LastModifiedByType"]] = None, + last_modified_at: Optional[datetime.datetime] = None, + **kwargs + ): + super(SystemData, self).__init__(**kwargs) + self.created_by = created_by + self.created_by_type = created_by_type + self.created_at = created_at + self.last_modified_by = last_modified_by + self.last_modified_by_type = last_modified_by_type + self.last_modified_at = last_modified_at + + +class Target(msrest.serialization.Model): + """The target of the event. + + :param media_type: The MIME type of the referenced object. + :type media_type: str + :param size: The number of bytes of the content. Same as Length field. + :type size: long + :param digest: The digest of the content, as defined by the Registry V2 HTTP API Specification. + :type digest: str + :param length: The number of bytes of the content. Same as Size field. + :type length: long + :param repository: The repository name. + :type repository: str + :param url: The direct URL to the content. + :type url: str + :param tag: The tag name. + :type tag: str + :param name: The name of the artifact. + :type name: str + :param version: The version of the artifact. + :type version: str + """ + + _attribute_map = { + 'media_type': {'key': 'mediaType', 'type': 'str'}, + 'size': {'key': 'size', 'type': 'long'}, + 'digest': {'key': 'digest', 'type': 'str'}, + 'length': {'key': 'length', 'type': 'long'}, + 'repository': {'key': 'repository', 'type': 'str'}, + 'url': {'key': 'url', 'type': 'str'}, + 'tag': {'key': 'tag', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'version': {'key': 'version', 'type': 'str'}, + } + + def __init__( + self, + *, + media_type: Optional[str] = None, + size: Optional[int] = None, + digest: Optional[str] = None, + length: Optional[int] = None, + repository: Optional[str] = None, + url: Optional[str] = None, + tag: Optional[str] = None, + name: Optional[str] = None, + version: Optional[str] = None, + **kwargs + ): + super(Target, self).__init__(**kwargs) + self.media_type = media_type + self.size = size + self.digest = digest + self.length = length + self.repository = repository + self.url = url + self.tag = tag + self.name = name + self.version = version + + +class TlsCertificateProperties(msrest.serialization.Model): + """The TLS certificate properties of the connected registry login server. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The type of certificate location. Possible values include: "LocalDirectory". + :vartype type: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.CertificateType + :ivar location: Indicates the location of the certificates. + :vartype location: str + """ + + _validation = { + 'type': {'readonly': True}, + 'location': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(TlsCertificateProperties, self).__init__(**kwargs) + self.type = None + self.location = None + + +class TlsProperties(msrest.serialization.Model): + """The TLS properties of the connected registry login server. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar status: Indicates whether HTTPS is enabled for the login server. Possible values include: + "Enabled", "Disabled". + :vartype status: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.TlsStatus + :ivar certificate: The certificate used to configure HTTPS for the login server. + :vartype certificate: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.TlsCertificateProperties + """ + + _validation = { + 'status': {'readonly': True}, + 'certificate': {'readonly': True}, + } + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + 'certificate': {'key': 'certificate', 'type': 'TlsCertificateProperties'}, + } + + def __init__( + self, + **kwargs + ): + super(TlsProperties, self).__init__(**kwargs) + self.status = None + self.certificate = None + + +class Token(ProxyResource): + """An object that represents a token for a container registry. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The resource ID. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.SystemData + :ivar creation_date: The creation date of scope map. + :vartype creation_date: ~datetime.datetime + :ivar provisioning_state: Provisioning state of the resource. Possible values include: + "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled". + :vartype provisioning_state: str or + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ProvisioningState + :param scope_map_id: The resource ID of the scope map to which the token will be associated + with. + :type scope_map_id: str + :param credentials: The credentials that can be used for authenticating the token. + :type credentials: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.TokenCredentialsProperties + :param status: The status of the token example enabled or disabled. Possible values include: + "enabled", "disabled". + :type status: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.TokenStatus + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'creation_date': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'creation_date': {'key': 'properties.creationDate', 'type': 'iso-8601'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'scope_map_id': {'key': 'properties.scopeMapId', 'type': 'str'}, + 'credentials': {'key': 'properties.credentials', 'type': 'TokenCredentialsProperties'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + } + + def __init__( + self, + *, + scope_map_id: Optional[str] = None, + credentials: Optional["TokenCredentialsProperties"] = None, + status: Optional[Union[str, "TokenStatus"]] = None, + **kwargs + ): + super(Token, self).__init__(**kwargs) + self.creation_date = None + self.provisioning_state = None + self.scope_map_id = scope_map_id + self.credentials = credentials + self.status = status + + +class TokenCertificate(msrest.serialization.Model): + """The properties of a certificate used for authenticating a token. + + :param name: Possible values include: "certificate1", "certificate2". + :type name: str or + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.TokenCertificateName + :param expiry: The expiry datetime of the certificate. + :type expiry: ~datetime.datetime + :param thumbprint: The thumbprint of the certificate. + :type thumbprint: str + :param encoded_pem_certificate: Base 64 encoded string of the public certificate1 in PEM format + that will be used for authenticating the token. + :type encoded_pem_certificate: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'expiry': {'key': 'expiry', 'type': 'iso-8601'}, + 'thumbprint': {'key': 'thumbprint', 'type': 'str'}, + 'encoded_pem_certificate': {'key': 'encodedPemCertificate', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[Union[str, "TokenCertificateName"]] = None, + expiry: Optional[datetime.datetime] = None, + thumbprint: Optional[str] = None, + encoded_pem_certificate: Optional[str] = None, + **kwargs + ): + super(TokenCertificate, self).__init__(**kwargs) + self.name = name + self.expiry = expiry + self.thumbprint = thumbprint + self.encoded_pem_certificate = encoded_pem_certificate + + +class TokenCredentialsProperties(msrest.serialization.Model): + """The properties of the credentials that can be used for authenticating the token. + + :param certificates: + :type certificates: + list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.TokenCertificate] + :param passwords: + :type passwords: list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.TokenPassword] + """ + + _attribute_map = { + 'certificates': {'key': 'certificates', 'type': '[TokenCertificate]'}, + 'passwords': {'key': 'passwords', 'type': '[TokenPassword]'}, + } + + def __init__( + self, + *, + certificates: Optional[List["TokenCertificate"]] = None, + passwords: Optional[List["TokenPassword"]] = None, + **kwargs + ): + super(TokenCredentialsProperties, self).__init__(**kwargs) + self.certificates = certificates + self.passwords = passwords + + +class TokenListResult(msrest.serialization.Model): + """The result of a request to list tokens for a container registry. + + :param value: The list of tokens. Since this list may be incomplete, the nextLink field should + be used to request the next list of tokens. + :type value: list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.Token] + :param next_link: The URI that can be used to request the next list of tokens. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Token]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["Token"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(TokenListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class TokenPassword(msrest.serialization.Model): + """The password that will be used for authenticating the token of a container registry. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param creation_time: The creation datetime of the password. + :type creation_time: ~datetime.datetime + :param expiry: The expiry datetime of the password. + :type expiry: ~datetime.datetime + :param name: The password name "password1" or "password2". Possible values include: + "password1", "password2". + :type name: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.TokenPasswordName + :ivar value: The password value. + :vartype value: str + """ + + _validation = { + 'value': {'readonly': True}, + } + + _attribute_map = { + 'creation_time': {'key': 'creationTime', 'type': 'iso-8601'}, + 'expiry': {'key': 'expiry', 'type': 'iso-8601'}, + 'name': {'key': 'name', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'str'}, + } + + def __init__( + self, + *, + creation_time: Optional[datetime.datetime] = None, + expiry: Optional[datetime.datetime] = None, + name: Optional[Union[str, "TokenPasswordName"]] = None, + **kwargs + ): + super(TokenPassword, self).__init__(**kwargs) + self.creation_time = creation_time + self.expiry = expiry + self.name = name + self.value = None + + +class TokenUpdateParameters(msrest.serialization.Model): + """The parameters for updating a token. + + :param scope_map_id: The resource ID of the scope map to which the token will be associated + with. + :type scope_map_id: str + :param status: The status of the token example enabled or disabled. Possible values include: + "enabled", "disabled". + :type status: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.TokenStatus + :param credentials: The credentials that can be used for authenticating the token. + :type credentials: + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.TokenCredentialsProperties + """ + + _attribute_map = { + 'scope_map_id': {'key': 'properties.scopeMapId', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'credentials': {'key': 'properties.credentials', 'type': 'TokenCredentialsProperties'}, + } + + def __init__( + self, + *, + scope_map_id: Optional[str] = None, + status: Optional[Union[str, "TokenStatus"]] = None, + credentials: Optional["TokenCredentialsProperties"] = None, + **kwargs + ): + super(TokenUpdateParameters, self).__init__(**kwargs) + self.scope_map_id = scope_map_id + self.status = status + self.credentials = credentials + + +class TrustPolicy(msrest.serialization.Model): + """The content trust policy for a container registry. + + :param type: The type of trust policy. Possible values include: "Notary". Default value: + "Notary". + :type type: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.TrustPolicyType + :param status: The value that indicates whether the policy is enabled or not. Possible values + include: "enabled", "disabled". + :type status: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PolicyStatus + """ + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + } + + def __init__( + self, + *, + type: Optional[Union[str, "TrustPolicyType"]] = "Notary", + status: Optional[Union[str, "PolicyStatus"]] = None, + **kwargs + ): + super(TrustPolicy, self).__init__(**kwargs) + self.type = type + self.status = status + + +class UserIdentityProperties(msrest.serialization.Model): + """UserIdentityProperties. + + :param principal_id: The principal id of user assigned identity. + :type principal_id: str + :param client_id: The client id of user assigned identity. + :type client_id: str + """ + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'client_id': {'key': 'clientId', 'type': 'str'}, + } + + def __init__( + self, + *, + principal_id: Optional[str] = None, + client_id: Optional[str] = None, + **kwargs + ): + super(UserIdentityProperties, self).__init__(**kwargs) + self.principal_id = principal_id + self.client_id = client_id + + +class VirtualNetworkRule(msrest.serialization.Model): + """Virtual network rule. + + All required parameters must be populated in order to send to Azure. + + :param action: The action of virtual network rule. Possible values include: "Allow". + :type action: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.Action + :param virtual_network_resource_id: Required. Resource ID of a subnet, for example: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{vnetName}/subnets/{subnetName}. + :type virtual_network_resource_id: str + """ + + _validation = { + 'virtual_network_resource_id': {'required': True}, + } + + _attribute_map = { + 'action': {'key': 'action', 'type': 'str'}, + 'virtual_network_resource_id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + *, + virtual_network_resource_id: str, + action: Optional[Union[str, "Action"]] = None, + **kwargs + ): + super(VirtualNetworkRule, self).__init__(**kwargs) + self.action = action + self.virtual_network_resource_id = virtual_network_resource_id + + +class Webhook(Resource): + """An object that represents a webhook for a container registry. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The resource ID. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :param location: Required. The location of the resource. This cannot be changed after the + resource is created. + :type location: str + :param tags: A set of tags. The tags of the resource. + :type tags: dict[str, str] + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.SystemData + :param status: The status of the webhook at the time the operation was called. Possible values + include: "enabled", "disabled". + :type status: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.WebhookStatus + :param scope: The scope of repositories where the event can be triggered. For example, 'foo:*' + means events for all tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' only. + 'foo' is equivalent to 'foo:latest'. Empty means all events. + :type scope: str + :param actions: The list of actions that trigger the webhook to post notifications. + :type actions: list[str or + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.WebhookAction] + :ivar provisioning_state: The provisioning state of the webhook at the time the operation was + called. Possible values include: "Creating", "Updating", "Deleting", "Succeeded", "Failed", + "Canceled". + :vartype provisioning_state: str or + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ProvisioningState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'system_data': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'scope': {'key': 'properties.scope', 'type': 'str'}, + 'actions': {'key': 'properties.actions', 'type': '[str]'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + status: Optional[Union[str, "WebhookStatus"]] = None, + scope: Optional[str] = None, + actions: Optional[List[Union[str, "WebhookAction"]]] = None, + **kwargs + ): + super(Webhook, self).__init__(location=location, tags=tags, **kwargs) + self.status = status + self.scope = scope + self.actions = actions + self.provisioning_state = None + + +class WebhookCreateParameters(msrest.serialization.Model): + """The parameters for creating a webhook. + + All required parameters must be populated in order to send to Azure. + + :param tags: A set of tags. The tags for the webhook. + :type tags: dict[str, str] + :param location: Required. The location of the webhook. This cannot be changed after the + resource is created. + :type location: str + :param service_uri: The service URI for the webhook to post notifications. + :type service_uri: str + :param custom_headers: Custom headers that will be added to the webhook notifications. + :type custom_headers: dict[str, str] + :param status: The status of the webhook at the time the operation was called. Possible values + include: "enabled", "disabled". + :type status: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.WebhookStatus + :param scope: The scope of repositories where the event can be triggered. For example, 'foo:*' + means events for all tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' only. + 'foo' is equivalent to 'foo:latest'. Empty means all events. + :type scope: str + :param actions: The list of actions that trigger the webhook to post notifications. + :type actions: list[str or + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.WebhookAction] + """ + + _validation = { + 'location': {'required': True}, + } + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'service_uri': {'key': 'properties.serviceUri', 'type': 'str'}, + 'custom_headers': {'key': 'properties.customHeaders', 'type': '{str}'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'scope': {'key': 'properties.scope', 'type': 'str'}, + 'actions': {'key': 'properties.actions', 'type': '[str]'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + service_uri: Optional[str] = None, + custom_headers: Optional[Dict[str, str]] = None, + status: Optional[Union[str, "WebhookStatus"]] = None, + scope: Optional[str] = None, + actions: Optional[List[Union[str, "WebhookAction"]]] = None, + **kwargs + ): + super(WebhookCreateParameters, self).__init__(**kwargs) + self.tags = tags + self.location = location + self.service_uri = service_uri + self.custom_headers = custom_headers + self.status = status + self.scope = scope + self.actions = actions + + +class WebhookListResult(msrest.serialization.Model): + """The result of a request to list webhooks for a container registry. + + :param value: The list of webhooks. Since this list may be incomplete, the nextLink field + should be used to request the next list of webhooks. + :type value: list[~azure.mgmt.containerregistry.v2021_06_01_preview.models.Webhook] + :param next_link: The URI that can be used to request the next list of webhooks. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Webhook]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["Webhook"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(WebhookListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class WebhookUpdateParameters(msrest.serialization.Model): + """The parameters for updating a webhook. + + :param tags: A set of tags. The tags for the webhook. + :type tags: dict[str, str] + :param service_uri: The service URI for the webhook to post notifications. + :type service_uri: str + :param custom_headers: Custom headers that will be added to the webhook notifications. + :type custom_headers: dict[str, str] + :param status: The status of the webhook at the time the operation was called. Possible values + include: "enabled", "disabled". + :type status: str or ~azure.mgmt.containerregistry.v2021_06_01_preview.models.WebhookStatus + :param scope: The scope of repositories where the event can be triggered. For example, 'foo:*' + means events for all tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' only. + 'foo' is equivalent to 'foo:latest'. Empty means all events. + :type scope: str + :param actions: The list of actions that trigger the webhook to post notifications. + :type actions: list[str or + ~azure.mgmt.containerregistry.v2021_06_01_preview.models.WebhookAction] + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'service_uri': {'key': 'properties.serviceUri', 'type': 'str'}, + 'custom_headers': {'key': 'properties.customHeaders', 'type': '{str}'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'scope': {'key': 'properties.scope', 'type': 'str'}, + 'actions': {'key': 'properties.actions', 'type': '[str]'}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + service_uri: Optional[str] = None, + custom_headers: Optional[Dict[str, str]] = None, + status: Optional[Union[str, "WebhookStatus"]] = None, + scope: Optional[str] = None, + actions: Optional[List[Union[str, "WebhookAction"]]] = None, + **kwargs + ): + super(WebhookUpdateParameters, self).__init__(**kwargs) + self.tags = tags + self.service_uri = service_uri + self.custom_headers = custom_headers + self.status = status + self.scope = scope + self.actions = actions diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/operations/__init__.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/operations/__init__.py new file mode 100644 index 000000000000..532500a8b984 --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/operations/__init__.py @@ -0,0 +1,33 @@ +# 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 ._connected_registries_operations import ConnectedRegistriesOperations +from ._export_pipelines_operations import ExportPipelinesOperations +from ._registries_operations import RegistriesOperations +from ._import_pipelines_operations import ImportPipelinesOperations +from ._operations import Operations +from ._pipeline_runs_operations import PipelineRunsOperations +from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations +from ._replications_operations import ReplicationsOperations +from ._scope_maps_operations import ScopeMapsOperations +from ._tokens_operations import TokensOperations +from ._webhooks_operations import WebhooksOperations + +__all__ = [ + 'ConnectedRegistriesOperations', + 'ExportPipelinesOperations', + 'RegistriesOperations', + 'ImportPipelinesOperations', + 'Operations', + 'PipelineRunsOperations', + 'PrivateEndpointConnectionsOperations', + 'ReplicationsOperations', + 'ScopeMapsOperations', + 'TokensOperations', + 'WebhooksOperations', +] diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/operations/_connected_registries_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/operations/_connected_registries_operations.py new file mode 100644 index 000000000000..1ecd14f07fad --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/operations/_connected_registries_operations.py @@ -0,0 +1,713 @@ +# 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 typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class ConnectedRegistriesOperations(object): + """ConnectedRegistriesOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.containerregistry.v2021_06_01_preview.models + :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, + resource_group_name, # type: str + registry_name, # type: str + connected_registry_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.ConnectedRegistry" + """Gets the properties of the connected registry. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param connected_registry_name: The name of the connected registry. + :type connected_registry_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ConnectedRegistry, or the result of cls(response) + :rtype: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ConnectedRegistry + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConnectedRegistry"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'connectedRegistryName': self._serialize.url("connected_registry_name", connected_registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ConnectedRegistry', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/connectedRegistries/{connectedRegistryName}'} # type: ignore + + def _create_initial( + self, + resource_group_name, # type: str + registry_name, # type: str + connected_registry_name, # type: str + connected_registry_create_parameters, # type: "_models.ConnectedRegistry" + **kwargs # type: Any + ): + # type: (...) -> "_models.ConnectedRegistry" + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConnectedRegistry"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'connectedRegistryName': self._serialize.url("connected_registry_name", connected_registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(connected_registry_create_parameters, 'ConnectedRegistry') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ConnectedRegistry', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('ConnectedRegistry', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/connectedRegistries/{connectedRegistryName}'} # type: ignore + + def begin_create( + self, + resource_group_name, # type: str + registry_name, # type: str + connected_registry_name, # type: str + connected_registry_create_parameters, # type: "_models.ConnectedRegistry" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.ConnectedRegistry"] + """Creates a connected registry for a container registry with the specified parameters. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param connected_registry_name: The name of the connected registry. + :type connected_registry_name: str + :param connected_registry_create_parameters: The parameters for creating a connectedRegistry. + :type connected_registry_create_parameters: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ConnectedRegistry + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either ConnectedRegistry or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2021_06_01_preview.models.ConnectedRegistry] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConnectedRegistry"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + connected_registry_name=connected_registry_name, + connected_registry_create_parameters=connected_registry_create_parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('ConnectedRegistry', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'connectedRegistryName': self._serialize.url("connected_registry_name", connected_registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/connectedRegistries/{connectedRegistryName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name, # type: str + registry_name, # type: str + connected_registry_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'connectedRegistryName': self._serialize.url("connected_registry_name", connected_registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/connectedRegistries/{connectedRegistryName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + registry_name, # type: str + connected_registry_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Deletes a connected registry from a container registry. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param connected_registry_name: The name of the connected registry. + :type connected_registry_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + connected_registry_name=connected_registry_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'connectedRegistryName': self._serialize.url("connected_registry_name", connected_registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/connectedRegistries/{connectedRegistryName}'} # type: ignore + + def _update_initial( + self, + resource_group_name, # type: str + registry_name, # type: str + connected_registry_name, # type: str + connected_registry_update_parameters, # type: "_models.ConnectedRegistryUpdateParameters" + **kwargs # type: Any + ): + # type: (...) -> "_models.ConnectedRegistry" + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConnectedRegistry"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'connectedRegistryName': self._serialize.url("connected_registry_name", connected_registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(connected_registry_update_parameters, 'ConnectedRegistryUpdateParameters') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ConnectedRegistry', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('ConnectedRegistry', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/connectedRegistries/{connectedRegistryName}'} # type: ignore + + def begin_update( + self, + resource_group_name, # type: str + registry_name, # type: str + connected_registry_name, # type: str + connected_registry_update_parameters, # type: "_models.ConnectedRegistryUpdateParameters" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.ConnectedRegistry"] + """Updates a connected registry with the specified parameters. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param connected_registry_name: The name of the connected registry. + :type connected_registry_name: str + :param connected_registry_update_parameters: The parameters for updating a connectedRegistry. + :type connected_registry_update_parameters: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ConnectedRegistryUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either ConnectedRegistry or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2021_06_01_preview.models.ConnectedRegistry] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConnectedRegistry"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + connected_registry_name=connected_registry_name, + connected_registry_update_parameters=connected_registry_update_parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('ConnectedRegistry', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'connectedRegistryName': self._serialize.url("connected_registry_name", connected_registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/connectedRegistries/{connectedRegistryName}'} # type: ignore + + def list( + self, + resource_group_name, # type: str + registry_name, # type: str + filter=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ConnectedRegistryListResult"] + """Lists all connected registries for the specified container registry. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param filter: An OData filter expression that describes a subset of connectedRegistries to + return. The parameters that can be filtered are parent.id (the resource id of the + connectedRegistry parent), mode, and connectionState. The supported operator is eq. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ConnectedRegistryListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2021_06_01_preview.models.ConnectedRegistryListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConnectedRegistryListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('ConnectedRegistryListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/connectedRegistries'} # type: ignore + + def _deactivate_initial( + self, + resource_group_name, # type: str + registry_name, # type: str + connected_registry_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self._deactivate_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'connectedRegistryName': self._serialize.url("connected_registry_name", connected_registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _deactivate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/connectedRegistries/{connectedRegistryName}/deactivate'} # type: ignore + + def begin_deactivate( + self, + resource_group_name, # type: str + registry_name, # type: str + connected_registry_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Deactivates the connected registry instance. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param connected_registry_name: The name of the connected registry. + :type connected_registry_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._deactivate_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + connected_registry_name=connected_registry_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'connectedRegistryName': self._serialize.url("connected_registry_name", connected_registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_deactivate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/connectedRegistries/{connectedRegistryName}/deactivate'} # type: ignore diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/operations/_export_pipelines_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/operations/_export_pipelines_operations.py new file mode 100644 index 000000000000..6ae5a2b5c9ab --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/operations/_export_pipelines_operations.py @@ -0,0 +1,442 @@ +# 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 typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class ExportPipelinesOperations(object): + """ExportPipelinesOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.containerregistry.v2021_06_01_preview.models + :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, + resource_group_name, # type: str + registry_name, # type: str + export_pipeline_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.ExportPipeline" + """Gets the properties of the export pipeline. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param export_pipeline_name: The name of the export pipeline. + :type export_pipeline_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ExportPipeline, or the result of cls(response) + :rtype: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ExportPipeline + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ExportPipeline"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'exportPipelineName': self._serialize.url("export_pipeline_name", export_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ExportPipeline', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/exportPipelines/{exportPipelineName}'} # type: ignore + + def _create_initial( + self, + resource_group_name, # type: str + registry_name, # type: str + export_pipeline_name, # type: str + export_pipeline_create_parameters, # type: "_models.ExportPipeline" + **kwargs # type: Any + ): + # type: (...) -> "_models.ExportPipeline" + cls = kwargs.pop('cls', None) # type: ClsType["_models.ExportPipeline"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'exportPipelineName': self._serialize.url("export_pipeline_name", export_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(export_pipeline_create_parameters, 'ExportPipeline') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ExportPipeline', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('ExportPipeline', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/exportPipelines/{exportPipelineName}'} # type: ignore + + def begin_create( + self, + resource_group_name, # type: str + registry_name, # type: str + export_pipeline_name, # type: str + export_pipeline_create_parameters, # type: "_models.ExportPipeline" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.ExportPipeline"] + """Creates an export pipeline for a container registry with the specified parameters. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param export_pipeline_name: The name of the export pipeline. + :type export_pipeline_name: str + :param export_pipeline_create_parameters: The parameters for creating an export pipeline. + :type export_pipeline_create_parameters: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ExportPipeline + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either ExportPipeline or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2021_06_01_preview.models.ExportPipeline] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ExportPipeline"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + export_pipeline_name=export_pipeline_name, + export_pipeline_create_parameters=export_pipeline_create_parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('ExportPipeline', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'exportPipelineName': self._serialize.url("export_pipeline_name", export_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/exportPipelines/{exportPipelineName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name, # type: str + registry_name, # type: str + export_pipeline_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'exportPipelineName': self._serialize.url("export_pipeline_name", export_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/exportPipelines/{exportPipelineName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + registry_name, # type: str + export_pipeline_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Deletes an export pipeline from a container registry. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param export_pipeline_name: The name of the export pipeline. + :type export_pipeline_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + export_pipeline_name=export_pipeline_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'exportPipelineName': self._serialize.url("export_pipeline_name", export_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/exportPipelines/{exportPipelineName}'} # type: ignore + + def list( + self, + resource_group_name, # type: str + registry_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ExportPipelineListResult"] + """Lists all export pipelines for the specified container registry. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ExportPipelineListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2021_06_01_preview.models.ExportPipelineListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ExportPipelineListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('ExportPipelineListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/exportPipelines'} # type: ignore diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/operations/_import_pipelines_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/operations/_import_pipelines_operations.py new file mode 100644 index 000000000000..873e7e45dc1f --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/operations/_import_pipelines_operations.py @@ -0,0 +1,442 @@ +# 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 typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class ImportPipelinesOperations(object): + """ImportPipelinesOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.containerregistry.v2021_06_01_preview.models + :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, + resource_group_name, # type: str + registry_name, # type: str + import_pipeline_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.ImportPipeline" + """Gets the properties of the import pipeline. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param import_pipeline_name: The name of the import pipeline. + :type import_pipeline_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ImportPipeline, or the result of cls(response) + :rtype: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ImportPipeline + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ImportPipeline"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'importPipelineName': self._serialize.url("import_pipeline_name", import_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ImportPipeline', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importPipelines/{importPipelineName}'} # type: ignore + + def _create_initial( + self, + resource_group_name, # type: str + registry_name, # type: str + import_pipeline_name, # type: str + import_pipeline_create_parameters, # type: "_models.ImportPipeline" + **kwargs # type: Any + ): + # type: (...) -> "_models.ImportPipeline" + cls = kwargs.pop('cls', None) # type: ClsType["_models.ImportPipeline"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'importPipelineName': self._serialize.url("import_pipeline_name", import_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(import_pipeline_create_parameters, 'ImportPipeline') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ImportPipeline', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('ImportPipeline', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importPipelines/{importPipelineName}'} # type: ignore + + def begin_create( + self, + resource_group_name, # type: str + registry_name, # type: str + import_pipeline_name, # type: str + import_pipeline_create_parameters, # type: "_models.ImportPipeline" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.ImportPipeline"] + """Creates an import pipeline for a container registry with the specified parameters. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param import_pipeline_name: The name of the import pipeline. + :type import_pipeline_name: str + :param import_pipeline_create_parameters: The parameters for creating an import pipeline. + :type import_pipeline_create_parameters: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ImportPipeline + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either ImportPipeline or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2021_06_01_preview.models.ImportPipeline] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ImportPipeline"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + import_pipeline_name=import_pipeline_name, + import_pipeline_create_parameters=import_pipeline_create_parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('ImportPipeline', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'importPipelineName': self._serialize.url("import_pipeline_name", import_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importPipelines/{importPipelineName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name, # type: str + registry_name, # type: str + import_pipeline_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'importPipelineName': self._serialize.url("import_pipeline_name", import_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importPipelines/{importPipelineName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + registry_name, # type: str + import_pipeline_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Deletes an import pipeline from a container registry. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param import_pipeline_name: The name of the import pipeline. + :type import_pipeline_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + import_pipeline_name=import_pipeline_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'importPipelineName': self._serialize.url("import_pipeline_name", import_pipeline_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importPipelines/{importPipelineName}'} # type: ignore + + def list( + self, + resource_group_name, # type: str + registry_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ImportPipelineListResult"] + """Lists all import pipelines for the specified container registry. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ImportPipelineListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2021_06_01_preview.models.ImportPipelineListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ImportPipelineListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('ImportPipelineListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importPipelines'} # type: ignore diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/operations/_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/operations/_operations.py new file mode 100644 index 000000000000..4be44674016c --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/operations/_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 typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class Operations(object): + """Operations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.containerregistry.v2021_06_01_preview.models + :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 list( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.OperationListResult"] + """Lists all of the available Azure Container Registry REST API operations. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OperationListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2021_06_01_preview.models.OperationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('OperationListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.ContainerRegistry/operations'} # type: ignore diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/operations/_pipeline_runs_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/operations/_pipeline_runs_operations.py new file mode 100644 index 000000000000..9cc4a79394fe --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/operations/_pipeline_runs_operations.py @@ -0,0 +1,442 @@ +# 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 typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class PipelineRunsOperations(object): + """PipelineRunsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.containerregistry.v2021_06_01_preview.models + :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, + resource_group_name, # type: str + registry_name, # type: str + pipeline_run_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.PipelineRun" + """Gets the detailed information for a given pipeline run. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param pipeline_run_name: The name of the pipeline run. + :type pipeline_run_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PipelineRun, or the result of cls(response) + :rtype: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PipelineRun + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PipelineRun"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'pipelineRunName': self._serialize.url("pipeline_run_name", pipeline_run_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PipelineRun', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/pipelineRuns/{pipelineRunName}'} # type: ignore + + def _create_initial( + self, + resource_group_name, # type: str + registry_name, # type: str + pipeline_run_name, # type: str + pipeline_run_create_parameters, # type: "_models.PipelineRun" + **kwargs # type: Any + ): + # type: (...) -> "_models.PipelineRun" + cls = kwargs.pop('cls', None) # type: ClsType["_models.PipelineRun"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'pipelineRunName': self._serialize.url("pipeline_run_name", pipeline_run_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(pipeline_run_create_parameters, 'PipelineRun') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('PipelineRun', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('PipelineRun', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/pipelineRuns/{pipelineRunName}'} # type: ignore + + def begin_create( + self, + resource_group_name, # type: str + registry_name, # type: str + pipeline_run_name, # type: str + pipeline_run_create_parameters, # type: "_models.PipelineRun" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.PipelineRun"] + """Creates a pipeline run for a container registry with the specified parameters. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param pipeline_run_name: The name of the pipeline run. + :type pipeline_run_name: str + :param pipeline_run_create_parameters: The parameters for creating a pipeline run. + :type pipeline_run_create_parameters: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PipelineRun + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either PipelineRun or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2021_06_01_preview.models.PipelineRun] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PipelineRun"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + pipeline_run_name=pipeline_run_name, + pipeline_run_create_parameters=pipeline_run_create_parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('PipelineRun', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'pipelineRunName': self._serialize.url("pipeline_run_name", pipeline_run_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/pipelineRuns/{pipelineRunName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name, # type: str + registry_name, # type: str + pipeline_run_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'pipelineRunName': self._serialize.url("pipeline_run_name", pipeline_run_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/pipelineRuns/{pipelineRunName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + registry_name, # type: str + pipeline_run_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Deletes a pipeline run from a container registry. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param pipeline_run_name: The name of the pipeline run. + :type pipeline_run_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + pipeline_run_name=pipeline_run_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'pipelineRunName': self._serialize.url("pipeline_run_name", pipeline_run_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/pipelineRuns/{pipelineRunName}'} # type: ignore + + def list( + self, + resource_group_name, # type: str + registry_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.PipelineRunListResult"] + """Lists all the pipeline runs for the specified container registry. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PipelineRunListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2021_06_01_preview.models.PipelineRunListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PipelineRunListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('PipelineRunListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/pipelineRuns'} # type: ignore diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/operations/_private_endpoint_connections_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/operations/_private_endpoint_connections_operations.py new file mode 100644 index 000000000000..91c9bfaa3833 --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/operations/_private_endpoint_connections_operations.py @@ -0,0 +1,443 @@ +# 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 typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class PrivateEndpointConnectionsOperations(object): + """PrivateEndpointConnectionsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.containerregistry.v2021_06_01_preview.models + :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, + resource_group_name, # type: str + registry_name, # type: str + private_endpoint_connection_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.PrivateEndpointConnection" + """Get the specified private endpoint connection associated with the container registry. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. + :type private_endpoint_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection, or the result of cls(response) + :rtype: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PrivateEndpointConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + def _create_or_update_initial( + self, + resource_group_name, # type: str + registry_name, # type: str + private_endpoint_connection_name, # type: str + private_endpoint_connection, # type: "_models.PrivateEndpointConnection" + **kwargs # type: Any + ): + # type: (...) -> "_models.PrivateEndpointConnection" + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(private_endpoint_connection, 'PrivateEndpointConnection') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + def begin_create_or_update( + self, + resource_group_name, # type: str + registry_name, # type: str + private_endpoint_connection_name, # type: str + private_endpoint_connection, # type: "_models.PrivateEndpointConnection" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.PrivateEndpointConnection"] + """Update the state of specified private endpoint connection associated with the container + registry. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. + :type private_endpoint_connection_name: str + :param private_endpoint_connection: The parameters for creating a private endpoint connection. + :type private_endpoint_connection: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.PrivateEndpointConnection + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2021_06_01_preview.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + private_endpoint_connection_name=private_endpoint_connection_name, + private_endpoint_connection=private_endpoint_connection, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name, # type: str + registry_name, # type: str + private_endpoint_connection_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + registry_name, # type: str + private_endpoint_connection_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Deletes the specified private endpoint connection associated with the container registry. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. + :type private_endpoint_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + private_endpoint_connection_name=private_endpoint_connection_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + def list( + self, + resource_group_name, # type: str + registry_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.PrivateEndpointConnectionListResult"] + """List all private endpoint connections in a container registry. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2021_06_01_preview.models.PrivateEndpointConnectionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('PrivateEndpointConnectionListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/privateEndpointConnections'} # type: ignore diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/operations/_registries_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/operations/_registries_operations.py new file mode 100644 index 000000000000..f68cb8445c11 --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/operations/_registries_operations.py @@ -0,0 +1,1193 @@ +# 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 typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class RegistriesOperations(object): + """RegistriesOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.containerregistry.v2021_06_01_preview.models + :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 _import_image_initial( + self, + resource_group_name, # type: str + registry_name, # type: str + parameters, # type: "_models.ImportImageParameters" + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._import_image_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'ImportImageParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _import_image_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importImage'} # type: ignore + + def begin_import_image( + self, + resource_group_name, # type: str + registry_name, # type: str + parameters, # type: "_models.ImportImageParameters" + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Copies an image to this container registry from the specified container registry. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param parameters: The parameters specifying the image to copy and the source container + registry. + :type parameters: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ImportImageParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._import_image_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_import_image.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importImage'} # type: ignore + + def check_name_availability( + self, + registry_name_check_request, # type: "_models.RegistryNameCheckRequest" + **kwargs # type: Any + ): + # type: (...) -> "_models.RegistryNameStatus" + """Checks whether the container registry name is available for use. The name must contain only + alphanumeric characters, be globally unique, and between 5 and 50 characters in length. + + :param registry_name_check_request: The object containing information for the availability + request. + :type registry_name_check_request: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.RegistryNameCheckRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RegistryNameStatus, or the result of cls(response) + :rtype: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.RegistryNameStatus + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RegistryNameStatus"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.check_name_availability.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(registry_name_check_request, 'RegistryNameCheckRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RegistryNameStatus', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ContainerRegistry/checkNameAvailability'} # type: ignore + + def get( + self, + resource_group_name, # type: str + registry_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.Registry" + """Gets the properties of the specified container registry. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Registry, or the result of cls(response) + :rtype: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.Registry + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Registry"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Registry', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore + + def _create_initial( + self, + resource_group_name, # type: str + registry_name, # type: str + registry, # type: "_models.Registry" + **kwargs # type: Any + ): + # type: (...) -> "_models.Registry" + cls = kwargs.pop('cls', None) # type: ClsType["_models.Registry"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(registry, 'Registry') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Registry', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Registry', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore + + def begin_create( + self, + resource_group_name, # type: str + registry_name, # type: str + registry, # type: "_models.Registry" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.Registry"] + """Creates a container registry with the specified parameters. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param registry: The parameters for creating a container registry. + :type registry: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.Registry + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either Registry or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2021_06_01_preview.models.Registry] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Registry"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + registry=registry, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('Registry', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name, # type: str + registry_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + registry_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Deletes a container registry. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore + + def _update_initial( + self, + resource_group_name, # type: str + registry_name, # type: str + registry_update_parameters, # type: "_models.RegistryUpdateParameters" + **kwargs # type: Any + ): + # type: (...) -> "_models.Registry" + cls = kwargs.pop('cls', None) # type: ClsType["_models.Registry"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(registry_update_parameters, 'RegistryUpdateParameters') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Registry', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Registry', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore + + def begin_update( + self, + resource_group_name, # type: str + registry_name, # type: str + registry_update_parameters, # type: "_models.RegistryUpdateParameters" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.Registry"] + """Updates a container registry with the specified parameters. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param registry_update_parameters: The parameters for updating a container registry. + :type registry_update_parameters: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.RegistryUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either Registry or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2021_06_01_preview.models.Registry] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Registry"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + registry_update_parameters=registry_update_parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('Registry', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.RegistryListResult"] + """Lists all the container registries under the specified resource group. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either RegistryListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2021_06_01_preview.models.RegistryListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RegistryListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('RegistryListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries'} # type: ignore + + def list( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.RegistryListResult"] + """Lists all the container registries under the specified subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either RegistryListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2021_06_01_preview.models.RegistryListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RegistryListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('RegistryListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ContainerRegistry/registries'} # type: ignore + + def list_credentials( + self, + resource_group_name, # type: str + registry_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.RegistryListCredentialsResult" + """Lists the login credentials for the specified container registry. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RegistryListCredentialsResult, or the result of cls(response) + :rtype: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.RegistryListCredentialsResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RegistryListCredentialsResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self.list_credentials.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RegistryListCredentialsResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_credentials.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/listCredentials'} # type: ignore + + def regenerate_credential( + self, + resource_group_name, # type: str + registry_name, # type: str + regenerate_credential_parameters, # type: "_models.RegenerateCredentialParameters" + **kwargs # type: Any + ): + # type: (...) -> "_models.RegistryListCredentialsResult" + """Regenerates one of the login credentials for the specified container registry. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param regenerate_credential_parameters: Specifies name of the password which should be + regenerated -- password or password2. + :type regenerate_credential_parameters: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.RegenerateCredentialParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RegistryListCredentialsResult, or the result of cls(response) + :rtype: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.RegistryListCredentialsResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RegistryListCredentialsResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.regenerate_credential.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(regenerate_credential_parameters, 'RegenerateCredentialParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RegistryListCredentialsResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + regenerate_credential.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/regenerateCredential'} # type: ignore + + def list_usages( + self, + resource_group_name, # type: str + registry_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.RegistryUsageListResult" + """Gets the quota usages for the specified container registry. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RegistryUsageListResult, or the result of cls(response) + :rtype: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.RegistryUsageListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RegistryUsageListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self.list_usages.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RegistryUsageListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_usages.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/listUsages'} # type: ignore + + def list_private_link_resources( + self, + resource_group_name, # type: str + registry_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.PrivateLinkResourceListResult"] + """Lists the private link resources for a container registry. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PrivateLinkResourceListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2021_06_01_preview.models.PrivateLinkResourceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_private_link_resources.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('PrivateLinkResourceListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_private_link_resources.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/privateLinkResources'} # type: ignore + + def _generate_credentials_initial( + self, + resource_group_name, # type: str + registry_name, # type: str + generate_credentials_parameters, # type: "_models.GenerateCredentialsParameters" + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.GenerateCredentialsResult"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GenerateCredentialsResult"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._generate_credentials_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(generate_credentials_parameters, 'GenerateCredentialsParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('GenerateCredentialsResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _generate_credentials_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/generateCredentials'} # type: ignore + + def begin_generate_credentials( + self, + resource_group_name, # type: str + registry_name, # type: str + generate_credentials_parameters, # type: "_models.GenerateCredentialsParameters" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.GenerateCredentialsResult"] + """Generate keys for a token of a specified container registry. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param generate_credentials_parameters: The parameters for generating credentials. + :type generate_credentials_parameters: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.GenerateCredentialsParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either GenerateCredentialsResult or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2021_06_01_preview.models.GenerateCredentialsResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenerateCredentialsResult"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._generate_credentials_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + generate_credentials_parameters=generate_credentials_parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('GenerateCredentialsResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_generate_credentials.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/generateCredentials'} # type: ignore diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/operations/_replications_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/operations/_replications_operations.py new file mode 100644 index 000000000000..251e1a45b1c5 --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/operations/_replications_operations.py @@ -0,0 +1,580 @@ +# 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 typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class ReplicationsOperations(object): + """ReplicationsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.containerregistry.v2021_06_01_preview.models + :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, + resource_group_name, # type: str + registry_name, # type: str + replication_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.Replication" + """Gets the properties of the specified replication. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param replication_name: The name of the replication. + :type replication_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Replication, or the result of cls(response) + :rtype: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.Replication + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Replication"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'replicationName': self._serialize.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Replication', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'} # type: ignore + + def _create_initial( + self, + resource_group_name, # type: str + registry_name, # type: str + replication_name, # type: str + replication, # type: "_models.Replication" + **kwargs # type: Any + ): + # type: (...) -> "_models.Replication" + cls = kwargs.pop('cls', None) # type: ClsType["_models.Replication"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'replicationName': self._serialize.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(replication, 'Replication') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Replication', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Replication', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'} # type: ignore + + def begin_create( + self, + resource_group_name, # type: str + registry_name, # type: str + replication_name, # type: str + replication, # type: "_models.Replication" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.Replication"] + """Creates a replication for a container registry with the specified parameters. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param replication_name: The name of the replication. + :type replication_name: str + :param replication: The parameters for creating a replication. + :type replication: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.Replication + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either Replication or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2021_06_01_preview.models.Replication] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Replication"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + replication_name=replication_name, + replication=replication, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('Replication', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'replicationName': self._serialize.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name, # type: str + registry_name, # type: str + replication_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'replicationName': self._serialize.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + registry_name, # type: str + replication_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Deletes a replication from a container registry. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param replication_name: The name of the replication. + :type replication_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + replication_name=replication_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'replicationName': self._serialize.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'} # type: ignore + + def _update_initial( + self, + resource_group_name, # type: str + registry_name, # type: str + replication_name, # type: str + replication_update_parameters, # type: "_models.ReplicationUpdateParameters" + **kwargs # type: Any + ): + # type: (...) -> "_models.Replication" + cls = kwargs.pop('cls', None) # type: ClsType["_models.Replication"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'replicationName': self._serialize.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(replication_update_parameters, 'ReplicationUpdateParameters') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Replication', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Replication', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'} # type: ignore + + def begin_update( + self, + resource_group_name, # type: str + registry_name, # type: str + replication_name, # type: str + replication_update_parameters, # type: "_models.ReplicationUpdateParameters" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.Replication"] + """Updates a replication for a container registry with the specified parameters. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param replication_name: The name of the replication. + :type replication_name: str + :param replication_update_parameters: The parameters for updating a replication. + :type replication_update_parameters: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ReplicationUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either Replication or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2021_06_01_preview.models.Replication] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Replication"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + replication_name=replication_name, + replication_update_parameters=replication_update_parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('Replication', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'replicationName': self._serialize.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'} # type: ignore + + def list( + self, + resource_group_name, # type: str + registry_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ReplicationListResult"] + """Lists all the replications for the specified container registry. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ReplicationListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2021_06_01_preview.models.ReplicationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ReplicationListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('ReplicationListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications'} # type: ignore diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/operations/_scope_maps_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/operations/_scope_maps_operations.py new file mode 100644 index 000000000000..ad0ed1df560b --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/operations/_scope_maps_operations.py @@ -0,0 +1,580 @@ +# 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 typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class ScopeMapsOperations(object): + """ScopeMapsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.containerregistry.v2021_06_01_preview.models + :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, + resource_group_name, # type: str + registry_name, # type: str + scope_map_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.ScopeMap" + """Gets the properties of the specified scope map. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param scope_map_name: The name of the scope map. + :type scope_map_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ScopeMap, or the result of cls(response) + :rtype: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ScopeMap + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ScopeMap"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'scopeMapName': self._serialize.url("scope_map_name", scope_map_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ScopeMap', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scopeMaps/{scopeMapName}'} # type: ignore + + def _create_initial( + self, + resource_group_name, # type: str + registry_name, # type: str + scope_map_name, # type: str + scope_map_create_parameters, # type: "_models.ScopeMap" + **kwargs # type: Any + ): + # type: (...) -> "_models.ScopeMap" + cls = kwargs.pop('cls', None) # type: ClsType["_models.ScopeMap"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'scopeMapName': self._serialize.url("scope_map_name", scope_map_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(scope_map_create_parameters, 'ScopeMap') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ScopeMap', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('ScopeMap', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scopeMaps/{scopeMapName}'} # type: ignore + + def begin_create( + self, + resource_group_name, # type: str + registry_name, # type: str + scope_map_name, # type: str + scope_map_create_parameters, # type: "_models.ScopeMap" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.ScopeMap"] + """Creates a scope map for a container registry with the specified parameters. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param scope_map_name: The name of the scope map. + :type scope_map_name: str + :param scope_map_create_parameters: The parameters for creating a scope map. + :type scope_map_create_parameters: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ScopeMap + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either ScopeMap or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2021_06_01_preview.models.ScopeMap] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ScopeMap"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + scope_map_name=scope_map_name, + scope_map_create_parameters=scope_map_create_parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('ScopeMap', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'scopeMapName': self._serialize.url("scope_map_name", scope_map_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scopeMaps/{scopeMapName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name, # type: str + registry_name, # type: str + scope_map_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'scopeMapName': self._serialize.url("scope_map_name", scope_map_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scopeMaps/{scopeMapName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + registry_name, # type: str + scope_map_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Deletes a scope map from a container registry. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param scope_map_name: The name of the scope map. + :type scope_map_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + scope_map_name=scope_map_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'scopeMapName': self._serialize.url("scope_map_name", scope_map_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scopeMaps/{scopeMapName}'} # type: ignore + + def _update_initial( + self, + resource_group_name, # type: str + registry_name, # type: str + scope_map_name, # type: str + scope_map_update_parameters, # type: "_models.ScopeMapUpdateParameters" + **kwargs # type: Any + ): + # type: (...) -> "_models.ScopeMap" + cls = kwargs.pop('cls', None) # type: ClsType["_models.ScopeMap"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'scopeMapName': self._serialize.url("scope_map_name", scope_map_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(scope_map_update_parameters, 'ScopeMapUpdateParameters') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ScopeMap', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('ScopeMap', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scopeMaps/{scopeMapName}'} # type: ignore + + def begin_update( + self, + resource_group_name, # type: str + registry_name, # type: str + scope_map_name, # type: str + scope_map_update_parameters, # type: "_models.ScopeMapUpdateParameters" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.ScopeMap"] + """Updates a scope map with the specified parameters. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param scope_map_name: The name of the scope map. + :type scope_map_name: str + :param scope_map_update_parameters: The parameters for updating a scope map. + :type scope_map_update_parameters: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.ScopeMapUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either ScopeMap or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2021_06_01_preview.models.ScopeMap] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ScopeMap"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + scope_map_name=scope_map_name, + scope_map_update_parameters=scope_map_update_parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('ScopeMap', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'scopeMapName': self._serialize.url("scope_map_name", scope_map_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-_]*$'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scopeMaps/{scopeMapName}'} # type: ignore + + def list( + self, + resource_group_name, # type: str + registry_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ScopeMapListResult"] + """Lists all the scope maps for the specified container registry. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ScopeMapListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2021_06_01_preview.models.ScopeMapListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ScopeMapListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('ScopeMapListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scopeMaps'} # type: ignore diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/operations/_tokens_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/operations/_tokens_operations.py new file mode 100644 index 000000000000..59f379e24c17 --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/operations/_tokens_operations.py @@ -0,0 +1,580 @@ +# 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 typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class TokensOperations(object): + """TokensOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.containerregistry.v2021_06_01_preview.models + :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, + resource_group_name, # type: str + registry_name, # type: str + token_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.Token" + """Gets the properties of the specified token. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param token_name: The name of the token. + :type token_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Token, or the result of cls(response) + :rtype: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.Token + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Token"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'tokenName': self._serialize.url("token_name", token_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-]*$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Token', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tokens/{tokenName}'} # type: ignore + + def _create_initial( + self, + resource_group_name, # type: str + registry_name, # type: str + token_name, # type: str + token_create_parameters, # type: "_models.Token" + **kwargs # type: Any + ): + # type: (...) -> "_models.Token" + cls = kwargs.pop('cls', None) # type: ClsType["_models.Token"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'tokenName': self._serialize.url("token_name", token_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-]*$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(token_create_parameters, 'Token') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Token', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Token', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tokens/{tokenName}'} # type: ignore + + def begin_create( + self, + resource_group_name, # type: str + registry_name, # type: str + token_name, # type: str + token_create_parameters, # type: "_models.Token" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.Token"] + """Creates a token for a container registry with the specified parameters. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param token_name: The name of the token. + :type token_name: str + :param token_create_parameters: The parameters for creating a token. + :type token_create_parameters: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.Token + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either Token or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2021_06_01_preview.models.Token] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Token"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + token_name=token_name, + token_create_parameters=token_create_parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('Token', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'tokenName': self._serialize.url("token_name", token_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-]*$'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tokens/{tokenName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name, # type: str + registry_name, # type: str + token_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'tokenName': self._serialize.url("token_name", token_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-]*$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tokens/{tokenName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + registry_name, # type: str + token_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Deletes a token from a container registry. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param token_name: The name of the token. + :type token_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + token_name=token_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'tokenName': self._serialize.url("token_name", token_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-]*$'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tokens/{tokenName}'} # type: ignore + + def _update_initial( + self, + resource_group_name, # type: str + registry_name, # type: str + token_name, # type: str + token_update_parameters, # type: "_models.TokenUpdateParameters" + **kwargs # type: Any + ): + # type: (...) -> "_models.Token" + cls = kwargs.pop('cls', None) # type: ClsType["_models.Token"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'tokenName': self._serialize.url("token_name", token_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-]*$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(token_update_parameters, 'TokenUpdateParameters') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Token', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Token', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tokens/{tokenName}'} # type: ignore + + def begin_update( + self, + resource_group_name, # type: str + registry_name, # type: str + token_name, # type: str + token_update_parameters, # type: "_models.TokenUpdateParameters" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.Token"] + """Updates a token with the specified parameters. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param token_name: The name of the token. + :type token_name: str + :param token_update_parameters: The parameters for updating a token. + :type token_update_parameters: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.TokenUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either Token or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2021_06_01_preview.models.Token] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Token"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + token_name=token_name, + token_update_parameters=token_update_parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('Token', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'tokenName': self._serialize.url("token_name", token_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9-]*$'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tokens/{tokenName}'} # type: ignore + + def list( + self, + resource_group_name, # type: str + registry_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.TokenListResult"] + """Lists all the tokens for the specified container registry. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either TokenListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2021_06_01_preview.models.TokenListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TokenListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('TokenListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tokens'} # type: ignore diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/operations/_webhooks_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/operations/_webhooks_operations.py new file mode 100644 index 000000000000..ef20e1ef9dd6 --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/operations/_webhooks_operations.py @@ -0,0 +1,788 @@ +# 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 typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class WebhooksOperations(object): + """WebhooksOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.containerregistry.v2021_06_01_preview.models + :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, + resource_group_name, # type: str + registry_name, # type: str + webhook_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.Webhook" + """Gets the properties of the specified webhook. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param webhook_name: The name of the webhook. + :type webhook_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Webhook, or the result of cls(response) + :rtype: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.Webhook + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Webhook"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Webhook', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'} # type: ignore + + def _create_initial( + self, + resource_group_name, # type: str + registry_name, # type: str + webhook_name, # type: str + webhook_create_parameters, # type: "_models.WebhookCreateParameters" + **kwargs # type: Any + ): + # type: (...) -> "_models.Webhook" + cls = kwargs.pop('cls', None) # type: ClsType["_models.Webhook"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(webhook_create_parameters, 'WebhookCreateParameters') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Webhook', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Webhook', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'} # type: ignore + + def begin_create( + self, + resource_group_name, # type: str + registry_name, # type: str + webhook_name, # type: str + webhook_create_parameters, # type: "_models.WebhookCreateParameters" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.Webhook"] + """Creates a webhook for a container registry with the specified parameters. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param webhook_name: The name of the webhook. + :type webhook_name: str + :param webhook_create_parameters: The parameters for creating a webhook. + :type webhook_create_parameters: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.WebhookCreateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either Webhook or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2021_06_01_preview.models.Webhook] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Webhook"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + webhook_create_parameters=webhook_create_parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('Webhook', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name, # type: str + registry_name, # type: str + webhook_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + registry_name, # type: str + webhook_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Deletes a webhook from a container registry. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param webhook_name: The name of the webhook. + :type webhook_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'} # type: ignore + + def _update_initial( + self, + resource_group_name, # type: str + registry_name, # type: str + webhook_name, # type: str + webhook_update_parameters, # type: "_models.WebhookUpdateParameters" + **kwargs # type: Any + ): + # type: (...) -> "_models.Webhook" + cls = kwargs.pop('cls', None) # type: ClsType["_models.Webhook"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(webhook_update_parameters, 'WebhookUpdateParameters') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Webhook', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Webhook', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'} # type: ignore + + def begin_update( + self, + resource_group_name, # type: str + registry_name, # type: str + webhook_name, # type: str + webhook_update_parameters, # type: "_models.WebhookUpdateParameters" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.Webhook"] + """Updates a webhook with the specified parameters. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param webhook_name: The name of the webhook. + :type webhook_name: str + :param webhook_update_parameters: The parameters for updating a webhook. + :type webhook_update_parameters: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.WebhookUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either Webhook or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2021_06_01_preview.models.Webhook] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Webhook"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + webhook_update_parameters=webhook_update_parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('Webhook', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'} # type: ignore + + def list( + self, + resource_group_name, # type: str + registry_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.WebhookListResult"] + """Lists all the webhooks for the specified container registry. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either WebhookListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2021_06_01_preview.models.WebhookListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.WebhookListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('WebhookListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks'} # type: ignore + + def ping( + self, + resource_group_name, # type: str + registry_name, # type: str + webhook_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.EventInfo" + """Triggers a ping event to be sent to the webhook. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param webhook_name: The name of the webhook. + :type webhook_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: EventInfo, or the result of cls(response) + :rtype: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.EventInfo + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.EventInfo"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self.ping.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('EventInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + ping.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}/ping'} # type: ignore + + def get_callback_config( + self, + resource_group_name, # type: str + registry_name, # type: str + webhook_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.CallbackConfig" + """Gets the configuration of service URI and custom headers for the webhook. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param webhook_name: The name of the webhook. + :type webhook_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CallbackConfig, or the result of cls(response) + :rtype: ~azure.mgmt.containerregistry.v2021_06_01_preview.models.CallbackConfig + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CallbackConfig"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self.get_callback_config.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CallbackConfig', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_callback_config.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}/getCallbackConfig'} # type: ignore + + def list_events( + self, + resource_group_name, # type: str + registry_name, # type: str + webhook_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.EventListResult"] + """Lists recent events for the specified webhook. + + :param resource_group_name: The name of the resource group to which the container registry + belongs. + :type resource_group_name: str + :param registry_name: The name of the container registry. + :type registry_name: str + :param webhook_name: The name of the webhook. + :type webhook_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either EventListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2021_06_01_preview.models.EventListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.EventListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_events.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', min_length=1), + 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('EventListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_events.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}/listEvents'} # type: ignore diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/py.typed b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file