From 71323954d946dff1143feaf2c9c2e37e11baaa6a Mon Sep 17 00:00:00 2001 From: SDK Automation Date: Mon, 16 Dec 2019 22:02:58 +0000 Subject: [PATCH] Generated from 5c7e7c408cb77bf5896658ba9556cf9d841d6dae fixing build failure for go sdk --- .../_container_registry_management_client.py | 29 + .../_container_registry_management_client.py | 5 + .../v2019_06_01_preview/models/__init__.py | 14 + .../v2019_06_01_preview/models/_models.py | 158 ++ .../v2019_06_01_preview/models/_models_py3.py | 158 ++ .../models/_paged_models.py | 13 + .../operations/__init__.py | 2 + .../operations/_registries_operations.py | 14 +- .../operations/_runs_operations.py | 36 +- .../operations/_task_runs_operations.py | 476 +++++ .../operations/_tasks_operations.py | 43 +- .../v2019_12_01_preview/__init__.py | 19 + .../v2019_12_01_preview/_configuration.py | 48 + .../_container_registry_management_client.py | 64 + .../v2019_12_01_preview/models/__init__.py | 194 ++ ...tainer_registry_management_client_enums.py | 107 ++ .../v2019_12_01_preview/models/_models.py | 1553 +++++++++++++++++ .../v2019_12_01_preview/models/_models_py3.py | 1553 +++++++++++++++++ .../models/_paged_models.py | 79 + .../operations/__init__.py | 22 + .../operations/_operations.py | 103 ++ .../operations/_registries_operations.py | 889 ++++++++++ .../operations/_replications_operations.py | 489 ++++++ .../operations/_webhooks_operations.py | 693 ++++++++ .../v2019_12_01_preview/version.py | 13 + 25 files changed, 6720 insertions(+), 54 deletions(-) create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/operations/_task_runs_operations.py create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/__init__.py create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/_configuration.py create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/_container_registry_management_client.py create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/models/__init__.py create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/models/_container_registry_management_client_enums.py create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/models/_models.py create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/models/_models_py3.py create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/models/_paged_models.py create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/operations/__init__.py create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/operations/_operations.py create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/operations/_registries_operations.py create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/operations/_replications_operations.py create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/operations/_webhooks_operations.py create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/version.py 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 2285ddea6a73..eb277b7b296f 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 @@ -83,6 +83,7 @@ def models(cls, api_version=DEFAULT_API_VERSION): * 2019-05-01: :mod:`v2019_05_01.models` * 2019-05-01-preview: :mod:`v2019_05_01_preview.models` * 2019-06-01-preview: :mod:`v2019_06_01_preview.models` + * 2019-12-01-preview: :mod:`v2019_12_01_preview.models` """ if api_version == '2017-03-01': from .v2017_03_01 import models @@ -108,6 +109,9 @@ def models(cls, api_version=DEFAULT_API_VERSION): elif api_version == '2019-06-01-preview': from .v2019_06_01_preview import models return models + elif api_version == '2019-12-01-preview': + from .v2019_12_01_preview import models + return models raise NotImplementedError("APIVersion {} is not available".format(api_version)) @property @@ -161,6 +165,7 @@ def operations(self): * 2019-05-01: :class:`Operations` * 2019-05-01-preview: :class:`Operations` * 2019-06-01-preview: :class:`Operations` + * 2019-12-01-preview: :class:`Operations` """ api_version = self._get_api_version('operations') if api_version == '2017-03-01': @@ -179,6 +184,8 @@ def operations(self): from .v2019_05_01_preview.operations import Operations as OperationClass elif api_version == '2019-06-01-preview': from .v2019_06_01_preview.operations import Operations as OperationClass + elif api_version == '2019-12-01-preview': + from .v2019_12_01_preview.operations import Operations as OperationClass else: raise NotImplementedError("APIVersion {} is not available".format(api_version)) return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -195,6 +202,7 @@ def registries(self): * 2019-05-01: :class:`RegistriesOperations` * 2019-05-01-preview: :class:`RegistriesOperations` * 2019-06-01-preview: :class:`RegistriesOperations` + * 2019-12-01-preview: :class:`RegistriesOperations` """ api_version = self._get_api_version('registries') if api_version == '2017-03-01': @@ -213,6 +221,8 @@ def registries(self): from .v2019_05_01_preview.operations import RegistriesOperations as OperationClass elif api_version == '2019-06-01-preview': from .v2019_06_01_preview.operations import RegistriesOperations as OperationClass + elif api_version == '2019-12-01-preview': + from .v2019_12_01_preview.operations import RegistriesOperations as OperationClass else: raise NotImplementedError("APIVersion {} is not available".format(api_version)) return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -228,6 +238,7 @@ def replications(self): * 2019-05-01: :class:`ReplicationsOperations` * 2019-05-01-preview: :class:`ReplicationsOperations` * 2019-06-01-preview: :class:`ReplicationsOperations` + * 2019-12-01-preview: :class:`ReplicationsOperations` """ api_version = self._get_api_version('replications') if api_version == '2017-10-01': @@ -244,6 +255,8 @@ def replications(self): from .v2019_05_01_preview.operations import ReplicationsOperations as OperationClass elif api_version == '2019-06-01-preview': from .v2019_06_01_preview.operations import ReplicationsOperations as OperationClass + elif api_version == '2019-12-01-preview': + from .v2019_12_01_preview.operations import ReplicationsOperations as OperationClass else: raise NotImplementedError("APIVersion {} is not available".format(api_version)) return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -286,6 +299,19 @@ def scope_maps(self): raise NotImplementedError("APIVersion {} is not available".format(api_version)) return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + @property + def task_runs(self): + """Instance depends on the API version: + + * 2019-06-01-preview: :class:`TaskRunsOperations` + """ + api_version = self._get_api_version('task_runs') + if api_version == '2019-06-01-preview': + from .v2019_06_01_preview.operations import TaskRunsOperations as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + @property def tasks(self): """Instance depends on the API version: @@ -335,6 +361,7 @@ def webhooks(self): * 2019-05-01: :class:`WebhooksOperations` * 2019-05-01-preview: :class:`WebhooksOperations` * 2019-06-01-preview: :class:`WebhooksOperations` + * 2019-12-01-preview: :class:`WebhooksOperations` """ api_version = self._get_api_version('webhooks') if api_version == '2017-10-01': @@ -351,6 +378,8 @@ def webhooks(self): from .v2019_05_01_preview.operations import WebhooksOperations as OperationClass elif api_version == '2019-06-01-preview': from .v2019_06_01_preview.operations import WebhooksOperations as OperationClass + elif api_version == '2019-12-01-preview': + from .v2019_12_01_preview.operations import WebhooksOperations as OperationClass else: raise NotImplementedError("APIVersion {} is not available".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/v2019_06_01_preview/_container_registry_management_client.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/_container_registry_management_client.py index ef41c8030ce1..83f4fb5b4cc1 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/_container_registry_management_client.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/_container_registry_management_client.py @@ -18,6 +18,7 @@ from .operations import ReplicationsOperations from .operations import WebhooksOperations from .operations import RunsOperations +from .operations import TaskRunsOperations from .operations import TasksOperations from .operations import ScopeMapsOperations from .operations import TokensOperations @@ -40,6 +41,8 @@ class ContainerRegistryManagementClient(SDKClient): :vartype webhooks: azure.mgmt.containerregistry.v2019_06_01_preview.operations.WebhooksOperations :ivar runs: Runs operations :vartype runs: azure.mgmt.containerregistry.v2019_06_01_preview.operations.RunsOperations + :ivar task_runs: TaskRuns operations + :vartype task_runs: azure.mgmt.containerregistry.v2019_06_01_preview.operations.TaskRunsOperations :ivar tasks: Tasks operations :vartype tasks: azure.mgmt.containerregistry.v2019_06_01_preview.operations.TasksOperations :ivar scope_maps: ScopeMaps operations @@ -75,6 +78,8 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.runs = RunsOperations( self._client, self.config, self._serialize, self._deserialize) + self.task_runs = TaskRunsOperations( + self._client, self.config, self._serialize, self._deserialize) self.tasks = TasksOperations( self._client, self.config, self._serialize, self._deserialize) self.scope_maps = ScopeMapsOperations( diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/models/__init__.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/models/__init__.py index 5c415f0b5959..021c7a5c91e2 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/models/__init__.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/models/__init__.py @@ -27,6 +27,8 @@ from ._models_py3 import EncodedTaskRunRequest from ._models_py3 import EncodedTaskStep from ._models_py3 import EncodedTaskStepUpdateParameters + from ._models_py3 import Error + from ._models_py3 import ErrorSchema, ErrorSchemaException from ._models_py3 import Event from ._models_py3 import EventContent from ._models_py3 import EventInfo @@ -91,7 +93,9 @@ from ._models_py3 import StorageAccountProperties from ._models_py3 import Target from ._models_py3 import Task + from ._models_py3 import TaskRun from ._models_py3 import TaskRunRequest + from ._models_py3 import TaskRunUpdateParameters from ._models_py3 import TaskStepProperties from ._models_py3 import TaskStepUpdateParameters from ._models_py3 import TaskUpdateParameters @@ -129,6 +133,8 @@ from ._models import EncodedTaskRunRequest from ._models import EncodedTaskStep from ._models import EncodedTaskStepUpdateParameters + from ._models import Error + from ._models import ErrorSchema, ErrorSchemaException from ._models import Event from ._models import EventContent from ._models import EventInfo @@ -193,7 +199,9 @@ from ._models import StorageAccountProperties from ._models import Target from ._models import Task + from ._models import TaskRun from ._models import TaskRunRequest + from ._models import TaskRunUpdateParameters from ._models import TaskStepProperties from ._models import TaskStepUpdateParameters from ._models import TaskUpdateParameters @@ -220,6 +228,7 @@ from ._paged_models import RunPaged from ._paged_models import ScopeMapPaged from ._paged_models import TaskPaged +from ._paged_models import TaskRunPaged from ._paged_models import TokenPaged from ._paged_models import WebhookPaged from ._container_registry_management_client_enums import ( @@ -274,6 +283,8 @@ 'EncodedTaskRunRequest', 'EncodedTaskStep', 'EncodedTaskStepUpdateParameters', + 'Error', + 'ErrorSchema', 'ErrorSchemaException', 'Event', 'EventContent', 'EventInfo', @@ -338,7 +349,9 @@ 'StorageAccountProperties', 'Target', 'Task', + 'TaskRun', 'TaskRunRequest', + 'TaskRunUpdateParameters', 'TaskStepProperties', 'TaskStepUpdateParameters', 'TaskUpdateParameters', @@ -364,6 +377,7 @@ 'WebhookPaged', 'EventPaged', 'RunPaged', + 'TaskRunPaged', 'TaskPaged', 'ScopeMapPaged', 'TokenPaged', diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/models/_models.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/models/_models.py index 68fe738f195c..f3f9dd0e169f 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/models/_models.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/models/_models.py @@ -10,6 +10,7 @@ # -------------------------------------------------------------------------- from msrest.serialization import Model +from msrest.exceptions import HttpOperationError class Actor(Model): @@ -895,6 +896,62 @@ def __init__(self, **kwargs): self.type = 'EncodedTask' +class Error(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 + """ + + _validation = { + 'code': {'required': True}, + 'message': {'required': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(Error, self).__init__(**kwargs) + self.code = kwargs.get('code', None) + self.message = kwargs.get('message', None) + + +class ErrorSchema(Model): + """An error response from the Azure Container Registry service. + + :param error: Azure container registry build API error body. + :type error: + ~azure.mgmt.containerregistry.v2019_06_01_preview.models.Error + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'Error'}, + } + + def __init__(self, **kwargs): + super(ErrorSchema, self).__init__(**kwargs) + self.error = kwargs.get('error', None) + + +class ErrorSchemaException(HttpOperationError): + """Server responsed with exception of type: 'ErrorSchema'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ErrorSchemaException, self).__init__(deserialize, response, 'ErrorSchema', *args) + + class EventInfo(Model): """The basic information of an event. @@ -3193,6 +3250,76 @@ def __init__(self, **kwargs): self.credentials = kwargs.get('credentials', None) +class TaskRun(Resource): + """The task run that has the ARM resource and properties. + The task run will have the information of request and result of a run. + + 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: The tags of the resource. + :type tags: dict[str, str] + :param identity: Identity for the resource. + :type identity: + ~azure.mgmt.containerregistry.v2019_06_01_preview.models.IdentityProperties + :ivar provisioning_state: The provisioning state of this task run. + Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', + 'Failed', 'Canceled' + :vartype provisioning_state: str or + ~azure.mgmt.containerregistry.v2019_06_01_preview.models.ProvisioningState + :param run_request: The request (parameters) for the run + :type run_request: + ~azure.mgmt.containerregistry.v2019_06_01_preview.models.RunRequest + :ivar run_result: The result of this task run + :vartype run_result: + ~azure.mgmt.containerregistry.v2019_06_01_preview.models.Run + :param force_update_tag: How the run should be forced to rerun even if the + run request configuration has not changed + :type force_update_tag: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'provisioning_state': {'readonly': True}, + 'run_result': {'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}'}, + 'identity': {'key': 'identity', 'type': 'IdentityProperties'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'run_request': {'key': 'properties.runRequest', 'type': 'RunRequest'}, + 'run_result': {'key': 'properties.runResult', 'type': 'Run'}, + 'force_update_tag': {'key': 'properties.forceUpdateTag', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(TaskRun, self).__init__(**kwargs) + self.identity = kwargs.get('identity', None) + self.provisioning_state = None + self.run_request = kwargs.get('run_request', None) + self.run_result = None + self.force_update_tag = kwargs.get('force_update_tag', None) + + class TaskRunRequest(RunRequest): """The parameters for a task run request. @@ -3231,6 +3358,37 @@ def __init__(self, **kwargs): self.type = 'TaskRunRequest' +class TaskRunUpdateParameters(Model): + """The parameters for updating a task run. + + :param identity: Identity for the resource. + :type identity: + ~azure.mgmt.containerregistry.v2019_06_01_preview.models.IdentityProperties + :param run_request: The request (parameters) for the new run + :type run_request: + ~azure.mgmt.containerregistry.v2019_06_01_preview.models.RunRequest + :param force_update_tag: How the run should be forced to rerun even if the + run request configuration has not changed + :type force_update_tag: str + :param tags: The ARM resource tags. + :type tags: dict[str, str] + """ + + _attribute_map = { + 'identity': {'key': 'identity', 'type': 'IdentityProperties'}, + 'run_request': {'key': 'properties.runRequest', 'type': 'RunRequest'}, + 'force_update_tag': {'key': 'properties.forceUpdateTag', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, **kwargs): + super(TaskRunUpdateParameters, self).__init__(**kwargs) + self.identity = kwargs.get('identity', None) + self.run_request = kwargs.get('run_request', None) + self.force_update_tag = kwargs.get('force_update_tag', None) + self.tags = kwargs.get('tags', None) + + class TaskUpdateParameters(Model): """The parameters for updating a task. diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/models/_models_py3.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/models/_models_py3.py index 9fa2343716dd..6888cdc1b472 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/models/_models_py3.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/models/_models_py3.py @@ -10,6 +10,7 @@ # -------------------------------------------------------------------------- from msrest.serialization import Model +from msrest.exceptions import HttpOperationError class Actor(Model): @@ -895,6 +896,62 @@ def __init__(self, *, context_path: str=None, context_access_token: str=None, en self.type = 'EncodedTask' +class Error(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 + """ + + _validation = { + 'code': {'required': True}, + 'message': {'required': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__(self, *, code: str, message: str, **kwargs) -> None: + super(Error, self).__init__(**kwargs) + self.code = code + self.message = message + + +class ErrorSchema(Model): + """An error response from the Azure Container Registry service. + + :param error: Azure container registry build API error body. + :type error: + ~azure.mgmt.containerregistry.v2019_06_01_preview.models.Error + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'Error'}, + } + + def __init__(self, *, error=None, **kwargs) -> None: + super(ErrorSchema, self).__init__(**kwargs) + self.error = error + + +class ErrorSchemaException(HttpOperationError): + """Server responsed with exception of type: 'ErrorSchema'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ErrorSchemaException, self).__init__(deserialize, response, 'ErrorSchema', *args) + + class EventInfo(Model): """The basic information of an event. @@ -3193,6 +3250,76 @@ def __init__(self, *, location: str, platform, step, tags=None, identity=None, s self.credentials = credentials +class TaskRun(Resource): + """The task run that has the ARM resource and properties. + The task run will have the information of request and result of a run. + + 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: The tags of the resource. + :type tags: dict[str, str] + :param identity: Identity for the resource. + :type identity: + ~azure.mgmt.containerregistry.v2019_06_01_preview.models.IdentityProperties + :ivar provisioning_state: The provisioning state of this task run. + Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', + 'Failed', 'Canceled' + :vartype provisioning_state: str or + ~azure.mgmt.containerregistry.v2019_06_01_preview.models.ProvisioningState + :param run_request: The request (parameters) for the run + :type run_request: + ~azure.mgmt.containerregistry.v2019_06_01_preview.models.RunRequest + :ivar run_result: The result of this task run + :vartype run_result: + ~azure.mgmt.containerregistry.v2019_06_01_preview.models.Run + :param force_update_tag: How the run should be forced to rerun even if the + run request configuration has not changed + :type force_update_tag: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'provisioning_state': {'readonly': True}, + 'run_result': {'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}'}, + 'identity': {'key': 'identity', 'type': 'IdentityProperties'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'run_request': {'key': 'properties.runRequest', 'type': 'RunRequest'}, + 'run_result': {'key': 'properties.runResult', 'type': 'Run'}, + 'force_update_tag': {'key': 'properties.forceUpdateTag', 'type': 'str'}, + } + + def __init__(self, *, location: str, tags=None, identity=None, run_request=None, force_update_tag: str=None, **kwargs) -> None: + super(TaskRun, self).__init__(location=location, tags=tags, **kwargs) + self.identity = identity + self.provisioning_state = None + self.run_request = run_request + self.run_result = None + self.force_update_tag = force_update_tag + + class TaskRunRequest(RunRequest): """The parameters for a task run request. @@ -3231,6 +3358,37 @@ def __init__(self, *, task_id: str, is_archive_enabled: bool=False, override_tas self.type = 'TaskRunRequest' +class TaskRunUpdateParameters(Model): + """The parameters for updating a task run. + + :param identity: Identity for the resource. + :type identity: + ~azure.mgmt.containerregistry.v2019_06_01_preview.models.IdentityProperties + :param run_request: The request (parameters) for the new run + :type run_request: + ~azure.mgmt.containerregistry.v2019_06_01_preview.models.RunRequest + :param force_update_tag: How the run should be forced to rerun even if the + run request configuration has not changed + :type force_update_tag: str + :param tags: The ARM resource tags. + :type tags: dict[str, str] + """ + + _attribute_map = { + 'identity': {'key': 'identity', 'type': 'IdentityProperties'}, + 'run_request': {'key': 'properties.runRequest', 'type': 'RunRequest'}, + 'force_update_tag': {'key': 'properties.forceUpdateTag', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, *, identity=None, run_request=None, force_update_tag: str=None, tags=None, **kwargs) -> None: + super(TaskRunUpdateParameters, self).__init__(**kwargs) + self.identity = identity + self.run_request = run_request + self.force_update_tag = force_update_tag + self.tags = tags + + class TaskUpdateParameters(Model): """The parameters for updating a task. diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/models/_paged_models.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/models/_paged_models.py index b91aff5d1e12..62da7b150809 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/models/_paged_models.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/models/_paged_models.py @@ -90,6 +90,19 @@ class RunPaged(Paged): def __init__(self, *args, **kwargs): super(RunPaged, self).__init__(*args, **kwargs) +class TaskRunPaged(Paged): + """ + A paging container for iterating over a list of :class:`TaskRun ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[TaskRun]'} + } + + def __init__(self, *args, **kwargs): + + super(TaskRunPaged, self).__init__(*args, **kwargs) class TaskPaged(Paged): """ A paging container for iterating over a list of :class:`Task ` object diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/operations/__init__.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/operations/__init__.py index d50454ded73d..fe07fc43b190 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/operations/__init__.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/operations/__init__.py @@ -14,6 +14,7 @@ from ._replications_operations import ReplicationsOperations from ._webhooks_operations import WebhooksOperations from ._runs_operations import RunsOperations +from ._task_runs_operations import TaskRunsOperations from ._tasks_operations import TasksOperations from ._scope_maps_operations import ScopeMapsOperations from ._tokens_operations import TokensOperations @@ -24,6 +25,7 @@ 'ReplicationsOperations', 'WebhooksOperations', 'RunsOperations', + 'TaskRunsOperations', 'TasksOperations', 'ScopeMapsOperations', 'TokensOperations', diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/operations/_registries_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/operations/_registries_operations.py index 25396f418919..ef37748768d4 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/operations/_registries_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/operations/_registries_operations.py @@ -945,9 +945,7 @@ def _schedule_run_initial( response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + raise models.ErrorSchemaException(self._deserialize, response) deserialized = None @@ -984,7 +982,8 @@ def schedule_run( ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.containerregistry.v2019_06_01_preview.models.Run] or ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.containerregistry.v2019_06_01_preview.models.Run]] - :raises: :class:`CloudError` + :raises: + :class:`ErrorSchemaException` """ raw_result = self._schedule_run_initial( resource_group_name=resource_group_name, @@ -1031,7 +1030,8 @@ def get_build_source_upload_url( :rtype: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.SourceUploadDefinition or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :raises: + :class:`ErrorSchemaException` """ api_version = "2019-06-01-preview" @@ -1063,9 +1063,7 @@ def get_build_source_upload_url( response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + raise models.ErrorSchemaException(self._deserialize, response) deserialized = None if response.status_code == 200: diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/operations/_runs_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/operations/_runs_operations.py index 2bf8392db7e0..ac83e4f62e25 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/operations/_runs_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/operations/_runs_operations.py @@ -11,7 +11,6 @@ import uuid from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError from msrest.polling import LROPoller, NoPolling from msrestazure.polling.arm_polling import ARMPolling @@ -66,7 +65,8 @@ def list( :return: An iterator like instance of Run :rtype: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.RunPaged[~azure.mgmt.containerregistry.v2019_06_01_preview.models.Run] - :raises: :class:`CloudError` + :raises: + :class:`ErrorSchemaException` """ def prepare_request(next_link=None): if not next_link: @@ -111,9 +111,7 @@ def internal_paging(next_link=None): response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + raise models.ErrorSchemaException(self._deserialize, response) return response @@ -145,7 +143,8 @@ def get( :return: Run or ClientRawResponse if raw=true :rtype: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.Run or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :raises: + :class:`ErrorSchemaException` """ # Construct URL url = self.get.metadata['url'] @@ -176,9 +175,7 @@ def get( response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + raise models.ErrorSchemaException(self._deserialize, response) deserialized = None if response.status_code == 200: @@ -229,9 +226,7 @@ def _update_initial( response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200, 201]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + raise models.ErrorSchemaException(self._deserialize, response) deserialized = None @@ -271,7 +266,8 @@ def update( ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.containerregistry.v2019_06_01_preview.models.Run] or ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.containerregistry.v2019_06_01_preview.models.Run]] - :raises: :class:`CloudError` + :raises: + :class:`ErrorSchemaException` """ raw_result = self._update_initial( resource_group_name=resource_group_name, @@ -321,7 +317,8 @@ def get_log_sas_url( :rtype: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.RunGetLogResult or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :raises: + :class:`ErrorSchemaException` """ # Construct URL url = self.get_log_sas_url.metadata['url'] @@ -352,9 +349,7 @@ def get_log_sas_url( response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + raise models.ErrorSchemaException(self._deserialize, response) deserialized = None if response.status_code == 200: @@ -398,9 +393,7 @@ def _cancel_initial( response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + raise models.ErrorSchemaException(self._deserialize, response) if raw: client_raw_response = ClientRawResponse(None, response) @@ -426,7 +419,8 @@ def cancel( ClientRawResponse if raw==True :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] - :raises: :class:`CloudError` + :raises: + :class:`ErrorSchemaException` """ raw_result = self._cancel_initial( resource_group_name=resource_group_name, diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/operations/_task_runs_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/operations/_task_runs_operations.py new file mode 100644 index 000000000000..cada44ad3e40 --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/operations/_task_runs_operations.py @@ -0,0 +1,476 @@ +# 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 uuid +from msrest.pipeline import ClientRawResponse +from msrest.polling import LROPoller, NoPolling +from msrestazure.polling.arm_polling import ARMPolling + +from .. import models + + +class TaskRunsOperations(object): + """TaskRunsOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: The client API version. Constant value: "2019-06-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-06-01-preview" + + self.config = config + + def get( + self, resource_group_name, registry_name, task_run_name, custom_headers=None, raw=False, **operation_config): + """Gets the detailed information for a given task 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 task_run_name: The run request name. + :type task_run_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: TaskRun or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.containerregistry.v2019_06_01_preview.models.TaskRun or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorSchemaException` + """ + # Construct URL + url = self.get.metadata['url'] + 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]*$'), + 'taskRunName': self._serialize.url("task_run_name", task_run_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorSchemaException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('TaskRun', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/taskRuns/{taskRunName}'} + + + def _create_initial( + self, resource_group_name, registry_name, task_run_name, task_run, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.create.metadata['url'] + 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]*$'), + 'taskRunName': self._serialize.url("task_run_name", task_run_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(task_run, 'TaskRun') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 201]: + raise models.ErrorSchemaException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('TaskRun', response) + if response.status_code == 201: + deserialized = self._deserialize('TaskRun', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create( + self, resource_group_name, registry_name, task_run_name, task_run, custom_headers=None, raw=False, polling=True, **operation_config): + """Creates a task 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 task_run_name: The name of task run. + :type task_run_name: str + :param task_run: The parameters of a run that needs to scheduled. + :type task_run: + ~azure.mgmt.containerregistry.v2019_06_01_preview.models.TaskRun + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns TaskRun or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.containerregistry.v2019_06_01_preview.models.TaskRun] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.containerregistry.v2019_06_01_preview.models.TaskRun]] + :raises: + :class:`ErrorSchemaException` + """ + raw_result = self._create_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + task_run_name=task_run_name, + task_run=task_run, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('TaskRun', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/taskRuns/{taskRunName}'} + + + def _delete_initial( + self, resource_group_name, registry_name, task_run_name, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.delete.metadata['url'] + 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]*$'), + 'taskRunName': self._serialize.url("task_run_name", task_run_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + raise models.ErrorSchemaException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, registry_name, task_run_name, custom_headers=None, raw=False, polling=True, **operation_config): + """Deletes a specified task run resource. + + :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 task_run_name: The task run name. + :type task_run_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :raises: + :class:`ErrorSchemaException` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + task_run_name=task_run_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/taskRuns/{taskRunName}'} + + + def _update_initial( + self, resource_group_name, registry_name, task_run_name, update_parameters, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.update.metadata['url'] + 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]*$'), + 'taskRunName': self._serialize.url("task_run_name", task_run_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(update_parameters, 'TaskRunUpdateParameters') + + # Construct and send request + request = self._client.patch(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 201]: + raise models.ErrorSchemaException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('TaskRun', response) + if response.status_code == 201: + deserialized = self._deserialize('TaskRun', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def update( + self, resource_group_name, registry_name, task_run_name, update_parameters, custom_headers=None, raw=False, polling=True, **operation_config): + """Updates a task run 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 task_run_name: The task run name. + :type task_run_name: str + :param update_parameters: The parameters for updating a task run. + :type update_parameters: + ~azure.mgmt.containerregistry.v2019_06_01_preview.models.TaskRunUpdateParameters + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns TaskRun or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.containerregistry.v2019_06_01_preview.models.TaskRun] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.containerregistry.v2019_06_01_preview.models.TaskRun]] + :raises: + :class:`ErrorSchemaException` + """ + raw_result = self._update_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + task_run_name=task_run_name, + update_parameters=update_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('TaskRun', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/taskRuns/{taskRunName}'} + + def list( + self, resource_group_name, registry_name, custom_headers=None, raw=False, **operation_config): + """Lists all the task runs for 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 dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of TaskRun + :rtype: + ~azure.mgmt.containerregistry.v2019_06_01_preview.models.TaskRunPaged[~azure.mgmt.containerregistry.v2019_06_01_preview.models.TaskRun] + :raises: + :class:`ErrorSchemaException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + 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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorSchemaException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.TaskRunPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/taskRuns'} diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/operations/_tasks_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/operations/_tasks_operations.py index 54bd55b7a2cf..cfba40561422 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/operations/_tasks_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/operations/_tasks_operations.py @@ -11,7 +11,6 @@ import uuid from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError from msrest.polling import LROPoller, NoPolling from msrestazure.polling.arm_polling import ARMPolling @@ -58,7 +57,8 @@ def list( :return: An iterator like instance of Task :rtype: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.TaskPaged[~azure.mgmt.containerregistry.v2019_06_01_preview.models.Task] - :raises: :class:`CloudError` + :raises: + :class:`ErrorSchemaException` """ def prepare_request(next_link=None): if not next_link: @@ -99,9 +99,7 @@ def internal_paging(next_link=None): response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + raise models.ErrorSchemaException(self._deserialize, response) return response @@ -133,7 +131,8 @@ def get( :return: Task or ClientRawResponse if raw=true :rtype: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.Task or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :raises: + :class:`ErrorSchemaException` """ # Construct URL url = self.get.metadata['url'] @@ -164,9 +163,7 @@ def get( response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + raise models.ErrorSchemaException(self._deserialize, response) deserialized = None if response.status_code == 200: @@ -215,9 +212,7 @@ def _create_initial( response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200, 201]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + raise models.ErrorSchemaException(self._deserialize, response) deserialized = None @@ -257,7 +252,8 @@ def create( ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.containerregistry.v2019_06_01_preview.models.Task] or ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.containerregistry.v2019_06_01_preview.models.Task]] - :raises: :class:`CloudError` + :raises: + :class:`ErrorSchemaException` """ raw_result = self._create_initial( resource_group_name=resource_group_name, @@ -318,9 +314,7 @@ def _delete_initial( response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200, 202, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + raise models.ErrorSchemaException(self._deserialize, response) if raw: client_raw_response = ClientRawResponse(None, response) @@ -346,7 +340,8 @@ def delete( ClientRawResponse if raw==True :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] - :raises: :class:`CloudError` + :raises: + :class:`ErrorSchemaException` """ raw_result = self._delete_initial( resource_group_name=resource_group_name, @@ -407,9 +402,7 @@ def _update_initial( response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200, 201]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + raise models.ErrorSchemaException(self._deserialize, response) deserialized = None @@ -449,7 +442,8 @@ def update( ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.containerregistry.v2019_06_01_preview.models.Task] or ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.containerregistry.v2019_06_01_preview.models.Task]] - :raises: :class:`CloudError` + :raises: + :class:`ErrorSchemaException` """ raw_result = self._update_initial( resource_group_name=resource_group_name, @@ -498,7 +492,8 @@ def get_details( :return: Task or ClientRawResponse if raw=true :rtype: ~azure.mgmt.containerregistry.v2019_06_01_preview.models.Task or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :raises: + :class:`ErrorSchemaException` """ # Construct URL url = self.get_details.metadata['url'] @@ -529,9 +524,7 @@ def get_details( response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + raise models.ErrorSchemaException(self._deserialize, response) deserialized = None if response.status_code == 200: diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/__init__.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/__init__.py new file mode 100644 index 000000000000..81ad2ac1ed64 --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_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 ._configuration import ContainerRegistryManagementClientConfiguration +from ._container_registry_management_client import ContainerRegistryManagementClient +__all__ = ['ContainerRegistryManagementClient', 'ContainerRegistryManagementClientConfiguration'] + +from .version import VERSION + +__version__ = VERSION + diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/_configuration.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/_configuration.py new file mode 100644 index 000000000000..4e021787210f --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/_configuration.py @@ -0,0 +1,48 @@ +# 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 msrestazure import AzureConfiguration + +from .version import VERSION + + +class ContainerRegistryManagementClientConfiguration(AzureConfiguration): + """Configuration for ContainerRegistryManagementClient + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credentials: Credentials needed for the client to connect to Azure. + :type credentials: :mod:`A msrestazure Credentials + object` + :param subscription_id: The Microsoft Azure subscription ID. + :type subscription_id: str + :param str base_url: Service URL + """ + + def __init__( + self, credentials, subscription_id, base_url=None): + + if credentials is None: + raise ValueError("Parameter 'credentials' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + if not base_url: + base_url = 'https://management.azure.com' + + super(ContainerRegistryManagementClientConfiguration, self).__init__(base_url) + + # Starting Autorest.Python 4.0.64, make connection pool activated by default + self.keep_alive = True + + self.add_user_agent('azure-mgmt-containerregistry/{}'.format(VERSION)) + self.add_user_agent('Azure-SDK-For-Python') + + self.credentials = credentials + self.subscription_id = subscription_id diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/_container_registry_management_client.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/_container_registry_management_client.py new file mode 100644 index 000000000000..a18b284b85d4 --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/_container_registry_management_client.py @@ -0,0 +1,64 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.service_client import SDKClient +from msrest import Serializer, Deserializer + +from ._configuration import ContainerRegistryManagementClientConfiguration +from .operations import RegistriesOperations +from .operations import Operations +from .operations import ReplicationsOperations +from .operations import WebhooksOperations +from . import models + + +class ContainerRegistryManagementClient(SDKClient): + """ContainerRegistryManagementClient + + :ivar config: Configuration for client. + :vartype config: ContainerRegistryManagementClientConfiguration + + :ivar registries: Registries operations + :vartype registries: azure.mgmt.containerregistry.v2019_12_01_preview.operations.RegistriesOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.containerregistry.v2019_12_01_preview.operations.Operations + :ivar replications: Replications operations + :vartype replications: azure.mgmt.containerregistry.v2019_12_01_preview.operations.ReplicationsOperations + :ivar webhooks: Webhooks operations + :vartype webhooks: azure.mgmt.containerregistry.v2019_12_01_preview.operations.WebhooksOperations + + :param credentials: Credentials needed for the client to connect to Azure. + :type credentials: :mod:`A msrestazure Credentials + object` + :param subscription_id: The Microsoft Azure subscription ID. + :type subscription_id: str + :param str base_url: Service URL + """ + + def __init__( + self, credentials, subscription_id, base_url=None): + + self.config = ContainerRegistryManagementClientConfiguration(credentials, subscription_id, base_url) + super(ContainerRegistryManagementClient, self).__init__(self.config.credentials, self.config) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self.api_version = '2019-12-01-preview' + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + + self.registries = RegistriesOperations( + self._client, self.config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self.config, self._serialize, self._deserialize) + self.replications = ReplicationsOperations( + self._client, self.config, self._serialize, self._deserialize) + self.webhooks = WebhooksOperations( + self._client, self.config, self._serialize, self._deserialize) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/models/__init__.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/models/__init__.py new file mode 100644 index 000000000000..82510d953737 --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/models/__init__.py @@ -0,0 +1,194 @@ +# 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 Actor + from ._models_py3 import CallbackConfig + from ._models_py3 import EncryptionProperty + from ._models_py3 import Event + from ._models_py3 import EventContent + from ._models_py3 import EventInfo + from ._models_py3 import EventRequestMessage + from ._models_py3 import EventResponseMessage + from ._models_py3 import IdentityProperties + from ._models_py3 import ImportImageParameters + from ._models_py3 import ImportSource + from ._models_py3 import ImportSourceCredentials + from ._models_py3 import IPRule + from ._models_py3 import KeyVaultProperties + from ._models_py3 import NetworkRuleSet + from ._models_py3 import OperationDefinition + from ._models_py3 import OperationDisplayDefinition + from ._models_py3 import OperationMetricSpecificationDefinition + from ._models_py3 import OperationServiceSpecificationDefinition + from ._models_py3 import Policies + from ._models_py3 import QuarantinePolicy + from ._models_py3 import RegenerateCredentialParameters + from ._models_py3 import Registry + from ._models_py3 import RegistryListCredentialsResult + 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 ReplicationUpdateParameters + from ._models_py3 import Request + from ._models_py3 import Resource + from ._models_py3 import RetentionPolicy + from ._models_py3 import Sku + from ._models_py3 import Source + from ._models_py3 import Status + from ._models_py3 import StorageAccountProperties + from ._models_py3 import Target + 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 WebhookUpdateParameters +except (SyntaxError, ImportError): + from ._models import Actor + from ._models import CallbackConfig + from ._models import EncryptionProperty + from ._models import Event + from ._models import EventContent + from ._models import EventInfo + from ._models import EventRequestMessage + from ._models import EventResponseMessage + from ._models import IdentityProperties + from ._models import ImportImageParameters + from ._models import ImportSource + from ._models import ImportSourceCredentials + from ._models import IPRule + from ._models import KeyVaultProperties + from ._models import NetworkRuleSet + from ._models import OperationDefinition + from ._models import OperationDisplayDefinition + from ._models import OperationMetricSpecificationDefinition + from ._models import OperationServiceSpecificationDefinition + from ._models import Policies + from ._models import QuarantinePolicy + from ._models import RegenerateCredentialParameters + from ._models import Registry + from ._models import RegistryListCredentialsResult + from ._models import RegistryNameCheckRequest + from ._models import RegistryNameStatus + from ._models import RegistryPassword + from ._models import RegistryUpdateParameters + from ._models import RegistryUsage + from ._models import RegistryUsageListResult + from ._models import Replication + from ._models import ReplicationUpdateParameters + from ._models import Request + from ._models import Resource + from ._models import RetentionPolicy + from ._models import Sku + from ._models import Source + from ._models import Status + from ._models import StorageAccountProperties + from ._models import Target + from ._models import TrustPolicy + from ._models import UserIdentityProperties + from ._models import VirtualNetworkRule + from ._models import Webhook + from ._models import WebhookCreateParameters + from ._models import WebhookUpdateParameters +from ._paged_models import EventPaged +from ._paged_models import OperationDefinitionPaged +from ._paged_models import RegistryPaged +from ._paged_models import ReplicationPaged +from ._paged_models import WebhookPaged +from ._container_registry_management_client_enums import ( + ImportMode, + SkuName, + SkuTier, + ResourceIdentityType, + ProvisioningState, + DefaultAction, + Action, + PolicyStatus, + TrustPolicyType, + EncryptionStatus, + PasswordName, + RegistryUsageUnit, + WebhookStatus, + WebhookAction, +) + +__all__ = [ + 'Actor', + 'CallbackConfig', + 'EncryptionProperty', + 'Event', + 'EventContent', + 'EventInfo', + 'EventRequestMessage', + 'EventResponseMessage', + 'IdentityProperties', + 'ImportImageParameters', + 'ImportSource', + 'ImportSourceCredentials', + 'IPRule', + 'KeyVaultProperties', + 'NetworkRuleSet', + 'OperationDefinition', + 'OperationDisplayDefinition', + 'OperationMetricSpecificationDefinition', + 'OperationServiceSpecificationDefinition', + 'Policies', + 'QuarantinePolicy', + 'RegenerateCredentialParameters', + 'Registry', + 'RegistryListCredentialsResult', + 'RegistryNameCheckRequest', + 'RegistryNameStatus', + 'RegistryPassword', + 'RegistryUpdateParameters', + 'RegistryUsage', + 'RegistryUsageListResult', + 'Replication', + 'ReplicationUpdateParameters', + 'Request', + 'Resource', + 'RetentionPolicy', + 'Sku', + 'Source', + 'Status', + 'StorageAccountProperties', + 'Target', + 'TrustPolicy', + 'UserIdentityProperties', + 'VirtualNetworkRule', + 'Webhook', + 'WebhookCreateParameters', + 'WebhookUpdateParameters', + 'RegistryPaged', + 'OperationDefinitionPaged', + 'ReplicationPaged', + 'WebhookPaged', + 'EventPaged', + 'ImportMode', + 'SkuName', + 'SkuTier', + 'ResourceIdentityType', + 'ProvisioningState', + 'DefaultAction', + 'Action', + 'PolicyStatus', + 'TrustPolicyType', + 'EncryptionStatus', + 'PasswordName', + 'RegistryUsageUnit', + 'WebhookStatus', + 'WebhookAction', +] diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/models/_container_registry_management_client_enums.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/models/_container_registry_management_client_enums.py new file mode 100644 index 000000000000..11d0b8ee4ab1 --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/models/_container_registry_management_client_enums.py @@ -0,0 +1,107 @@ +# 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 + + +class ImportMode(str, Enum): + + no_force = "NoForce" + force = "Force" + + +class SkuName(str, Enum): + + classic = "Classic" + basic = "Basic" + standard = "Standard" + premium = "Premium" + + +class SkuTier(str, Enum): + + classic = "Classic" + basic = "Basic" + standard = "Standard" + premium = "Premium" + + +class ResourceIdentityType(str, Enum): + + system_assigned = "SystemAssigned" + user_assigned = "UserAssigned" + system_assigned_user_assigned = "SystemAssigned, UserAssigned" + none = "None" + + +class ProvisioningState(str, Enum): + + creating = "Creating" + updating = "Updating" + deleting = "Deleting" + succeeded = "Succeeded" + failed = "Failed" + canceled = "Canceled" + + +class DefaultAction(str, Enum): + + allow = "Allow" + deny = "Deny" + + +class Action(str, Enum): + + allow = "Allow" + + +class PolicyStatus(str, Enum): + + enabled = "enabled" + disabled = "disabled" + + +class TrustPolicyType(str, Enum): + + notary = "Notary" + + +class EncryptionStatus(str, Enum): + + enabled = "enabled" + disabled = "disabled" + + +class PasswordName(str, Enum): + + password = "password" + password2 = "password2" + + +class RegistryUsageUnit(str, Enum): + + count = "Count" + bytes = "Bytes" + + +class WebhookStatus(str, Enum): + + enabled = "enabled" + disabled = "disabled" + + +class WebhookAction(str, Enum): + + push = "push" + delete = "delete" + quarantine = "quarantine" + chart_push = "chart_push" + chart_delete = "chart_delete" 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 new file mode 100644 index 000000000000..a54830595bbb --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/models/_models.py @@ -0,0 +1,1553 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class Actor(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(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.get('service_uri', None) + self.custom_headers = kwargs.get('custom_headers', None) + + +class CloudError(Model): + """CloudError. + """ + + _attribute_map = { + } + + +class EncryptionProperty(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.v2019_12_01_preview.models.EncryptionStatus + :param key_vault_properties: Key vault properties. + :type key_vault_properties: + ~azure.mgmt.containerregistry.v2019_12_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 EventInfo(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.v2019_12_01_preview.models.EventRequestMessage + :param event_response_message: The event response message received from + the service URI. + :type event_response_message: + ~azure.mgmt.containerregistry.v2019_12_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(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 + :param action: The action that encompasses the provided event. + :type action: str + :param target: The target of the event. + :type target: + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.Target + :param request: The request that generated the event. + :type request: + ~azure.mgmt.containerregistry.v2019_12_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.v2019_12_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.v2019_12_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 EventRequestMessage(Model): + """The event request message sent to the service URI. + + :param content: The content of the event request message. + :type content: + ~azure.mgmt.containerregistry.v2019_12_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(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 IdentityProperties(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.v2019_12_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.v2019_12_01_preview.models.UserIdentityProperties] + """ + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'ResourceIdentityType'}, + '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(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.v2019_12_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.v2019_12_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.get('source', None) + 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 ImportSource(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.v2019_12_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.get('source_image', None) + + +class ImportSourceCredentials(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.get('password', None) + + +class IPRule(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'. Default value: "Allow" . + :type action: str or + ~azure.mgmt.containerregistry.v2019_12_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', "Allow") + self.ip_address_or_range = kwargs.get('ip_address_or_range', None) + + +class KeyVaultProperties(Model): + """KeyVaultProperties. + + :param key_identifier: Key vault uri to access the encryption key. + :type key_identifier: str + :param identity: The client id of the identity which will be used to + access key vault. + :type identity: str + """ + + _attribute_map = { + 'key_identifier': {'key': 'keyIdentifier', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(KeyVaultProperties, self).__init__(**kwargs) + self.key_identifier = kwargs.get('key_identifier', None) + self.identity = kwargs.get('identity', None) + + +class NetworkRuleSet(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.v2019_12_01_preview.models.DefaultAction + :param virtual_network_rules: The virtual network rules. + :type virtual_network_rules: + list[~azure.mgmt.containerregistry.v2019_12_01_preview.models.VirtualNetworkRule] + :param ip_rules: The IP ACL rules. + :type ip_rules: + list[~azure.mgmt.containerregistry.v2019_12_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(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.v2019_12_01_preview.models.OperationDisplayDefinition + :param service_specification: The definition of Azure Monitoring service. + :type service_specification: + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.OperationServiceSpecificationDefinition + """ + + _attribute_map = { + 'origin': {'key': 'origin', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplayDefinition'}, + '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.service_specification = kwargs.get('service_specification', None) + + +class OperationDisplayDefinition(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 OperationMetricSpecificationDefinition(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(Model): + """The definition of Azure Monitoring list. + + :param metric_specifications: A list of Azure Monitoring metrics + definition. + :type metric_specifications: + list[~azure.mgmt.containerregistry.v2019_12_01_preview.models.OperationMetricSpecificationDefinition] + """ + + _attribute_map = { + 'metric_specifications': {'key': 'metricSpecifications', 'type': '[OperationMetricSpecificationDefinition]'}, + } + + def __init__(self, **kwargs): + super(OperationServiceSpecificationDefinition, self).__init__(**kwargs) + self.metric_specifications = kwargs.get('metric_specifications', None) + + +class Policies(Model): + """The policies for a container registry. + + :param quarantine_policy: The quarantine policy for a container registry. + :type quarantine_policy: + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.QuarantinePolicy + :param trust_policy: The content trust policy for a container registry. + :type trust_policy: + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.TrustPolicy + :param retention_policy: The retention policy for a container registry. + :type retention_policy: + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.RetentionPolicy + """ + + _attribute_map = { + 'quarantine_policy': {'key': 'quarantinePolicy', 'type': 'QuarantinePolicy'}, + 'trust_policy': {'key': 'trustPolicy', 'type': 'TrustPolicy'}, + 'retention_policy': {'key': 'retentionPolicy', 'type': 'RetentionPolicy'}, + } + + 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) + + +class QuarantinePolicy(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'. Default value: + "disabled" . + :type status: str or + ~azure.mgmt.containerregistry.v2019_12_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', "disabled") + + +class RegenerateCredentialParameters(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.v2019_12_01_preview.models.PasswordName + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'PasswordName'}, + } + + def __init__(self, **kwargs): + super(RegenerateCredentialParameters, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + + +class Resource(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: The tags of the resource. + :type tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': 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}'}, + } + + def __init__(self, **kwargs): + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = kwargs.get('location', None) + self.tags = kwargs.get('tags', 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: The tags of the resource. + :type tags: dict[str, str] + :param sku: Required. The SKU of the container registry. + :type sku: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.Sku + :param identity: The identity of the container registry. + :type identity: + ~azure.mgmt.containerregistry.v2019_12_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 + :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.v2019_12_01_preview.models.ProvisioningState + :ivar status: The status of the container registry at the time the + operation was called. + :vartype status: + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.Status + :param admin_user_enabled: The value that indicates whether the admin user + is enabled. Default value: False . + :type admin_user_enabled: bool + :param storage_account: The properties of the storage account for the + container registry. Only applicable to Classic SKU. + :type storage_account: + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.StorageAccountProperties + :param network_rule_set: The network rule set for a container registry. + :type network_rule_set: + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.NetworkRuleSet + :param policies: The policies for a container registry. + :type policies: + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.Policies + :param encryption: The encryption settings of container registry. + :type encryption: + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.EncryptionProperty + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'sku': {'required': True}, + 'login_server': {'readonly': True}, + 'creation_date': {'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}'}, + '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'}, + 'storage_account': {'key': 'properties.storageAccount', 'type': 'StorageAccountProperties'}, + 'network_rule_set': {'key': 'properties.networkRuleSet', 'type': 'NetworkRuleSet'}, + 'policies': {'key': 'properties.policies', 'type': 'Policies'}, + 'encryption': {'key': 'properties.encryption', 'type': 'EncryptionProperty'}, + } + + def __init__(self, **kwargs): + super(Registry, self).__init__(**kwargs) + self.sku = kwargs.get('sku', None) + 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.storage_account = kwargs.get('storage_account', None) + self.network_rule_set = kwargs.get('network_rule_set', None) + self.policies = kwargs.get('policies', None) + self.encryption = kwargs.get('encryption', None) + + +class RegistryListCredentialsResult(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.v2019_12_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 RegistryNameCheckRequest(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: Required. The resource type of the container registry. This + field must be set to 'Microsoft.ContainerRegistry/registries'. Default + 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.get('name', None) + + +class RegistryNameStatus(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(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.v2019_12_01_preview.models.PasswordName + :param value: The password value. + :type value: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'PasswordName'}, + '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(Model): + """The parameters for updating a container registry. + + :param 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.v2019_12_01_preview.models.Sku + :param identity: The identity of the container registry. + :type identity: + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.IdentityProperties + :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.v2019_12_01_preview.models.NetworkRuleSet + :param policies: The policies for a container registry. + :type policies: + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.Policies + :param encryption: The encryption settings of container registry. + :type encryption: + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.EncryptionProperty + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'identity': {'key': 'identity', 'type': 'IdentityProperties'}, + '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'}, + } + + def __init__(self, **kwargs): + super(RegistryUpdateParameters, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + self.sku = kwargs.get('sku', None) + self.identity = kwargs.get('identity', 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) + + +class RegistryUsage(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.v2019_12_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(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.v2019_12_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: The tags of the resource. + :type tags: dict[str, str] + :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.v2019_12_01_preview.models.ProvisioningState + :ivar status: The status of the replication at the time the operation was + called. + :vartype status: + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.Status + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': 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}'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'Status'}, + } + + def __init__(self, **kwargs): + super(Replication, self).__init__(**kwargs) + self.provisioning_state = None + self.status = None + + +class ReplicationUpdateParameters(Model): + """The parameters for updating a replication. + + :param tags: The tags for the replication. + :type tags: dict[str, str] + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, **kwargs): + super(ReplicationUpdateParameters, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + + +class Request(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(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. Default value: 7 . + :type days: int + :ivar last_updated_time: The timestamp when the policy was last updated. + :vartype last_updated_time: datetime + :param status: The value that indicates whether the policy is enabled or + not. Possible values include: 'enabled', 'disabled'. Default value: + "disabled" . + :type status: str or + ~azure.mgmt.containerregistry.v2019_12_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', "disabled") + + +class Sku(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.v2019_12_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.v2019_12_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.get('name', None) + self.tier = None + + +class Source(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(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 + """ + + _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 StorageAccountProperties(Model): + """The properties of a storage account for a container registry. Only + applicable to Classic SKU. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. The resource ID of the storage account. + :type id: str + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(StorageAccountProperties, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + + +class Target(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 TrustPolicy(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.v2019_12_01_preview.models.TrustPolicyType + :param status: The value that indicates whether the policy is enabled or + not. Possible values include: 'enabled', 'disabled'. Default value: + "disabled" . + :type status: str or + ~azure.mgmt.containerregistry.v2019_12_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', "disabled") + + +class UserIdentityProperties(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(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'. Default value: "Allow" . + :type action: str or + ~azure.mgmt.containerregistry.v2019_12_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', "Allow") + self.virtual_network_resource_id = kwargs.get('virtual_network_resource_id', None) + + +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: The tags of the resource. + :type tags: 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.v2019_12_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: Required. The list of actions that trigger the webhook to + post notifications. + :type actions: list[str or + ~azure.mgmt.containerregistry.v2019_12_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.v2019_12_01_preview.models.ProvisioningState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'actions': {'required': 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}'}, + '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(Model): + """The parameters for creating a webhook. + + All required parameters must be populated in order to send to Azure. + + :param 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: 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] + :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.v2019_12_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: Required. The list of actions that trigger the webhook to + post notifications. + :type actions: list[str or + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.WebhookAction] + """ + + _validation = { + 'location': {'required': True}, + 'service_uri': {'required': True}, + 'actions': {'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.get('location', 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) + + +class WebhookUpdateParameters(Model): + """The parameters for updating a webhook. + + :param 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.v2019_12_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.v2019_12_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/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 new file mode 100644 index 000000000000..b9380fe6ce3c --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/models/_models_py3.py @@ -0,0 +1,1553 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class Actor(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: str=None, **kwargs) -> None: + super(Actor, self).__init__(**kwargs) + self.name = name + + +class CallbackConfig(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=None, **kwargs) -> None: + super(CallbackConfig, self).__init__(**kwargs) + self.service_uri = service_uri + self.custom_headers = custom_headers + + +class CloudError(Model): + """CloudError. + """ + + _attribute_map = { + } + + +class EncryptionProperty(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.v2019_12_01_preview.models.EncryptionStatus + :param key_vault_properties: Key vault properties. + :type key_vault_properties: + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.KeyVaultProperties + """ + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + 'key_vault_properties': {'key': 'keyVaultProperties', 'type': 'KeyVaultProperties'}, + } + + def __init__(self, *, status=None, key_vault_properties=None, **kwargs) -> None: + super(EncryptionProperty, self).__init__(**kwargs) + self.status = status + self.key_vault_properties = key_vault_properties + + +class EventInfo(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: str=None, **kwargs) -> None: + 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.v2019_12_01_preview.models.EventRequestMessage + :param event_response_message: The event response message received from + the service URI. + :type event_response_message: + ~azure.mgmt.containerregistry.v2019_12_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: str=None, event_request_message=None, event_response_message=None, **kwargs) -> None: + super(Event, self).__init__(id=id, **kwargs) + self.event_request_message = event_request_message + self.event_response_message = event_response_message + + +class EventContent(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 + :param action: The action that encompasses the provided event. + :type action: str + :param target: The target of the event. + :type target: + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.Target + :param request: The request that generated the event. + :type request: + ~azure.mgmt.containerregistry.v2019_12_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.v2019_12_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.v2019_12_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: str=None, timestamp=None, action: str=None, target=None, request=None, actor=None, source=None, **kwargs) -> None: + 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 EventRequestMessage(Model): + """The event request message sent to the service URI. + + :param content: The content of the event request message. + :type content: + ~azure.mgmt.containerregistry.v2019_12_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=None, headers=None, method: str=None, request_uri: str=None, version: str=None, **kwargs) -> None: + super(EventRequestMessage, self).__init__(**kwargs) + self.content = content + self.headers = headers + self.method = method + self.request_uri = request_uri + self.version = version + + +class EventResponseMessage(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: str=None, headers=None, reason_phrase: str=None, status_code: str=None, version: str=None, **kwargs) -> None: + 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 IdentityProperties(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.v2019_12_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.v2019_12_01_preview.models.UserIdentityProperties] + """ + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'ResourceIdentityType'}, + 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{UserIdentityProperties}'}, + } + + def __init__(self, *, principal_id: str=None, tenant_id: str=None, type=None, user_assigned_identities=None, **kwargs) -> None: + 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(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.v2019_12_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.v2019_12_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, target_tags=None, untagged_target_repositories=None, mode="NoForce", **kwargs) -> None: + super(ImportImageParameters, self).__init__(**kwargs) + self.source = source + self.target_tags = target_tags + self.untagged_target_repositories = untagged_target_repositories + self.mode = mode + + +class ImportSource(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.v2019_12_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: str=None, registry_uri: str=None, credentials=None, **kwargs) -> None: + 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(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: str=None, **kwargs) -> None: + super(ImportSourceCredentials, self).__init__(**kwargs) + self.username = username + self.password = password + + +class IPRule(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'. Default value: "Allow" . + :type action: str or + ~azure.mgmt.containerregistry.v2019_12_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="Allow", **kwargs) -> None: + super(IPRule, self).__init__(**kwargs) + self.action = action + self.ip_address_or_range = ip_address_or_range + + +class KeyVaultProperties(Model): + """KeyVaultProperties. + + :param key_identifier: Key vault uri to access the encryption key. + :type key_identifier: str + :param identity: The client id of the identity which will be used to + access key vault. + :type identity: str + """ + + _attribute_map = { + 'key_identifier': {'key': 'keyIdentifier', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'str'}, + } + + def __init__(self, *, key_identifier: str=None, identity: str=None, **kwargs) -> None: + super(KeyVaultProperties, self).__init__(**kwargs) + self.key_identifier = key_identifier + self.identity = identity + + +class NetworkRuleSet(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.v2019_12_01_preview.models.DefaultAction + :param virtual_network_rules: The virtual network rules. + :type virtual_network_rules: + list[~azure.mgmt.containerregistry.v2019_12_01_preview.models.VirtualNetworkRule] + :param ip_rules: The IP ACL rules. + :type ip_rules: + list[~azure.mgmt.containerregistry.v2019_12_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="Allow", virtual_network_rules=None, ip_rules=None, **kwargs) -> None: + super(NetworkRuleSet, self).__init__(**kwargs) + self.default_action = default_action + self.virtual_network_rules = virtual_network_rules + self.ip_rules = ip_rules + + +class OperationDefinition(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.v2019_12_01_preview.models.OperationDisplayDefinition + :param service_specification: The definition of Azure Monitoring service. + :type service_specification: + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.OperationServiceSpecificationDefinition + """ + + _attribute_map = { + 'origin': {'key': 'origin', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplayDefinition'}, + 'service_specification': {'key': 'properties.serviceSpecification', 'type': 'OperationServiceSpecificationDefinition'}, + } + + def __init__(self, *, origin: str=None, name: str=None, display=None, service_specification=None, **kwargs) -> None: + super(OperationDefinition, self).__init__(**kwargs) + self.origin = origin + self.name = name + self.display = display + self.service_specification = service_specification + + +class OperationDisplayDefinition(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: str=None, resource: str=None, operation: str=None, description: str=None, **kwargs) -> None: + super(OperationDisplayDefinition, self).__init__(**kwargs) + self.provider = provider + self.resource = resource + self.operation = operation + self.description = description + + +class OperationMetricSpecificationDefinition(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: str=None, display_name: str=None, display_description: str=None, unit: str=None, aggregation_type: str=None, internal_metric_name: str=None, **kwargs) -> None: + 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(Model): + """The definition of Azure Monitoring list. + + :param metric_specifications: A list of Azure Monitoring metrics + definition. + :type metric_specifications: + list[~azure.mgmt.containerregistry.v2019_12_01_preview.models.OperationMetricSpecificationDefinition] + """ + + _attribute_map = { + 'metric_specifications': {'key': 'metricSpecifications', 'type': '[OperationMetricSpecificationDefinition]'}, + } + + def __init__(self, *, metric_specifications=None, **kwargs) -> None: + super(OperationServiceSpecificationDefinition, self).__init__(**kwargs) + self.metric_specifications = metric_specifications + + +class Policies(Model): + """The policies for a container registry. + + :param quarantine_policy: The quarantine policy for a container registry. + :type quarantine_policy: + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.QuarantinePolicy + :param trust_policy: The content trust policy for a container registry. + :type trust_policy: + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.TrustPolicy + :param retention_policy: The retention policy for a container registry. + :type retention_policy: + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.RetentionPolicy + """ + + _attribute_map = { + 'quarantine_policy': {'key': 'quarantinePolicy', 'type': 'QuarantinePolicy'}, + 'trust_policy': {'key': 'trustPolicy', 'type': 'TrustPolicy'}, + 'retention_policy': {'key': 'retentionPolicy', 'type': 'RetentionPolicy'}, + } + + def __init__(self, *, quarantine_policy=None, trust_policy=None, retention_policy=None, **kwargs) -> None: + super(Policies, self).__init__(**kwargs) + self.quarantine_policy = quarantine_policy + self.trust_policy = trust_policy + self.retention_policy = retention_policy + + +class QuarantinePolicy(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'. Default value: + "disabled" . + :type status: str or + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.PolicyStatus + """ + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + } + + def __init__(self, *, status="disabled", **kwargs) -> None: + super(QuarantinePolicy, self).__init__(**kwargs) + self.status = status + + +class RegenerateCredentialParameters(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.v2019_12_01_preview.models.PasswordName + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'PasswordName'}, + } + + def __init__(self, *, name, **kwargs) -> None: + super(RegenerateCredentialParameters, self).__init__(**kwargs) + self.name = name + + +class Resource(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: The tags of the resource. + :type tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': 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}'}, + } + + def __init__(self, *, location: str, tags=None, **kwargs) -> None: + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = location + self.tags = tags + + +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: The tags of the resource. + :type tags: dict[str, str] + :param sku: Required. The SKU of the container registry. + :type sku: ~azure.mgmt.containerregistry.v2019_12_01_preview.models.Sku + :param identity: The identity of the container registry. + :type identity: + ~azure.mgmt.containerregistry.v2019_12_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 + :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.v2019_12_01_preview.models.ProvisioningState + :ivar status: The status of the container registry at the time the + operation was called. + :vartype status: + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.Status + :param admin_user_enabled: The value that indicates whether the admin user + is enabled. Default value: False . + :type admin_user_enabled: bool + :param storage_account: The properties of the storage account for the + container registry. Only applicable to Classic SKU. + :type storage_account: + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.StorageAccountProperties + :param network_rule_set: The network rule set for a container registry. + :type network_rule_set: + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.NetworkRuleSet + :param policies: The policies for a container registry. + :type policies: + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.Policies + :param encryption: The encryption settings of container registry. + :type encryption: + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.EncryptionProperty + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'sku': {'required': True}, + 'login_server': {'readonly': True}, + 'creation_date': {'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}'}, + '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'}, + 'storage_account': {'key': 'properties.storageAccount', 'type': 'StorageAccountProperties'}, + 'network_rule_set': {'key': 'properties.networkRuleSet', 'type': 'NetworkRuleSet'}, + 'policies': {'key': 'properties.policies', 'type': 'Policies'}, + 'encryption': {'key': 'properties.encryption', 'type': 'EncryptionProperty'}, + } + + def __init__(self, *, location: str, sku, tags=None, identity=None, admin_user_enabled: bool=False, storage_account=None, network_rule_set=None, policies=None, encryption=None, **kwargs) -> None: + 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.storage_account = storage_account + self.network_rule_set = network_rule_set + self.policies = policies + self.encryption = encryption + + +class RegistryListCredentialsResult(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.v2019_12_01_preview.models.RegistryPassword] + """ + + _attribute_map = { + 'username': {'key': 'username', 'type': 'str'}, + 'passwords': {'key': 'passwords', 'type': '[RegistryPassword]'}, + } + + def __init__(self, *, username: str=None, passwords=None, **kwargs) -> None: + super(RegistryListCredentialsResult, self).__init__(**kwargs) + self.username = username + self.passwords = passwords + + +class RegistryNameCheckRequest(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: Required. The resource type of the container registry. This + field must be set to 'Microsoft.ContainerRegistry/registries'. Default + 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) -> None: + super(RegistryNameCheckRequest, self).__init__(**kwargs) + self.name = name + + +class RegistryNameStatus(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: bool=None, reason: str=None, message: str=None, **kwargs) -> None: + super(RegistryNameStatus, self).__init__(**kwargs) + self.name_available = name_available + self.reason = reason + self.message = message + + +class RegistryPassword(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.v2019_12_01_preview.models.PasswordName + :param value: The password value. + :type value: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'PasswordName'}, + 'value': {'key': 'value', 'type': 'str'}, + } + + def __init__(self, *, name=None, value: str=None, **kwargs) -> None: + super(RegistryPassword, self).__init__(**kwargs) + self.name = name + self.value = value + + +class RegistryUpdateParameters(Model): + """The parameters for updating a container registry. + + :param 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.v2019_12_01_preview.models.Sku + :param identity: The identity of the container registry. + :type identity: + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.IdentityProperties + :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.v2019_12_01_preview.models.NetworkRuleSet + :param policies: The policies for a container registry. + :type policies: + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.Policies + :param encryption: The encryption settings of container registry. + :type encryption: + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.EncryptionProperty + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'identity': {'key': 'identity', 'type': 'IdentityProperties'}, + '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'}, + } + + def __init__(self, *, tags=None, sku=None, identity=None, admin_user_enabled: bool=None, network_rule_set=None, policies=None, encryption=None, **kwargs) -> None: + super(RegistryUpdateParameters, self).__init__(**kwargs) + self.tags = tags + self.sku = sku + self.identity = identity + self.admin_user_enabled = admin_user_enabled + self.network_rule_set = network_rule_set + self.policies = policies + self.encryption = encryption + + +class RegistryUsage(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.v2019_12_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: str=None, limit: int=None, current_value: int=None, unit=None, **kwargs) -> None: + super(RegistryUsage, self).__init__(**kwargs) + self.name = name + self.limit = limit + self.current_value = current_value + self.unit = unit + + +class RegistryUsageListResult(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.v2019_12_01_preview.models.RegistryUsage] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[RegistryUsage]'}, + } + + def __init__(self, *, value=None, **kwargs) -> None: + 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: The tags of the resource. + :type tags: dict[str, str] + :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.v2019_12_01_preview.models.ProvisioningState + :ivar status: The status of the replication at the time the operation was + called. + :vartype status: + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.Status + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': 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}'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'Status'}, + } + + def __init__(self, *, location: str, tags=None, **kwargs) -> None: + super(Replication, self).__init__(location=location, tags=tags, **kwargs) + self.provisioning_state = None + self.status = None + + +class ReplicationUpdateParameters(Model): + """The parameters for updating a replication. + + :param tags: The tags for the replication. + :type tags: dict[str, str] + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, *, tags=None, **kwargs) -> None: + super(ReplicationUpdateParameters, self).__init__(**kwargs) + self.tags = tags + + +class Request(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: str=None, addr: str=None, host: str=None, method: str=None, useragent: str=None, **kwargs) -> None: + super(Request, self).__init__(**kwargs) + self.id = id + self.addr = addr + self.host = host + self.method = method + self.useragent = useragent + + +class RetentionPolicy(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. Default value: 7 . + :type days: int + :ivar last_updated_time: The timestamp when the policy was last updated. + :vartype last_updated_time: datetime + :param status: The value that indicates whether the policy is enabled or + not. Possible values include: 'enabled', 'disabled'. Default value: + "disabled" . + :type status: str or + ~azure.mgmt.containerregistry.v2019_12_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: int=7, status="disabled", **kwargs) -> None: + super(RetentionPolicy, self).__init__(**kwargs) + self.days = days + self.last_updated_time = None + self.status = status + + +class Sku(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.v2019_12_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.v2019_12_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, **kwargs) -> None: + super(Sku, self).__init__(**kwargs) + self.name = name + self.tier = None + + +class Source(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: str=None, instance_id: str=None, **kwargs) -> None: + super(Source, self).__init__(**kwargs) + self.addr = addr + self.instance_id = instance_id + + +class Status(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 + """ + + _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) -> None: + super(Status, self).__init__(**kwargs) + self.display_status = None + self.message = None + self.timestamp = None + + +class StorageAccountProperties(Model): + """The properties of a storage account for a container registry. Only + applicable to Classic SKU. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. The resource ID of the storage account. + :type id: str + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__(self, *, id: str, **kwargs) -> None: + super(StorageAccountProperties, self).__init__(**kwargs) + self.id = id + + +class Target(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: str=None, size: int=None, digest: str=None, length: int=None, repository: str=None, url: str=None, tag: str=None, name: str=None, version: str=None, **kwargs) -> None: + 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 TrustPolicy(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.v2019_12_01_preview.models.TrustPolicyType + :param status: The value that indicates whether the policy is enabled or + not. Possible values include: 'enabled', 'disabled'. Default value: + "disabled" . + :type status: str or + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.PolicyStatus + """ + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + } + + def __init__(self, *, type="Notary", status="disabled", **kwargs) -> None: + super(TrustPolicy, self).__init__(**kwargs) + self.type = type + self.status = status + + +class UserIdentityProperties(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: str=None, client_id: str=None, **kwargs) -> None: + super(UserIdentityProperties, self).__init__(**kwargs) + self.principal_id = principal_id + self.client_id = client_id + + +class VirtualNetworkRule(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'. Default value: "Allow" . + :type action: str or + ~azure.mgmt.containerregistry.v2019_12_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="Allow", **kwargs) -> None: + 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: The tags of the resource. + :type tags: 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.v2019_12_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: Required. The list of actions that trigger the webhook to + post notifications. + :type actions: list[str or + ~azure.mgmt.containerregistry.v2019_12_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.v2019_12_01_preview.models.ProvisioningState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'actions': {'required': 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}'}, + '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, actions, tags=None, status=None, scope: str=None, **kwargs) -> None: + super(Webhook, self).__init__(location=location, tags=tags, **kwargs) + self.status = status + self.scope = scope + self.actions = actions + self.provisioning_state = None + + +class WebhookCreateParameters(Model): + """The parameters for creating a webhook. + + All required parameters must be populated in order to send to Azure. + + :param 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: 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] + :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.v2019_12_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: Required. The list of actions that trigger the webhook to + post notifications. + :type actions: list[str or + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.WebhookAction] + """ + + _validation = { + 'location': {'required': True}, + 'service_uri': {'required': True}, + 'actions': {'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, service_uri: str, actions, tags=None, custom_headers=None, status=None, scope: str=None, **kwargs) -> None: + 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 WebhookUpdateParameters(Model): + """The parameters for updating a webhook. + + :param 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.v2019_12_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.v2019_12_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=None, service_uri: str=None, custom_headers=None, status=None, scope: str=None, actions=None, **kwargs) -> None: + 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/v2019_12_01_preview/models/_paged_models.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/models/_paged_models.py new file mode 100644 index 000000000000..79e74f03193b --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/models/_paged_models.py @@ -0,0 +1,79 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.paging import Paged + + +class RegistryPaged(Paged): + """ + A paging container for iterating over a list of :class:`Registry ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[Registry]'} + } + + def __init__(self, *args, **kwargs): + + super(RegistryPaged, self).__init__(*args, **kwargs) +class OperationDefinitionPaged(Paged): + """ + A paging container for iterating over a list of :class:`OperationDefinition ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[OperationDefinition]'} + } + + def __init__(self, *args, **kwargs): + + super(OperationDefinitionPaged, self).__init__(*args, **kwargs) +class ReplicationPaged(Paged): + """ + A paging container for iterating over a list of :class:`Replication ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[Replication]'} + } + + def __init__(self, *args, **kwargs): + + super(ReplicationPaged, self).__init__(*args, **kwargs) +class WebhookPaged(Paged): + """ + A paging container for iterating over a list of :class:`Webhook ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[Webhook]'} + } + + def __init__(self, *args, **kwargs): + + super(WebhookPaged, self).__init__(*args, **kwargs) +class EventPaged(Paged): + """ + A paging container for iterating over a list of :class:`Event ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[Event]'} + } + + def __init__(self, *args, **kwargs): + + super(EventPaged, self).__init__(*args, **kwargs) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/operations/__init__.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/operations/__init__.py new file mode 100644 index 000000000000..a0464d6c8584 --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/operations/__init__.py @@ -0,0 +1,22 @@ +# 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 ._registries_operations import RegistriesOperations +from ._operations import Operations +from ._replications_operations import ReplicationsOperations +from ._webhooks_operations import WebhooksOperations + +__all__ = [ + 'RegistriesOperations', + 'Operations', + 'ReplicationsOperations', + 'WebhooksOperations', +] diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/operations/_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/operations/_operations.py new file mode 100644 index 000000000000..8431ac4527ff --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/operations/_operations.py @@ -0,0 +1,103 @@ +# 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 uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError + +from .. import models + + +class Operations(object): + """Operations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: The client API version. Constant value: "2019-12-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-12-01-preview" + + self.config = config + + def list( + self, custom_headers=None, raw=False, **operation_config): + """Lists all of the available Azure Container Registry REST API + operations. + + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of OperationDefinition + :rtype: + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.OperationDefinitionPaged[~azure.mgmt.containerregistry.v2019_12_01_preview.models.OperationDefinition] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.OperationDefinitionPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list.metadata = {'url': '/providers/Microsoft.ContainerRegistry/operations'} diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/operations/_registries_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/operations/_registries_operations.py new file mode 100644 index 000000000000..90d7adf60e0e --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/operations/_registries_operations.py @@ -0,0 +1,889 @@ +# 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 uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError +from msrest.polling import LROPoller, NoPolling +from msrestazure.polling.arm_polling import ARMPolling + +from .. import models + + +class RegistriesOperations(object): + """RegistriesOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: The client API version. Constant value: "2019-12-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-12-01-preview" + + self.config = config + + + def _import_image_initial( + self, resource_group_name, registry_name, parameters, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.import_image.metadata['url'] + 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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'ImportImageParameters') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def import_image( + self, resource_group_name, registry_name, parameters, custom_headers=None, raw=False, polling=True, **operation_config): + """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.v2019_12_01_preview.models.ImportImageParameters + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :raises: :class:`CloudError` + """ + raw_result = self._import_image_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + import_image.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importImage'} + + def check_name_availability( + self, name, custom_headers=None, raw=False, **operation_config): + """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 name: The name of the container registry. + :type name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: RegistryNameStatus or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.RegistryNameStatus + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + registry_name_check_request = models.RegistryNameCheckRequest(name=name) + + # Construct URL + url = self.check_name_availability.metadata['url'] + 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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(registry_name_check_request, 'RegistryNameCheckRequest') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('RegistryNameStatus', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ContainerRegistry/checkNameAvailability'} + + def get( + self, resource_group_name, registry_name, custom_headers=None, raw=False, **operation_config): + """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 + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: Registry or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.Registry or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get.metadata['url'] + 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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('Registry', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} + + + def _create_initial( + self, resource_group_name, registry_name, registry, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.create.metadata['url'] + 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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(registry, 'Registry') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('Registry', response) + if response.status_code == 201: + deserialized = self._deserialize('Registry', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create( + self, resource_group_name, registry_name, registry, custom_headers=None, raw=False, polling=True, **operation_config): + """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.v2019_12_01_preview.models.Registry + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns Registry or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.containerregistry.v2019_12_01_preview.models.Registry] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.containerregistry.v2019_12_01_preview.models.Registry]] + :raises: :class:`CloudError` + """ + raw_result = self._create_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + registry=registry, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('Registry', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} + + + def _delete_initial( + self, resource_group_name, registry_name, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.delete.metadata['url'] + 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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, registry_name, custom_headers=None, raw=False, polling=True, **operation_config): + """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 + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} + + + def _update_initial( + self, resource_group_name, registry_name, registry_update_parameters, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.update.metadata['url'] + 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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(registry_update_parameters, 'RegistryUpdateParameters') + + # Construct and send request + request = self._client.patch(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('Registry', response) + if response.status_code == 201: + deserialized = self._deserialize('Registry', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def update( + self, resource_group_name, registry_name, registry_update_parameters, custom_headers=None, raw=False, polling=True, **operation_config): + """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.v2019_12_01_preview.models.RegistryUpdateParameters + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns Registry or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.containerregistry.v2019_12_01_preview.models.Registry] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.containerregistry.v2019_12_01_preview.models.Registry]] + :raises: :class:`CloudError` + """ + raw_result = self._update_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + registry_update_parameters=registry_update_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('Registry', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}'} + + def list_by_resource_group( + self, resource_group_name, custom_headers=None, raw=False, **operation_config): + """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 + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of Registry + :rtype: + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.RegistryPaged[~azure.mgmt.containerregistry.v2019_12_01_preview.models.Registry] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] + 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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.RegistryPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries'} + + def list( + self, custom_headers=None, raw=False, **operation_config): + """Lists all the container registries under the specified subscription. + + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of Registry + :rtype: + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.RegistryPaged[~azure.mgmt.containerregistry.v2019_12_01_preview.models.Registry] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + 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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.RegistryPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ContainerRegistry/registries'} + + def list_credentials( + self, resource_group_name, registry_name, custom_headers=None, raw=False, **operation_config): + """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 + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: RegistryListCredentialsResult or ClientRawResponse if + raw=true + :rtype: + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.RegistryListCredentialsResult + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.list_credentials.metadata['url'] + 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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('RegistryListCredentialsResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + list_credentials.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/listCredentials'} + + def regenerate_credential( + self, resource_group_name, registry_name, name, custom_headers=None, raw=False, **operation_config): + """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 name: Specifies name of the password which should be + regenerated -- password or password2. Possible values include: + 'password', 'password2' + :type name: str or + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.PasswordName + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: RegistryListCredentialsResult or ClientRawResponse if + raw=true + :rtype: + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.RegistryListCredentialsResult + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + regenerate_credential_parameters = models.RegenerateCredentialParameters(name=name) + + # Construct URL + url = self.regenerate_credential.metadata['url'] + 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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(regenerate_credential_parameters, 'RegenerateCredentialParameters') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('RegistryListCredentialsResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + regenerate_credential.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/regenerateCredential'} + + def list_usages( + self, resource_group_name, registry_name, custom_headers=None, raw=False, **operation_config): + """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 + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: RegistryUsageListResult or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.RegistryUsageListResult + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.list_usages.metadata['url'] + 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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('RegistryUsageListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + list_usages.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/listUsages'} diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/operations/_replications_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/operations/_replications_operations.py new file mode 100644 index 000000000000..70906d859d57 --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/operations/_replications_operations.py @@ -0,0 +1,489 @@ +# 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 uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError +from msrest.polling import LROPoller, NoPolling +from msrestazure.polling.arm_polling import ARMPolling + +from .. import models + + +class ReplicationsOperations(object): + """ReplicationsOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: The client API version. Constant value: "2019-12-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-12-01-preview" + + self.config = config + + def get( + self, resource_group_name, registry_name, replication_name, custom_headers=None, raw=False, **operation_config): + """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 + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: Replication or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.Replication + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get.metadata['url'] + 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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('Replication', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'} + + + def _create_initial( + self, resource_group_name, registry_name, replication_name, location, tags=None, custom_headers=None, raw=False, **operation_config): + replication = models.Replication(location=location, tags=tags) + + # Construct URL + url = self.create.metadata['url'] + 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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(replication, 'Replication') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('Replication', response) + if response.status_code == 201: + deserialized = self._deserialize('Replication', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create( + self, resource_group_name, registry_name, replication_name, location, tags=None, custom_headers=None, raw=False, polling=True, **operation_config): + """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 location: The location of the resource. This cannot be changed + after the resource is created. + :type location: str + :param tags: The tags of the resource. + :type tags: dict[str, str] + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns Replication or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.containerregistry.v2019_12_01_preview.models.Replication] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.containerregistry.v2019_12_01_preview.models.Replication]] + :raises: :class:`CloudError` + """ + raw_result = self._create_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + replication_name=replication_name, + location=location, + tags=tags, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('Replication', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'} + + + def _delete_initial( + self, resource_group_name, registry_name, replication_name, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.delete.metadata['url'] + 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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, registry_name, replication_name, custom_headers=None, raw=False, polling=True, **operation_config): + """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 + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + replication_name=replication_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'} + + + def _update_initial( + self, resource_group_name, registry_name, replication_name, tags=None, custom_headers=None, raw=False, **operation_config): + replication_update_parameters = models.ReplicationUpdateParameters(tags=tags) + + # Construct URL + url = self.update.metadata['url'] + 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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(replication_update_parameters, 'ReplicationUpdateParameters') + + # Construct and send request + request = self._client.patch(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('Replication', response) + if response.status_code == 201: + deserialized = self._deserialize('Replication', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def update( + self, resource_group_name, registry_name, replication_name, tags=None, custom_headers=None, raw=False, polling=True, **operation_config): + """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 tags: The tags for the replication. + :type tags: dict[str, str] + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns Replication or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.containerregistry.v2019_12_01_preview.models.Replication] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.containerregistry.v2019_12_01_preview.models.Replication]] + :raises: :class:`CloudError` + """ + raw_result = self._update_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + replication_name=replication_name, + tags=tags, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('Replication', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}'} + + def list( + self, resource_group_name, registry_name, custom_headers=None, raw=False, **operation_config): + """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 + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of Replication + :rtype: + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.ReplicationPaged[~azure.mgmt.containerregistry.v2019_12_01_preview.models.Replication] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + 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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.ReplicationPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications'} diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/operations/_webhooks_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/operations/_webhooks_operations.py new file mode 100644 index 000000000000..6081643a274f --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/operations/_webhooks_operations.py @@ -0,0 +1,693 @@ +# 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 uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError +from msrest.polling import LROPoller, NoPolling +from msrestazure.polling.arm_polling import ARMPolling + +from .. import models + + +class WebhooksOperations(object): + """WebhooksOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: The client API version. Constant value: "2019-12-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-12-01-preview" + + self.config = config + + def get( + self, resource_group_name, registry_name, webhook_name, custom_headers=None, raw=False, **operation_config): + """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 + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: Webhook or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.Webhook or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get.metadata['url'] + 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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('Webhook', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'} + + + def _create_initial( + self, resource_group_name, registry_name, webhook_name, webhook_create_parameters, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.create.metadata['url'] + 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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(webhook_create_parameters, 'WebhookCreateParameters') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('Webhook', response) + if response.status_code == 201: + deserialized = self._deserialize('Webhook', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create( + self, resource_group_name, registry_name, webhook_name, webhook_create_parameters, custom_headers=None, raw=False, polling=True, **operation_config): + """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.v2019_12_01_preview.models.WebhookCreateParameters + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns Webhook or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.containerregistry.v2019_12_01_preview.models.Webhook] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.containerregistry.v2019_12_01_preview.models.Webhook]] + :raises: :class:`CloudError` + """ + 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, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('Webhook', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'} + + + def _delete_initial( + self, resource_group_name, registry_name, webhook_name, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.delete.metadata['url'] + 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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, registry_name, webhook_name, custom_headers=None, raw=False, polling=True, **operation_config): + """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 + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'} + + + def _update_initial( + self, resource_group_name, registry_name, webhook_name, webhook_update_parameters, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.update.metadata['url'] + 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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(webhook_update_parameters, 'WebhookUpdateParameters') + + # Construct and send request + request = self._client.patch(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('Webhook', response) + if response.status_code == 201: + deserialized = self._deserialize('Webhook', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def update( + self, resource_group_name, registry_name, webhook_name, webhook_update_parameters, custom_headers=None, raw=False, polling=True, **operation_config): + """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.v2019_12_01_preview.models.WebhookUpdateParameters + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns Webhook or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.containerregistry.v2019_12_01_preview.models.Webhook] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.containerregistry.v2019_12_01_preview.models.Webhook]] + :raises: :class:`CloudError` + """ + 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, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('Webhook', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}'} + + def list( + self, resource_group_name, registry_name, custom_headers=None, raw=False, **operation_config): + """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 + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of Webhook + :rtype: + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.WebhookPaged[~azure.mgmt.containerregistry.v2019_12_01_preview.models.Webhook] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + 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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.WebhookPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks'} + + def ping( + self, resource_group_name, registry_name, webhook_name, custom_headers=None, raw=False, **operation_config): + """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 + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: EventInfo or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.EventInfo or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.ping.metadata['url'] + 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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('EventInfo', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + ping.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}/ping'} + + def get_callback_config( + self, resource_group_name, registry_name, webhook_name, custom_headers=None, raw=False, **operation_config): + """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 + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: CallbackConfig or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.CallbackConfig + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get_callback_config.metadata['url'] + 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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('CallbackConfig', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_callback_config.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}/getCallbackConfig'} + + def list_events( + self, resource_group_name, registry_name, webhook_name, custom_headers=None, raw=False, **operation_config): + """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 + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of Event + :rtype: + ~azure.mgmt.containerregistry.v2019_12_01_preview.models.EventPaged[~azure.mgmt.containerregistry.v2019_12_01_preview.models.Event] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_events.metadata['url'] + 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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.EventPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_events.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}/listEvents'} 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 new file mode 100644 index 000000000000..ac70be16717f --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_12_01_preview/version.py @@ -0,0 +1,13 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +VERSION = "2019-12-01-preview" +