From d0860ad7f7e1a1d392dadc8b22dd6d0ccac4b956 Mon Sep 17 00:00:00 2001 From: SwaggerToSDK Automation Date: Thu, 24 Aug 2017 23:21:00 +0000 Subject: [PATCH] Generated from 31d65bd57d71aef4e72a78877d8980eff32c883e --- .../v2017_06_01_preview/build.json | 2 +- .../v2017_06_01_preview/models/__init__.py | 2 + .../v2017_06_01_preview/models/event_paged.py | 2 +- .../models/operation_definition_paged.py | 2 +- .../models/registry_name_check_request.py | 2 +- .../models/registry_paged.py | 2 +- .../models/replication_paged.py | 2 +- .../models/replication_update_parameters.py | 27 ++++ .../models/webhook_paged.py | 2 +- .../operations/operations.py | 4 +- .../operations/registries_operations.py | 143 ++++++++++------ .../operations/replications_operations.py | 152 +++++++++++++++--- .../operations/webhooks_operations.py | 90 +++++++---- 13 files changed, 326 insertions(+), 106 deletions(-) create mode 100644 azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_06_01_preview/models/replication_update_parameters.py diff --git a/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_06_01_preview/build.json b/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_06_01_preview/build.json index 2712fb93e256..384218ff38e1 100644 --- a/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_06_01_preview/build.json +++ b/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_06_01_preview/build.json @@ -1 +1 @@ -{"autorest": "1.1.0", "date": "2017-06-30T21:38:07Z", "version": ""} \ No newline at end of file +{"autorest": "1.2.2", "date": "2017-08-24T23:20:58Z", "version": ""} \ No newline at end of file diff --git a/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_06_01_preview/models/__init__.py b/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_06_01_preview/models/__init__.py index cebd3948414a..4375e516b858 100644 --- a/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_06_01_preview/models/__init__.py +++ b/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_06_01_preview/models/__init__.py @@ -24,6 +24,7 @@ from .registry_usage import RegistryUsage from .registry_usage_list_result import RegistryUsageListResult from .replication import Replication +from .replication_update_parameters import ReplicationUpdateParameters from .webhook import Webhook from .webhook_create_parameters import WebhookCreateParameters from .webhook_update_parameters import WebhookUpdateParameters @@ -69,6 +70,7 @@ 'RegistryUsage', 'RegistryUsageListResult', 'Replication', + 'ReplicationUpdateParameters', 'Webhook', 'WebhookCreateParameters', 'WebhookUpdateParameters', diff --git a/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_06_01_preview/models/event_paged.py b/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_06_01_preview/models/event_paged.py index 11f691018158..a1e785c33601 100644 --- a/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_06_01_preview/models/event_paged.py +++ b/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_06_01_preview/models/event_paged.py @@ -14,7 +14,7 @@ class EventPaged(Paged): """ - A paging container for iterating over a list of Event object + A paging container for iterating over a list of :class:`Event ` object """ _attribute_map = { diff --git a/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_06_01_preview/models/operation_definition_paged.py b/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_06_01_preview/models/operation_definition_paged.py index e897da81a617..a2398d52c0bc 100644 --- a/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_06_01_preview/models/operation_definition_paged.py +++ b/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_06_01_preview/models/operation_definition_paged.py @@ -14,7 +14,7 @@ class OperationDefinitionPaged(Paged): """ - A paging container for iterating over a list of OperationDefinition object + A paging container for iterating over a list of :class:`OperationDefinition ` object """ _attribute_map = { diff --git a/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_06_01_preview/models/registry_name_check_request.py b/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_06_01_preview/models/registry_name_check_request.py index fd7c8b870c29..d83e4b3e1cd8 100644 --- a/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_06_01_preview/models/registry_name_check_request.py +++ b/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_06_01_preview/models/registry_name_check_request.py @@ -27,7 +27,7 @@ class RegistryNameCheckRequest(Model): """ _validation = { - 'name': {'required': True, 'max_length': 50, 'min_length': 5, 'pattern': '^[a-zA-Z0-9]*$'}, + 'name': {'required': True, 'max_length': 50, 'min_length': 5, 'pattern': r'^[a-zA-Z0-9]*$'}, 'type': {'required': True, 'constant': True}, } diff --git a/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_06_01_preview/models/registry_paged.py b/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_06_01_preview/models/registry_paged.py index d0f9a3f8a31a..72b219695a7d 100644 --- a/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_06_01_preview/models/registry_paged.py +++ b/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_06_01_preview/models/registry_paged.py @@ -14,7 +14,7 @@ class RegistryPaged(Paged): """ - A paging container for iterating over a list of Registry object + A paging container for iterating over a list of :class:`Registry ` object """ _attribute_map = { diff --git a/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_06_01_preview/models/replication_paged.py b/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_06_01_preview/models/replication_paged.py index b0ce75cee71d..924ae18fe9c8 100644 --- a/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_06_01_preview/models/replication_paged.py +++ b/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_06_01_preview/models/replication_paged.py @@ -14,7 +14,7 @@ class ReplicationPaged(Paged): """ - A paging container for iterating over a list of Replication object + A paging container for iterating over a list of :class:`Replication ` object """ _attribute_map = { diff --git a/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_06_01_preview/models/replication_update_parameters.py b/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_06_01_preview/models/replication_update_parameters.py new file mode 100644 index 000000000000..e2a133dfef17 --- /dev/null +++ b/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_06_01_preview/models/replication_update_parameters.py @@ -0,0 +1,27 @@ +# 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 ReplicationUpdateParameters(Model): + """The parameters for updating a replication. + + :param tags: The tags for the replication. + :type tags: dict + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, tags=None): + self.tags = tags diff --git a/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_06_01_preview/models/webhook_paged.py b/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_06_01_preview/models/webhook_paged.py index f081f88ca982..148a2d5cd4ac 100644 --- a/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_06_01_preview/models/webhook_paged.py +++ b/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_06_01_preview/models/webhook_paged.py @@ -14,7 +14,7 @@ class WebhookPaged(Paged): """ - A paging container for iterating over a list of Webhook object + A paging container for iterating over a list of :class:`Webhook ` object """ _attribute_map = { diff --git a/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_06_01_preview/operations/operations.py b/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_06_01_preview/operations/operations.py index 61d8aab91f11..363f0a99b13f 100644 --- a/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_06_01_preview/operations/operations.py +++ b/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_06_01_preview/operations/operations.py @@ -9,9 +9,9 @@ # regenerated. # -------------------------------------------------------------------------- +import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError -import uuid from .. import models @@ -45,6 +45,8 @@ def list( deserialized response :param operation_config: :ref:`Operation configuration overrides`. + :return: An iterator like instance of :class:`OperationDefinition + ` :rtype: :class:`OperationDefinitionPaged ` :raises: :class:`CloudError` diff --git a/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_06_01_preview/operations/registries_operations.py b/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_06_01_preview/operations/registries_operations.py index e1f2b32d0fb7..2a2e58b53c58 100644 --- a/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_06_01_preview/operations/registries_operations.py +++ b/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_06_01_preview/operations/registries_operations.py @@ -9,10 +9,10 @@ # regenerated. # -------------------------------------------------------------------------- +import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError from msrestazure.azure_operation import AzureOperationPoller -import uuid from .. import models @@ -49,10 +49,13 @@ def check_name_availability( deserialized response :param operation_config: :ref:`Operation configuration overrides`. + :return: :class:`RegistryNameStatus + ` + or :class:`ClientRawResponse` if + raw=true :rtype: :class:`RegistryNameStatus ` - :rtype: :class:`ClientRawResponse` - if raw=true + or :class:`ClientRawResponse` :raises: :class:`CloudError` """ registry_name_check_request = models.RegistryNameCheckRequest(name=name) @@ -116,10 +119,13 @@ def get( deserialized response :param operation_config: :ref:`Operation configuration overrides`. + :return: :class:`Registry + ` or + :class:`ClientRawResponse` if + raw=true :rtype: :class:`Registry - ` - :rtype: :class:`ClientRawResponse` - if raw=true + ` or + :class:`ClientRawResponse` :raises: :class:`CloudError` """ # Construct URL @@ -127,7 +133,7 @@ def get( 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'), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern='^[a-zA-Z0-9]*$') + '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) @@ -180,12 +186,15 @@ def create( :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response - :rtype: + :return: :class:`AzureOperationPoller` instance that returns :class:`Registry - ` - :rtype: :class:`ClientRawResponse` - if raw=true + ` or + :class:`ClientRawResponse` if + raw=true + :rtype: + :class:`AzureOperationPoller` + or :class:`ClientRawResponse` :raises: :class:`CloudError` """ # Construct URL @@ -193,7 +202,7 @@ def create( 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'), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern='^[a-zA-Z0-9]*$') + '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) @@ -272,11 +281,14 @@ def delete( :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response + :return: + :class:`AzureOperationPoller` + instance that returns None or + :class:`ClientRawResponse` if + raw=true :rtype: :class:`AzureOperationPoller` - instance that returns None - :rtype: :class:`ClientRawResponse` - if raw=true + or :class:`ClientRawResponse` :raises: :class:`CloudError` """ # Construct URL @@ -284,7 +296,7 @@ def delete( 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'), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern='^[a-zA-Z0-9]*$') + '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) @@ -354,12 +366,15 @@ def update( :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`. - :rtype: :class:`Registry - ` - :rtype: :class:`ClientRawResponse` - if raw=true + :return: + :class:`AzureOperationPoller` + instance that returns :class:`Registry + ` or + :class:`ClientRawResponse` if + raw=true + :rtype: + :class:`AzureOperationPoller` + or :class:`ClientRawResponse` :raises: :class:`CloudError` """ # Construct URL @@ -367,7 +382,7 @@ def update( 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'), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern='^[a-zA-Z0-9]*$') + '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) @@ -389,25 +404,50 @@ def update( body_content = self._serialize.body(registry_update_parameters, 'RegistryUpdateParameters') # Construct and send request - request = self._client.patch(url, query_parameters) - response = self._client.send( - request, header_parameters, body_content, **operation_config) + def long_running_send(): - if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + request = self._client.patch(url, query_parameters) + return self._client.send( + request, header_parameters, body_content, **operation_config) - deserialized = None + def get_long_running_status(status_link, headers=None): - if response.status_code == 200: - deserialized = self._deserialize('Registry', response) + request = self._client.get(status_link) + if headers: + request.headers.update(headers) + return self._client.send( + request, header_parameters, **operation_config) + + def get_long_running_output(response): + + 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 if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + response = long_running_send() + return get_long_running_output(response) - return deserialized + long_running_operation_timeout = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + return AzureOperationPoller( + long_running_send, get_long_running_output, + get_long_running_status, long_running_operation_timeout) def list_by_resource_group( self, resource_group_name, custom_headers=None, raw=False, **operation_config): @@ -421,6 +461,8 @@ def list_by_resource_group( deserialized response :param operation_config: :ref:`Operation configuration overrides`. + :return: An iterator like instance of :class:`Registry + ` :rtype: :class:`RegistryPaged ` :raises: :class:`CloudError` @@ -485,6 +527,8 @@ def list( deserialized response :param operation_config: :ref:`Operation configuration overrides`. + :return: An iterator like instance of :class:`Registry + ` :rtype: :class:`RegistryPaged ` :raises: :class:`CloudError` @@ -553,10 +597,13 @@ def list_credentials( deserialized response :param operation_config: :ref:`Operation configuration overrides`. + :return: :class:`RegistryListCredentialsResult + ` + or :class:`ClientRawResponse` if + raw=true :rtype: :class:`RegistryListCredentialsResult ` - :rtype: :class:`ClientRawResponse` - if raw=true + or :class:`ClientRawResponse` :raises: :class:`CloudError` """ # Construct URL @@ -564,7 +611,7 @@ def list_credentials( 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'), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern='^[a-zA-Z0-9]*$') + '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) @@ -622,10 +669,13 @@ def regenerate_credential( deserialized response :param operation_config: :ref:`Operation configuration overrides`. + :return: :class:`RegistryListCredentialsResult + ` + or :class:`ClientRawResponse` if + raw=true :rtype: :class:`RegistryListCredentialsResult ` - :rtype: :class:`ClientRawResponse` - if raw=true + or :class:`ClientRawResponse` :raises: :class:`CloudError` """ regenerate_credential_parameters = models.RegenerateCredentialParameters(name=name) @@ -635,7 +685,7 @@ def regenerate_credential( 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'), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern='^[a-zA-Z0-9]*$') + '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) @@ -691,10 +741,13 @@ def list_usages( deserialized response :param operation_config: :ref:`Operation configuration overrides`. + :return: :class:`RegistryUsageListResult + ` + or :class:`ClientRawResponse` if + raw=true :rtype: :class:`RegistryUsageListResult ` - :rtype: :class:`ClientRawResponse` - if raw=true + or :class:`ClientRawResponse` :raises: :class:`CloudError` """ # Construct URL @@ -702,7 +755,7 @@ def list_usages( 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'), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern='^[a-zA-Z0-9]*$') + '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) diff --git a/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_06_01_preview/operations/replications_operations.py b/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_06_01_preview/operations/replications_operations.py index 466d98450a89..1d89444ff2b1 100644 --- a/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_06_01_preview/operations/replications_operations.py +++ b/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_06_01_preview/operations/replications_operations.py @@ -9,10 +9,10 @@ # regenerated. # -------------------------------------------------------------------------- +import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError from msrestazure.azure_operation import AzureOperationPoller -import uuid from .. import models @@ -52,10 +52,13 @@ def get( deserialized response :param operation_config: :ref:`Operation configuration overrides`. + :return: :class:`Replication + ` + or :class:`ClientRawResponse` if + raw=true :rtype: :class:`Replication ` - :rtype: :class:`ClientRawResponse` - if raw=true + or :class:`ClientRawResponse` :raises: :class:`CloudError` """ # Construct URL @@ -63,8 +66,8 @@ def get( 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'), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern='^[a-zA-Z0-9]*$'), - 'replicationName': self._serialize.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern='^[a-zA-Z0-9]*$') + '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) @@ -102,10 +105,10 @@ def get( return deserialized - def create_or_update( + def create( self, resource_group_name, registry_name, replication_name, location, tags=None, custom_headers=None, raw=False, **operation_config): - """Creates or updates a replication for a container registry with the - specified parameters. + """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. @@ -122,12 +125,15 @@ def create_or_update( :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response - :rtype: + :return: :class:`AzureOperationPoller` instance that returns :class:`Replication ` - :rtype: :class:`ClientRawResponse` - if raw=true + or :class:`ClientRawResponse` if + raw=true + :rtype: + :class:`AzureOperationPoller` + or :class:`ClientRawResponse` :raises: :class:`CloudError` """ replication = models.Replication(location=location, tags=tags) @@ -137,8 +143,8 @@ def create_or_update( 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'), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern='^[a-zA-Z0-9]*$'), - 'replicationName': self._serialize.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern='^[a-zA-Z0-9]*$') + '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) @@ -219,11 +225,14 @@ def delete( :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response + :return: + :class:`AzureOperationPoller` + instance that returns None or + :class:`ClientRawResponse` if + raw=true :rtype: :class:`AzureOperationPoller` - instance that returns None - :rtype: :class:`ClientRawResponse` - if raw=true + or :class:`ClientRawResponse` :raises: :class:`CloudError` """ # Construct URL @@ -231,8 +240,8 @@ def delete( 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'), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern='^[a-zA-Z0-9]*$'), - 'replicationName': self._serialize.url("replication_name", replication_name, 'str', max_length=50, min_length=5, pattern='^[a-zA-Z0-9]*$') + '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) @@ -286,6 +295,109 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) + def update( + self, resource_group_name, registry_name, replication_name, tags=None, custom_headers=None, raw=False, **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 + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: + :class:`AzureOperationPoller` + instance that returns :class:`Replication + ` + or :class:`ClientRawResponse` if + raw=true + :rtype: + :class:`AzureOperationPoller` + or :class:`ClientRawResponse` + :raises: :class:`CloudError` + """ + replication_update_parameters = models.ReplicationUpdateParameters(tags=tags) + + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}' + 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'), + '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['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 + def long_running_send(): + + request = self._client.patch(url, query_parameters) + return self._client.send( + request, header_parameters, body_content, **operation_config) + + def get_long_running_status(status_link, headers=None): + + request = self._client.get(status_link) + if headers: + request.headers.update(headers) + return self._client.send( + request, header_parameters, **operation_config) + + def get_long_running_output(response): + + 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 + + if raw: + response = long_running_send() + return get_long_running_output(response) + + long_running_operation_timeout = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + return AzureOperationPoller( + long_running_send, get_long_running_output, + get_long_running_status, long_running_operation_timeout) + def list( self, resource_group_name, registry_name, custom_headers=None, raw=False, **operation_config): """Lists all the replications for the specified container registry. @@ -300,6 +412,8 @@ def list( deserialized response :param operation_config: :ref:`Operation configuration overrides`. + :return: An iterator like instance of :class:`Replication + ` :rtype: :class:`ReplicationPaged ` :raises: :class:`CloudError` @@ -312,7 +426,7 @@ def internal_paging(next_link=None, raw=False): 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'), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern='^[a-zA-Z0-9]*$') + '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) diff --git a/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_06_01_preview/operations/webhooks_operations.py b/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_06_01_preview/operations/webhooks_operations.py index af5fe629a3f3..fe73c2393d6b 100644 --- a/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_06_01_preview/operations/webhooks_operations.py +++ b/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_06_01_preview/operations/webhooks_operations.py @@ -9,10 +9,10 @@ # regenerated. # -------------------------------------------------------------------------- +import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError from msrestazure.azure_operation import AzureOperationPoller -import uuid from .. import models @@ -52,10 +52,13 @@ def get( deserialized response :param operation_config: :ref:`Operation configuration overrides`. + :return: :class:`Webhook + ` or + :class:`ClientRawResponse` if + raw=true :rtype: :class:`Webhook - ` - :rtype: :class:`ClientRawResponse` - if raw=true + ` or + :class:`ClientRawResponse` :raises: :class:`CloudError` """ # Construct URL @@ -63,8 +66,8 @@ def get( 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'), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern='^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern='^[a-zA-Z0-9]*$') + '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) @@ -121,12 +124,15 @@ def create( :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response - :rtype: + :return: :class:`AzureOperationPoller` instance that returns :class:`Webhook - ` - :rtype: :class:`ClientRawResponse` - if raw=true + ` or + :class:`ClientRawResponse` if + raw=true + :rtype: + :class:`AzureOperationPoller` + or :class:`ClientRawResponse` :raises: :class:`CloudError` """ # Construct URL @@ -134,8 +140,8 @@ def create( 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'), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern='^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern='^[a-zA-Z0-9]*$') + '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) @@ -216,11 +222,14 @@ def delete( :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response + :return: + :class:`AzureOperationPoller` + instance that returns None or + :class:`ClientRawResponse` if + raw=true :rtype: :class:`AzureOperationPoller` - instance that returns None - :rtype: :class:`ClientRawResponse` - if raw=true + or :class:`ClientRawResponse` :raises: :class:`CloudError` """ # Construct URL @@ -228,8 +237,8 @@ def delete( 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'), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern='^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern='^[a-zA-Z0-9]*$') + '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) @@ -301,12 +310,15 @@ def update( :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response - :rtype: + :return: :class:`AzureOperationPoller` instance that returns :class:`Webhook - ` - :rtype: :class:`ClientRawResponse` - if raw=true + ` or + :class:`ClientRawResponse` if + raw=true + :rtype: + :class:`AzureOperationPoller` + or :class:`ClientRawResponse` :raises: :class:`CloudError` """ # Construct URL @@ -314,8 +326,8 @@ def update( 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'), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern='^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern='^[a-zA-Z0-9]*$') + '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) @@ -396,6 +408,8 @@ def list( deserialized response :param operation_config: :ref:`Operation configuration overrides`. + :return: An iterator like instance of :class:`Webhook + ` :rtype: :class:`WebhookPaged ` :raises: :class:`CloudError` @@ -408,7 +422,7 @@ def internal_paging(next_link=None, raw=False): 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'), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern='^[a-zA-Z0-9]*$') + '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) @@ -468,10 +482,13 @@ def ping( deserialized response :param operation_config: :ref:`Operation configuration overrides`. + :return: :class:`EventInfo + ` + or :class:`ClientRawResponse` if + raw=true :rtype: :class:`EventInfo ` - :rtype: :class:`ClientRawResponse` - if raw=true + or :class:`ClientRawResponse` :raises: :class:`CloudError` """ # Construct URL @@ -479,8 +496,8 @@ def ping( 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'), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern='^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern='^[a-zA-Z0-9]*$') + '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) @@ -535,10 +552,13 @@ def get_callback_config( deserialized response :param operation_config: :ref:`Operation configuration overrides`. + :return: :class:`CallbackConfig + ` + or :class:`ClientRawResponse` if + raw=true :rtype: :class:`CallbackConfig ` - :rtype: :class:`ClientRawResponse` - if raw=true + or :class:`ClientRawResponse` :raises: :class:`CloudError` """ # Construct URL @@ -546,8 +566,8 @@ def get_callback_config( 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'), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern='^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern='^[a-zA-Z0-9]*$') + '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) @@ -601,6 +621,8 @@ def list_events( deserialized response :param operation_config: :ref:`Operation configuration overrides`. + :return: An iterator like instance of :class:`Event + ` :rtype: :class:`EventPaged ` :raises: :class:`CloudError` @@ -613,8 +635,8 @@ def internal_paging(next_link=None, raw=False): 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'), - 'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern='^[a-zA-Z0-9]*$'), - 'webhookName': self._serialize.url("webhook_name", webhook_name, 'str', max_length=50, min_length=5, pattern='^[a-zA-Z0-9]*$') + '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)