From d09a3f1300c265deb226ba79248d8911033c32f4 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Tue, 2 Feb 2021 03:21:07 +0000 Subject: [PATCH] CodeGen from PR 12756 in Azure/azure-rest-api-specs Add 2020-10-01-preview-only to python.md (#12756) * add 2020-10-01-only to python.md * fix --- .../compute/_compute_management_client.py | 56 + .../compute/aio/_compute_management_client.py | 56 + .../compute/v2019_03_01/models/__init__.py | 3 + .../_compute_management_client_enums.py | 4 +- .../compute/v2019_03_01/models/_models.py | 63 +- .../compute/v2019_03_01/models/_models_py3.py | 71 +- .../compute/v2019_07_01/models/__init__.py | 3 + .../_compute_management_client_enums.py | 2 +- .../compute/v2019_07_01/models/_models.py | 65 +- .../compute/v2019_07_01/models/_models_py3.py | 73 +- .../compute/v2019_12_01/models/__init__.py | 3 + .../compute/v2019_12_01/models/_models.py | 65 +- .../compute/v2019_12_01/models/_models_py3.py | 73 +- .../compute/v2020_06_01/models/_models.py | 2 +- .../compute/v2020_06_01/models/_models_py3.py | 2 +- .../compute/v2020_09_30/models/_models.py | 11 +- .../compute/v2020_09_30/models/_models_py3.py | 11 +- .../compute/v2020_10_01_preview/__init__.py | 16 + .../_compute_management_client.py | 84 + .../v2020_10_01_preview/_configuration.py | 70 + .../v2020_10_01_preview/_metadata.json | 64 + .../v2020_10_01_preview/aio/__init__.py | 10 + .../aio/_compute_management_client.py | 78 + .../v2020_10_01_preview/aio/_configuration.py | 66 + .../aio/operations/__init__.py | 19 + ...cloud_service_role_instances_operations.py | 780 +++++++++ .../_cloud_service_roles_operations.py | 179 +++ .../operations/_cloud_services_operations.py | 1371 ++++++++++++++++ ...cloud_services_update_domain_operations.py | 314 ++++ .../v2020_10_01_preview/models/__init__.py | 137 ++ .../_compute_management_client_enums.py | 50 + .../v2020_10_01_preview/models/_models.py | 1229 +++++++++++++++ .../v2020_10_01_preview/models/_models_py3.py | 1340 ++++++++++++++++ .../operations/__init__.py | 19 + ...cloud_service_role_instances_operations.py | 796 ++++++++++ .../_cloud_service_roles_operations.py | 185 +++ .../operations/_cloud_services_operations.py | 1397 +++++++++++++++++ ...cloud_services_update_domain_operations.py | 322 ++++ .../mgmt/compute/v2020_10_01_preview/py.typed | 1 + 39 files changed, 8990 insertions(+), 100 deletions(-) create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/__init__.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/_compute_management_client.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/_configuration.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/_metadata.json create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/aio/__init__.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/aio/_compute_management_client.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/aio/_configuration.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/aio/operations/__init__.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/aio/operations/_cloud_service_role_instances_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/aio/operations/_cloud_service_roles_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/aio/operations/_cloud_services_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/aio/operations/_cloud_services_update_domain_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/models/__init__.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/models/_compute_management_client_enums.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/models/_models.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/models/_models_py3.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/operations/__init__.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/operations/_cloud_service_role_instances_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/operations/_cloud_service_roles_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/operations/_cloud_services_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/operations/_cloud_services_update_domain_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/py.typed diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/_compute_management_client.py index 07182f9f4b05..f256c04c7b94 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/_compute_management_client.py @@ -122,6 +122,7 @@ def models(cls, api_version=DEFAULT_API_VERSION): * 2020-06-01: :mod:`v2020_06_01.models` * 2020-06-30: :mod:`v2020_06_30.models` * 2020-09-30: :mod:`v2020_09_30.models` + * 2020-10-01-preview: :mod:`v2020_10_01_preview.models` """ if api_version == '2015-06-15': from .v2015_06_15 import models @@ -180,6 +181,9 @@ def models(cls, api_version=DEFAULT_API_VERSION): elif api_version == '2020-09-30': from .v2020_09_30 import models return models + elif api_version == '2020-10-01-preview': + from .v2020_10_01_preview import models + return models raise ValueError("API version {} is not available".format(api_version)) @property @@ -228,6 +232,58 @@ def availability_sets(self): raise ValueError("API version {} does not have operation group 'availability_sets'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + @property + def cloud_service_role_instances(self): + """Instance depends on the API version: + + * 2020-10-01-preview: :class:`CloudServiceRoleInstancesOperations` + """ + api_version = self._get_api_version('cloud_service_role_instances') + if api_version == '2020-10-01-preview': + from .v2020_10_01_preview.operations import CloudServiceRoleInstancesOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'cloud_service_role_instances'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def cloud_service_roles(self): + """Instance depends on the API version: + + * 2020-10-01-preview: :class:`CloudServiceRolesOperations` + """ + api_version = self._get_api_version('cloud_service_roles') + if api_version == '2020-10-01-preview': + from .v2020_10_01_preview.operations import CloudServiceRolesOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'cloud_service_roles'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def cloud_services(self): + """Instance depends on the API version: + + * 2020-10-01-preview: :class:`CloudServicesOperations` + """ + api_version = self._get_api_version('cloud_services') + if api_version == '2020-10-01-preview': + from .v2020_10_01_preview.operations import CloudServicesOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'cloud_services'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def cloud_services_update_domain(self): + """Instance depends on the API version: + + * 2020-10-01-preview: :class:`CloudServicesUpdateDomainOperations` + """ + api_version = self._get_api_version('cloud_services_update_domain') + if api_version == '2020-10-01-preview': + from .v2020_10_01_preview.operations import CloudServicesUpdateDomainOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'cloud_services_update_domain'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + @property def dedicated_host_groups(self): """Instance depends on the API version: diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/_compute_management_client.py index 6f473131d35d..bd260a1831b8 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/_compute_management_client.py @@ -122,6 +122,7 @@ def models(cls, api_version=DEFAULT_API_VERSION): * 2020-06-01: :mod:`v2020_06_01.models` * 2020-06-30: :mod:`v2020_06_30.models` * 2020-09-30: :mod:`v2020_09_30.models` + * 2020-10-01-preview: :mod:`v2020_10_01_preview.models` """ if api_version == '2015-06-15': from ..v2015_06_15 import models @@ -180,6 +181,9 @@ def models(cls, api_version=DEFAULT_API_VERSION): elif api_version == '2020-09-30': from ..v2020_09_30 import models return models + elif api_version == '2020-10-01-preview': + from ..v2020_10_01_preview import models + return models raise ValueError("API version {} is not available".format(api_version)) @property @@ -228,6 +232,58 @@ def availability_sets(self): raise ValueError("API version {} does not have operation group 'availability_sets'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + @property + def cloud_service_role_instances(self): + """Instance depends on the API version: + + * 2020-10-01-preview: :class:`CloudServiceRoleInstancesOperations` + """ + api_version = self._get_api_version('cloud_service_role_instances') + if api_version == '2020-10-01-preview': + from ..v2020_10_01_preview.aio.operations import CloudServiceRoleInstancesOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'cloud_service_role_instances'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def cloud_service_roles(self): + """Instance depends on the API version: + + * 2020-10-01-preview: :class:`CloudServiceRolesOperations` + """ + api_version = self._get_api_version('cloud_service_roles') + if api_version == '2020-10-01-preview': + from ..v2020_10_01_preview.aio.operations import CloudServiceRolesOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'cloud_service_roles'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def cloud_services(self): + """Instance depends on the API version: + + * 2020-10-01-preview: :class:`CloudServicesOperations` + """ + api_version = self._get_api_version('cloud_services') + if api_version == '2020-10-01-preview': + from ..v2020_10_01_preview.aio.operations import CloudServicesOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'cloud_services'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def cloud_services_update_domain(self): + """Instance depends on the API version: + + * 2020-10-01-preview: :class:`CloudServicesUpdateDomainOperations` + """ + api_version = self._get_api_version('cloud_services_update_domain') + if api_version == '2020-10-01-preview': + from ..v2020_10_01_preview.aio.operations import CloudServicesUpdateDomainOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'cloud_services_update_domain'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + @property def dedicated_host_groups(self): """Instance depends on the API version: diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/models/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/models/__init__.py index 9cfc43b8bf87..998f7ba41e89 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/models/__init__.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/models/__init__.py @@ -144,6 +144,7 @@ from ._models_py3 import UpgradePolicy from ._models_py3 import Usage from ._models_py3 import UsageName + from ._models_py3 import UserArtifactManage from ._models_py3 import UserArtifactSource from ._models_py3 import UserAssignedIdentitiesValue from ._models_py3 import VMScaleSetConvertToSinglePlacementGroupInput @@ -358,6 +359,7 @@ from ._models import UpgradePolicy # type: ignore from ._models import Usage # type: ignore from ._models import UsageName # type: ignore + from ._models import UserArtifactManage # type: ignore from ._models import UserArtifactSource # type: ignore from ._models import UserAssignedIdentitiesValue # type: ignore from ._models import VMScaleSetConvertToSinglePlacementGroupInput # type: ignore @@ -619,6 +621,7 @@ 'UpgradePolicy', 'Usage', 'UsageName', + 'UserArtifactManage', 'UserArtifactSource', 'UserAssignedIdentitiesValue', 'VMScaleSetConvertToSinglePlacementGroupInput', diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/models/_compute_management_client_enums.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/models/_compute_management_client_enums.py index b6a6cd2f8b49..686b80d8b893 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/models/_compute_management_client_enums.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/models/_compute_management_client_enums.py @@ -230,7 +230,9 @@ class OperatingSystemStateTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, En SPECIALIZED = "Specialized" #: Specialized image. Contains already provisioned OS Disk. class OperatingSystemTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """The operating system of the osDiskImage. + """This property allows you to specify the supported type of the OS that application is built for. + :code:`
`:code:`
` Possible values are: :code:`
`:code:`
` **Windows** + :code:`
`:code:`
` **Linux** """ WINDOWS = "Windows" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/models/_models.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/models/_models.py index 84584b2e26a4..8895cf70ed61 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/models/_models.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/models/_models.py @@ -1790,7 +1790,7 @@ class GalleryApplicationVersion(Resource): :type location: str :param tags: A set of tags. Resource tags. :type tags: dict[str, str] - :param publishing_profile: The publishing profile of a gallery Image Version. + :param publishing_profile: The publishing profile of a gallery image version. :type publishing_profile: ~azure.mgmt.compute.v2019_03_01.models.GalleryApplicationVersionPublishingProfile :ivar provisioning_state: The provisioning state, which only appears in the response. Possible @@ -1913,7 +1913,7 @@ def __init__( class GalleryApplicationVersionPublishingProfile(GalleryArtifactPublishingProfileBase): - """The publishing profile of a gallery Image Version. + """The publishing profile of a gallery image version. Variables are only populated by the server, and will be ignored when sending a request. @@ -1939,9 +1939,8 @@ class GalleryApplicationVersionPublishingProfile(GalleryArtifactPublishingProfil :type storage_account_type: str or ~azure.mgmt.compute.v2019_03_01.models.StorageAccountType :param source: Required. The source image from which the Image Version is going to be created. :type source: ~azure.mgmt.compute.v2019_03_01.models.UserArtifactSource - :param content_type: Optional. May be used to help process this file. The type of file - contained in the source, e.g. zip, json, etc. - :type content_type: str + :param manage_actions: + :type manage_actions: ~azure.mgmt.compute.v2019_03_01.models.UserArtifactManage :param enable_health_check: Optional. Whether or not this application reports health. :type enable_health_check: bool """ @@ -1959,7 +1958,7 @@ class GalleryApplicationVersionPublishingProfile(GalleryArtifactPublishingProfil 'end_of_life_date': {'key': 'endOfLifeDate', 'type': 'iso-8601'}, 'storage_account_type': {'key': 'storageAccountType', 'type': 'str'}, 'source': {'key': 'source', 'type': 'UserArtifactSource'}, - 'content_type': {'key': 'contentType', 'type': 'str'}, + 'manage_actions': {'key': 'manageActions', 'type': 'UserArtifactManage'}, 'enable_health_check': {'key': 'enableHealthCheck', 'type': 'bool'}, } @@ -1969,7 +1968,7 @@ def __init__( ): super(GalleryApplicationVersionPublishingProfile, self).__init__(**kwargs) self.source = kwargs['source'] - self.content_type = kwargs.get('content_type', None) + self.manage_actions = kwargs.get('manage_actions', None) self.enable_health_check = kwargs.get('enable_health_check', None) @@ -5278,26 +5277,64 @@ def __init__( self.localized_value = kwargs.get('localized_value', None) +class UserArtifactManage(msrest.serialization.Model): + """UserArtifactManage. + + All required parameters must be populated in order to send to Azure. + + :param install: Required. Required. The path and arguments to install the gallery application. + This is limited to 4096 characters. + :type install: str + :param remove: Required. Required. The path and arguments to remove the gallery application. + This is limited to 4096 characters. + :type remove: str + :param update: Optional. The path and arguments to update the gallery application. If not + present, then update operation will invoke remove command on the previous version and install + command on the current version of the gallery application. This is limited to 4096 characters. + :type update: str + """ + + _validation = { + 'install': {'required': True}, + 'remove': {'required': True}, + } + + _attribute_map = { + 'install': {'key': 'install', 'type': 'str'}, + 'remove': {'key': 'remove', 'type': 'str'}, + 'update': {'key': 'update', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(UserArtifactManage, self).__init__(**kwargs) + self.install = kwargs['install'] + self.remove = kwargs['remove'] + self.update = kwargs.get('update', None) + + class UserArtifactSource(msrest.serialization.Model): """The source image from which the Image Version is going to be created. All required parameters must be populated in order to send to Azure. - :param file_name: Required. Required. The fileName of the artifact. - :type file_name: str :param media_link: Required. Required. The mediaLink of the artifact, must be a readable - storage blob. + storage page blob. :type media_link: str + :param default_configuration_link: Optional. The defaultConfigurationLink of the artifact, must + be a readable storage page blob. + :type default_configuration_link: str """ _validation = { - 'file_name': {'required': True}, 'media_link': {'required': True}, } _attribute_map = { - 'file_name': {'key': 'fileName', 'type': 'str'}, 'media_link': {'key': 'mediaLink', 'type': 'str'}, + 'default_configuration_link': {'key': 'defaultConfigurationLink', 'type': 'str'}, } def __init__( @@ -5305,8 +5342,8 @@ def __init__( **kwargs ): super(UserArtifactSource, self).__init__(**kwargs) - self.file_name = kwargs['file_name'] self.media_link = kwargs['media_link'] + self.default_configuration_link = kwargs.get('default_configuration_link', None) class UserAssignedIdentitiesValue(msrest.serialization.Model): diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/models/_models_py3.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/models/_models_py3.py index 2ef70acccf80..40bea055ee16 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/models/_models_py3.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/models/_models_py3.py @@ -1964,7 +1964,7 @@ class GalleryApplicationVersion(Resource): :type location: str :param tags: A set of tags. Resource tags. :type tags: dict[str, str] - :param publishing_profile: The publishing profile of a gallery Image Version. + :param publishing_profile: The publishing profile of a gallery image version. :type publishing_profile: ~azure.mgmt.compute.v2019_03_01.models.GalleryApplicationVersionPublishingProfile :ivar provisioning_state: The provisioning state, which only appears in the response. Possible @@ -2100,7 +2100,7 @@ def __init__( class GalleryApplicationVersionPublishingProfile(GalleryArtifactPublishingProfileBase): - """The publishing profile of a gallery Image Version. + """The publishing profile of a gallery image version. Variables are only populated by the server, and will be ignored when sending a request. @@ -2126,9 +2126,8 @@ class GalleryApplicationVersionPublishingProfile(GalleryArtifactPublishingProfil :type storage_account_type: str or ~azure.mgmt.compute.v2019_03_01.models.StorageAccountType :param source: Required. The source image from which the Image Version is going to be created. :type source: ~azure.mgmt.compute.v2019_03_01.models.UserArtifactSource - :param content_type: Optional. May be used to help process this file. The type of file - contained in the source, e.g. zip, json, etc. - :type content_type: str + :param manage_actions: + :type manage_actions: ~azure.mgmt.compute.v2019_03_01.models.UserArtifactManage :param enable_health_check: Optional. Whether or not this application reports health. :type enable_health_check: bool """ @@ -2146,7 +2145,7 @@ class GalleryApplicationVersionPublishingProfile(GalleryArtifactPublishingProfil 'end_of_life_date': {'key': 'endOfLifeDate', 'type': 'iso-8601'}, 'storage_account_type': {'key': 'storageAccountType', 'type': 'str'}, 'source': {'key': 'source', 'type': 'UserArtifactSource'}, - 'content_type': {'key': 'contentType', 'type': 'str'}, + 'manage_actions': {'key': 'manageActions', 'type': 'UserArtifactManage'}, 'enable_health_check': {'key': 'enableHealthCheck', 'type': 'bool'}, } @@ -2159,13 +2158,13 @@ def __init__( exclude_from_latest: Optional[bool] = None, end_of_life_date: Optional[datetime.datetime] = None, storage_account_type: Optional[Union[str, "StorageAccountType"]] = None, - content_type: Optional[str] = None, + manage_actions: Optional["UserArtifactManage"] = None, enable_health_check: Optional[bool] = None, **kwargs ): super(GalleryApplicationVersionPublishingProfile, self).__init__(target_regions=target_regions, replica_count=replica_count, exclude_from_latest=exclude_from_latest, end_of_life_date=end_of_life_date, storage_account_type=storage_account_type, **kwargs) self.source = source - self.content_type = content_type + self.manage_actions = manage_actions self.enable_health_check = enable_health_check @@ -5782,38 +5781,80 @@ def __init__( self.localized_value = localized_value +class UserArtifactManage(msrest.serialization.Model): + """UserArtifactManage. + + All required parameters must be populated in order to send to Azure. + + :param install: Required. Required. The path and arguments to install the gallery application. + This is limited to 4096 characters. + :type install: str + :param remove: Required. Required. The path and arguments to remove the gallery application. + This is limited to 4096 characters. + :type remove: str + :param update: Optional. The path and arguments to update the gallery application. If not + present, then update operation will invoke remove command on the previous version and install + command on the current version of the gallery application. This is limited to 4096 characters. + :type update: str + """ + + _validation = { + 'install': {'required': True}, + 'remove': {'required': True}, + } + + _attribute_map = { + 'install': {'key': 'install', 'type': 'str'}, + 'remove': {'key': 'remove', 'type': 'str'}, + 'update': {'key': 'update', 'type': 'str'}, + } + + def __init__( + self, + *, + install: str, + remove: str, + update: Optional[str] = None, + **kwargs + ): + super(UserArtifactManage, self).__init__(**kwargs) + self.install = install + self.remove = remove + self.update = update + + class UserArtifactSource(msrest.serialization.Model): """The source image from which the Image Version is going to be created. All required parameters must be populated in order to send to Azure. - :param file_name: Required. Required. The fileName of the artifact. - :type file_name: str :param media_link: Required. Required. The mediaLink of the artifact, must be a readable - storage blob. + storage page blob. :type media_link: str + :param default_configuration_link: Optional. The defaultConfigurationLink of the artifact, must + be a readable storage page blob. + :type default_configuration_link: str """ _validation = { - 'file_name': {'required': True}, 'media_link': {'required': True}, } _attribute_map = { - 'file_name': {'key': 'fileName', 'type': 'str'}, 'media_link': {'key': 'mediaLink', 'type': 'str'}, + 'default_configuration_link': {'key': 'defaultConfigurationLink', 'type': 'str'}, } def __init__( self, *, - file_name: str, media_link: str, + default_configuration_link: Optional[str] = None, **kwargs ): super(UserArtifactSource, self).__init__(**kwargs) - self.file_name = file_name self.media_link = media_link + self.default_configuration_link = default_configuration_link class UserAssignedIdentitiesValue(msrest.serialization.Model): diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/models/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/models/__init__.py index 705444a63a8e..17aabb899970 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/models/__init__.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/models/__init__.py @@ -158,6 +158,7 @@ from ._models_py3 import UpgradePolicy from ._models_py3 import Usage from ._models_py3 import UsageName + from ._models_py3 import UserArtifactManage from ._models_py3 import UserArtifactSource from ._models_py3 import UserAssignedIdentitiesValue from ._models_py3 import VMScaleSetConvertToSinglePlacementGroupInput @@ -387,6 +388,7 @@ from ._models import UpgradePolicy # type: ignore from ._models import Usage # type: ignore from ._models import UsageName # type: ignore + from ._models import UserArtifactManage # type: ignore from ._models import UserArtifactSource # type: ignore from ._models import UserAssignedIdentitiesValue # type: ignore from ._models import VMScaleSetConvertToSinglePlacementGroupInput # type: ignore @@ -665,6 +667,7 @@ 'UpgradePolicy', 'Usage', 'UsageName', + 'UserArtifactManage', 'UserArtifactSource', 'UserAssignedIdentitiesValue', 'VMScaleSetConvertToSinglePlacementGroupInput', diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/models/_compute_management_client_enums.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/models/_compute_management_client_enums.py index db5174b68e4e..2c8c68dcba49 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/models/_compute_management_client_enums.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/models/_compute_management_client_enums.py @@ -243,7 +243,7 @@ class OperatingSystemStateTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, En SPECIALIZED = "Specialized" #: Specialized image. Contains already provisioned OS Disk. class OperatingSystemTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """The operating system of the osDiskImage. + """The Operating System type. """ WINDOWS = "Windows" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/models/_models.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/models/_models.py index 7ea5aff57707..b753791be8ba 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/models/_models.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/models/_models.py @@ -2085,7 +2085,7 @@ class GalleryApplicationVersion(Resource): :type location: str :param tags: A set of tags. Resource tags. :type tags: dict[str, str] - :param publishing_profile: The publishing profile of a gallery Image Version. + :param publishing_profile: The publishing profile of a gallery image version. :type publishing_profile: ~azure.mgmt.compute.v2019_07_01.models.GalleryApplicationVersionPublishingProfile :ivar provisioning_state: The provisioning state, which only appears in the response. Possible @@ -2208,7 +2208,7 @@ def __init__( class GalleryApplicationVersionPublishingProfile(GalleryArtifactPublishingProfileBase): - """The publishing profile of a gallery Image Version. + """The publishing profile of a gallery image version. Variables are only populated by the server, and will be ignored when sending a request. @@ -2234,9 +2234,8 @@ class GalleryApplicationVersionPublishingProfile(GalleryArtifactPublishingProfil :type storage_account_type: str or ~azure.mgmt.compute.v2019_07_01.models.StorageAccountType :param source: Required. The source image from which the Image Version is going to be created. :type source: ~azure.mgmt.compute.v2019_07_01.models.UserArtifactSource - :param content_type: Optional. May be used to help process this file. The type of file - contained in the source, e.g. zip, json, etc. - :type content_type: str + :param manage_actions: + :type manage_actions: ~azure.mgmt.compute.v2019_07_01.models.UserArtifactManage :param enable_health_check: Optional. Whether or not this application reports health. :type enable_health_check: bool """ @@ -2254,7 +2253,7 @@ class GalleryApplicationVersionPublishingProfile(GalleryArtifactPublishingProfil 'end_of_life_date': {'key': 'endOfLifeDate', 'type': 'iso-8601'}, 'storage_account_type': {'key': 'storageAccountType', 'type': 'str'}, 'source': {'key': 'source', 'type': 'UserArtifactSource'}, - 'content_type': {'key': 'contentType', 'type': 'str'}, + 'manage_actions': {'key': 'manageActions', 'type': 'UserArtifactManage'}, 'enable_health_check': {'key': 'enableHealthCheck', 'type': 'bool'}, } @@ -2264,7 +2263,7 @@ def __init__( ): super(GalleryApplicationVersionPublishingProfile, self).__init__(**kwargs) self.source = kwargs['source'] - self.content_type = kwargs.get('content_type', None) + self.manage_actions = kwargs.get('manage_actions', None) self.enable_health_check = kwargs.get('enable_health_check', None) @@ -2275,7 +2274,7 @@ class GalleryApplicationVersionUpdate(UpdateResource): :param tags: A set of tags. Resource tags. :type tags: dict[str, str] - :param publishing_profile: The publishing profile of a gallery Image Version. + :param publishing_profile: The publishing profile of a gallery image version. :type publishing_profile: ~azure.mgmt.compute.v2019_07_01.models.GalleryApplicationVersionPublishingProfile :ivar provisioning_state: The provisioning state, which only appears in the response. Possible @@ -5897,26 +5896,64 @@ def __init__( self.localized_value = kwargs.get('localized_value', None) +class UserArtifactManage(msrest.serialization.Model): + """UserArtifactManage. + + All required parameters must be populated in order to send to Azure. + + :param install: Required. Required. The path and arguments to install the gallery application. + This is limited to 4096 characters. + :type install: str + :param remove: Required. Required. The path and arguments to remove the gallery application. + This is limited to 4096 characters. + :type remove: str + :param update: Optional. The path and arguments to update the gallery application. If not + present, then update operation will invoke remove command on the previous version and install + command on the current version of the gallery application. This is limited to 4096 characters. + :type update: str + """ + + _validation = { + 'install': {'required': True}, + 'remove': {'required': True}, + } + + _attribute_map = { + 'install': {'key': 'install', 'type': 'str'}, + 'remove': {'key': 'remove', 'type': 'str'}, + 'update': {'key': 'update', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(UserArtifactManage, self).__init__(**kwargs) + self.install = kwargs['install'] + self.remove = kwargs['remove'] + self.update = kwargs.get('update', None) + + class UserArtifactSource(msrest.serialization.Model): """The source image from which the Image Version is going to be created. All required parameters must be populated in order to send to Azure. - :param file_name: Required. Required. The fileName of the artifact. - :type file_name: str :param media_link: Required. Required. The mediaLink of the artifact, must be a readable - storage blob. + storage page blob. :type media_link: str + :param default_configuration_link: Optional. The defaultConfigurationLink of the artifact, must + be a readable storage page blob. + :type default_configuration_link: str """ _validation = { - 'file_name': {'required': True}, 'media_link': {'required': True}, } _attribute_map = { - 'file_name': {'key': 'fileName', 'type': 'str'}, 'media_link': {'key': 'mediaLink', 'type': 'str'}, + 'default_configuration_link': {'key': 'defaultConfigurationLink', 'type': 'str'}, } def __init__( @@ -5924,8 +5961,8 @@ def __init__( **kwargs ): super(UserArtifactSource, self).__init__(**kwargs) - self.file_name = kwargs['file_name'] self.media_link = kwargs['media_link'] + self.default_configuration_link = kwargs.get('default_configuration_link', None) class UserAssignedIdentitiesValue(msrest.serialization.Model): diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/models/_models_py3.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/models/_models_py3.py index fdb9722539de..75cb44c41166 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/models/_models_py3.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/models/_models_py3.py @@ -2289,7 +2289,7 @@ class GalleryApplicationVersion(Resource): :type location: str :param tags: A set of tags. Resource tags. :type tags: dict[str, str] - :param publishing_profile: The publishing profile of a gallery Image Version. + :param publishing_profile: The publishing profile of a gallery image version. :type publishing_profile: ~azure.mgmt.compute.v2019_07_01.models.GalleryApplicationVersionPublishingProfile :ivar provisioning_state: The provisioning state, which only appears in the response. Possible @@ -2425,7 +2425,7 @@ def __init__( class GalleryApplicationVersionPublishingProfile(GalleryArtifactPublishingProfileBase): - """The publishing profile of a gallery Image Version. + """The publishing profile of a gallery image version. Variables are only populated by the server, and will be ignored when sending a request. @@ -2451,9 +2451,8 @@ class GalleryApplicationVersionPublishingProfile(GalleryArtifactPublishingProfil :type storage_account_type: str or ~azure.mgmt.compute.v2019_07_01.models.StorageAccountType :param source: Required. The source image from which the Image Version is going to be created. :type source: ~azure.mgmt.compute.v2019_07_01.models.UserArtifactSource - :param content_type: Optional. May be used to help process this file. The type of file - contained in the source, e.g. zip, json, etc. - :type content_type: str + :param manage_actions: + :type manage_actions: ~azure.mgmt.compute.v2019_07_01.models.UserArtifactManage :param enable_health_check: Optional. Whether or not this application reports health. :type enable_health_check: bool """ @@ -2471,7 +2470,7 @@ class GalleryApplicationVersionPublishingProfile(GalleryArtifactPublishingProfil 'end_of_life_date': {'key': 'endOfLifeDate', 'type': 'iso-8601'}, 'storage_account_type': {'key': 'storageAccountType', 'type': 'str'}, 'source': {'key': 'source', 'type': 'UserArtifactSource'}, - 'content_type': {'key': 'contentType', 'type': 'str'}, + 'manage_actions': {'key': 'manageActions', 'type': 'UserArtifactManage'}, 'enable_health_check': {'key': 'enableHealthCheck', 'type': 'bool'}, } @@ -2484,13 +2483,13 @@ def __init__( exclude_from_latest: Optional[bool] = None, end_of_life_date: Optional[datetime.datetime] = None, storage_account_type: Optional[Union[str, "StorageAccountType"]] = None, - content_type: Optional[str] = None, + manage_actions: Optional["UserArtifactManage"] = None, enable_health_check: Optional[bool] = None, **kwargs ): super(GalleryApplicationVersionPublishingProfile, self).__init__(target_regions=target_regions, replica_count=replica_count, exclude_from_latest=exclude_from_latest, end_of_life_date=end_of_life_date, storage_account_type=storage_account_type, **kwargs) self.source = source - self.content_type = content_type + self.manage_actions = manage_actions self.enable_health_check = enable_health_check @@ -2501,7 +2500,7 @@ class GalleryApplicationVersionUpdate(UpdateResource): :param tags: A set of tags. Resource tags. :type tags: dict[str, str] - :param publishing_profile: The publishing profile of a gallery Image Version. + :param publishing_profile: The publishing profile of a gallery image version. :type publishing_profile: ~azure.mgmt.compute.v2019_07_01.models.GalleryApplicationVersionPublishingProfile :ivar provisioning_state: The provisioning state, which only appears in the response. Possible @@ -6488,38 +6487,80 @@ def __init__( self.localized_value = localized_value +class UserArtifactManage(msrest.serialization.Model): + """UserArtifactManage. + + All required parameters must be populated in order to send to Azure. + + :param install: Required. Required. The path and arguments to install the gallery application. + This is limited to 4096 characters. + :type install: str + :param remove: Required. Required. The path and arguments to remove the gallery application. + This is limited to 4096 characters. + :type remove: str + :param update: Optional. The path and arguments to update the gallery application. If not + present, then update operation will invoke remove command on the previous version and install + command on the current version of the gallery application. This is limited to 4096 characters. + :type update: str + """ + + _validation = { + 'install': {'required': True}, + 'remove': {'required': True}, + } + + _attribute_map = { + 'install': {'key': 'install', 'type': 'str'}, + 'remove': {'key': 'remove', 'type': 'str'}, + 'update': {'key': 'update', 'type': 'str'}, + } + + def __init__( + self, + *, + install: str, + remove: str, + update: Optional[str] = None, + **kwargs + ): + super(UserArtifactManage, self).__init__(**kwargs) + self.install = install + self.remove = remove + self.update = update + + class UserArtifactSource(msrest.serialization.Model): """The source image from which the Image Version is going to be created. All required parameters must be populated in order to send to Azure. - :param file_name: Required. Required. The fileName of the artifact. - :type file_name: str :param media_link: Required. Required. The mediaLink of the artifact, must be a readable - storage blob. + storage page blob. :type media_link: str + :param default_configuration_link: Optional. The defaultConfigurationLink of the artifact, must + be a readable storage page blob. + :type default_configuration_link: str """ _validation = { - 'file_name': {'required': True}, 'media_link': {'required': True}, } _attribute_map = { - 'file_name': {'key': 'fileName', 'type': 'str'}, 'media_link': {'key': 'mediaLink', 'type': 'str'}, + 'default_configuration_link': {'key': 'defaultConfigurationLink', 'type': 'str'}, } def __init__( self, *, - file_name: str, media_link: str, + default_configuration_link: Optional[str] = None, **kwargs ): super(UserArtifactSource, self).__init__(**kwargs) - self.file_name = file_name self.media_link = media_link + self.default_configuration_link = default_configuration_link class UserAssignedIdentitiesValue(msrest.serialization.Model): diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/models/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/models/__init__.py index c270d3b51252..cc5ac42515d4 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/models/__init__.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/models/__init__.py @@ -147,6 +147,7 @@ from ._models_py3 import UpgradePolicy from ._models_py3 import Usage from ._models_py3 import UsageName + from ._models_py3 import UserArtifactManage from ._models_py3 import UserArtifactSource from ._models_py3 import UserAssignedIdentitiesValue from ._models_py3 import VMScaleSetConvertToSinglePlacementGroupInput @@ -365,6 +366,7 @@ from ._models import UpgradePolicy # type: ignore from ._models import Usage # type: ignore from ._models import UsageName # type: ignore + from ._models import UserArtifactManage # type: ignore from ._models import UserArtifactSource # type: ignore from ._models import UserAssignedIdentitiesValue # type: ignore from ._models import VMScaleSetConvertToSinglePlacementGroupInput # type: ignore @@ -629,6 +631,7 @@ 'UpgradePolicy', 'Usage', 'UsageName', + 'UserArtifactManage', 'UserArtifactSource', 'UserAssignedIdentitiesValue', 'VMScaleSetConvertToSinglePlacementGroupInput', diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/models/_models.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/models/_models.py index 9a66882ad198..c91bc832c271 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/models/_models.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/models/_models.py @@ -1652,7 +1652,7 @@ class GalleryApplicationVersion(Resource): :type location: str :param tags: A set of tags. Resource tags. :type tags: dict[str, str] - :param publishing_profile: The publishing profile of a gallery Image Version. + :param publishing_profile: The publishing profile of a gallery image version. :type publishing_profile: ~azure.mgmt.compute.v2019_12_01.models.GalleryApplicationVersionPublishingProfile :ivar provisioning_state: The provisioning state, which only appears in the response. Possible @@ -1776,7 +1776,7 @@ def __init__( class GalleryApplicationVersionPublishingProfile(GalleryArtifactPublishingProfileBase): - """The publishing profile of a gallery Image Version. + """The publishing profile of a gallery image version. Variables are only populated by the server, and will be ignored when sending a request. @@ -1803,9 +1803,8 @@ class GalleryApplicationVersionPublishingProfile(GalleryArtifactPublishingProfil :type storage_account_type: str or ~azure.mgmt.compute.v2019_12_01.models.StorageAccountType :param source: Required. The source image from which the Image Version is going to be created. :type source: ~azure.mgmt.compute.v2019_12_01.models.UserArtifactSource - :param content_type: Optional. May be used to help process this file. The type of file - contained in the source, e.g. zip, json, etc. - :type content_type: str + :param manage_actions: + :type manage_actions: ~azure.mgmt.compute.v2019_12_01.models.UserArtifactManage :param enable_health_check: Optional. Whether or not this application reports health. :type enable_health_check: bool """ @@ -1823,7 +1822,7 @@ class GalleryApplicationVersionPublishingProfile(GalleryArtifactPublishingProfil 'end_of_life_date': {'key': 'endOfLifeDate', 'type': 'iso-8601'}, 'storage_account_type': {'key': 'storageAccountType', 'type': 'str'}, 'source': {'key': 'source', 'type': 'UserArtifactSource'}, - 'content_type': {'key': 'contentType', 'type': 'str'}, + 'manage_actions': {'key': 'manageActions', 'type': 'UserArtifactManage'}, 'enable_health_check': {'key': 'enableHealthCheck', 'type': 'bool'}, } @@ -1833,7 +1832,7 @@ def __init__( ): super(GalleryApplicationVersionPublishingProfile, self).__init__(**kwargs) self.source = kwargs['source'] - self.content_type = kwargs.get('content_type', None) + self.manage_actions = kwargs.get('manage_actions', None) self.enable_health_check = kwargs.get('enable_health_check', None) @@ -1850,7 +1849,7 @@ class GalleryApplicationVersionUpdate(UpdateResourceDefinition): :vartype type: str :param tags: A set of tags. Resource tags. :type tags: dict[str, str] - :param publishing_profile: The publishing profile of a gallery Image Version. + :param publishing_profile: The publishing profile of a gallery image version. :type publishing_profile: ~azure.mgmt.compute.v2019_12_01.models.GalleryApplicationVersionPublishingProfile :ivar provisioning_state: The provisioning state, which only appears in the response. Possible @@ -5395,26 +5394,64 @@ def __init__( self.localized_value = kwargs.get('localized_value', None) +class UserArtifactManage(msrest.serialization.Model): + """UserArtifactManage. + + All required parameters must be populated in order to send to Azure. + + :param install: Required. Required. The path and arguments to install the gallery application. + This is limited to 4096 characters. + :type install: str + :param remove: Required. Required. The path and arguments to remove the gallery application. + This is limited to 4096 characters. + :type remove: str + :param update: Optional. The path and arguments to update the gallery application. If not + present, then update operation will invoke remove command on the previous version and install + command on the current version of the gallery application. This is limited to 4096 characters. + :type update: str + """ + + _validation = { + 'install': {'required': True}, + 'remove': {'required': True}, + } + + _attribute_map = { + 'install': {'key': 'install', 'type': 'str'}, + 'remove': {'key': 'remove', 'type': 'str'}, + 'update': {'key': 'update', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(UserArtifactManage, self).__init__(**kwargs) + self.install = kwargs['install'] + self.remove = kwargs['remove'] + self.update = kwargs.get('update', None) + + class UserArtifactSource(msrest.serialization.Model): """The source image from which the Image Version is going to be created. All required parameters must be populated in order to send to Azure. - :param file_name: Required. Required. The fileName of the artifact. - :type file_name: str :param media_link: Required. Required. The mediaLink of the artifact, must be a readable - storage blob. + storage page blob. :type media_link: str + :param default_configuration_link: Optional. The defaultConfigurationLink of the artifact, must + be a readable storage page blob. + :type default_configuration_link: str """ _validation = { - 'file_name': {'required': True}, 'media_link': {'required': True}, } _attribute_map = { - 'file_name': {'key': 'fileName', 'type': 'str'}, 'media_link': {'key': 'mediaLink', 'type': 'str'}, + 'default_configuration_link': {'key': 'defaultConfigurationLink', 'type': 'str'}, } def __init__( @@ -5422,8 +5459,8 @@ def __init__( **kwargs ): super(UserArtifactSource, self).__init__(**kwargs) - self.file_name = kwargs['file_name'] self.media_link = kwargs['media_link'] + self.default_configuration_link = kwargs.get('default_configuration_link', None) class UserAssignedIdentitiesValue(msrest.serialization.Model): diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/models/_models_py3.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/models/_models_py3.py index 96ca84e142b9..74f50d4c0c7a 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/models/_models_py3.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/models/_models_py3.py @@ -1810,7 +1810,7 @@ class GalleryApplicationVersion(Resource): :type location: str :param tags: A set of tags. Resource tags. :type tags: dict[str, str] - :param publishing_profile: The publishing profile of a gallery Image Version. + :param publishing_profile: The publishing profile of a gallery image version. :type publishing_profile: ~azure.mgmt.compute.v2019_12_01.models.GalleryApplicationVersionPublishingProfile :ivar provisioning_state: The provisioning state, which only appears in the response. Possible @@ -1947,7 +1947,7 @@ def __init__( class GalleryApplicationVersionPublishingProfile(GalleryArtifactPublishingProfileBase): - """The publishing profile of a gallery Image Version. + """The publishing profile of a gallery image version. Variables are only populated by the server, and will be ignored when sending a request. @@ -1974,9 +1974,8 @@ class GalleryApplicationVersionPublishingProfile(GalleryArtifactPublishingProfil :type storage_account_type: str or ~azure.mgmt.compute.v2019_12_01.models.StorageAccountType :param source: Required. The source image from which the Image Version is going to be created. :type source: ~azure.mgmt.compute.v2019_12_01.models.UserArtifactSource - :param content_type: Optional. May be used to help process this file. The type of file - contained in the source, e.g. zip, json, etc. - :type content_type: str + :param manage_actions: + :type manage_actions: ~azure.mgmt.compute.v2019_12_01.models.UserArtifactManage :param enable_health_check: Optional. Whether or not this application reports health. :type enable_health_check: bool """ @@ -1994,7 +1993,7 @@ class GalleryApplicationVersionPublishingProfile(GalleryArtifactPublishingProfil 'end_of_life_date': {'key': 'endOfLifeDate', 'type': 'iso-8601'}, 'storage_account_type': {'key': 'storageAccountType', 'type': 'str'}, 'source': {'key': 'source', 'type': 'UserArtifactSource'}, - 'content_type': {'key': 'contentType', 'type': 'str'}, + 'manage_actions': {'key': 'manageActions', 'type': 'UserArtifactManage'}, 'enable_health_check': {'key': 'enableHealthCheck', 'type': 'bool'}, } @@ -2007,13 +2006,13 @@ def __init__( exclude_from_latest: Optional[bool] = None, end_of_life_date: Optional[datetime.datetime] = None, storage_account_type: Optional[Union[str, "StorageAccountType"]] = None, - content_type: Optional[str] = None, + manage_actions: Optional["UserArtifactManage"] = None, enable_health_check: Optional[bool] = None, **kwargs ): super(GalleryApplicationVersionPublishingProfile, self).__init__(target_regions=target_regions, replica_count=replica_count, exclude_from_latest=exclude_from_latest, end_of_life_date=end_of_life_date, storage_account_type=storage_account_type, **kwargs) self.source = source - self.content_type = content_type + self.manage_actions = manage_actions self.enable_health_check = enable_health_check @@ -2030,7 +2029,7 @@ class GalleryApplicationVersionUpdate(UpdateResourceDefinition): :vartype type: str :param tags: A set of tags. Resource tags. :type tags: dict[str, str] - :param publishing_profile: The publishing profile of a gallery Image Version. + :param publishing_profile: The publishing profile of a gallery image version. :type publishing_profile: ~azure.mgmt.compute.v2019_12_01.models.GalleryApplicationVersionPublishingProfile :ivar provisioning_state: The provisioning state, which only appears in the response. Possible @@ -5923,38 +5922,80 @@ def __init__( self.localized_value = localized_value +class UserArtifactManage(msrest.serialization.Model): + """UserArtifactManage. + + All required parameters must be populated in order to send to Azure. + + :param install: Required. Required. The path and arguments to install the gallery application. + This is limited to 4096 characters. + :type install: str + :param remove: Required. Required. The path and arguments to remove the gallery application. + This is limited to 4096 characters. + :type remove: str + :param update: Optional. The path and arguments to update the gallery application. If not + present, then update operation will invoke remove command on the previous version and install + command on the current version of the gallery application. This is limited to 4096 characters. + :type update: str + """ + + _validation = { + 'install': {'required': True}, + 'remove': {'required': True}, + } + + _attribute_map = { + 'install': {'key': 'install', 'type': 'str'}, + 'remove': {'key': 'remove', 'type': 'str'}, + 'update': {'key': 'update', 'type': 'str'}, + } + + def __init__( + self, + *, + install: str, + remove: str, + update: Optional[str] = None, + **kwargs + ): + super(UserArtifactManage, self).__init__(**kwargs) + self.install = install + self.remove = remove + self.update = update + + class UserArtifactSource(msrest.serialization.Model): """The source image from which the Image Version is going to be created. All required parameters must be populated in order to send to Azure. - :param file_name: Required. Required. The fileName of the artifact. - :type file_name: str :param media_link: Required. Required. The mediaLink of the artifact, must be a readable - storage blob. + storage page blob. :type media_link: str + :param default_configuration_link: Optional. The defaultConfigurationLink of the artifact, must + be a readable storage page blob. + :type default_configuration_link: str """ _validation = { - 'file_name': {'required': True}, 'media_link': {'required': True}, } _attribute_map = { - 'file_name': {'key': 'fileName', 'type': 'str'}, 'media_link': {'key': 'mediaLink', 'type': 'str'}, + 'default_configuration_link': {'key': 'defaultConfigurationLink', 'type': 'str'}, } def __init__( self, *, - file_name: str, media_link: str, + default_configuration_link: Optional[str] = None, **kwargs ): super(UserArtifactSource, self).__init__(**kwargs) - self.file_name = file_name self.media_link = media_link + self.default_configuration_link = default_configuration_link class UserAssignedIdentitiesValue(msrest.serialization.Model): diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/models/_models.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/models/_models.py index 33aa552bb865..2327472a296c 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/models/_models.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/models/_models.py @@ -3645,7 +3645,7 @@ class SshPublicKey(msrest.serialization.Model): :param key_data: SSH public key certificate used to authenticate with the VM through ssh. The key needs to be at least 2048-bit and in ssh-rsa format. :code:`
`:code:`
` For creating ssh keys, see `Create SSH keys on Linux and Mac for Linux VMs in Azure - `_. :type key_data: str """ diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/models/_models_py3.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/models/_models_py3.py index 5c16c5de040a..599404519acb 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/models/_models_py3.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/models/_models_py3.py @@ -3985,7 +3985,7 @@ class SshPublicKey(msrest.serialization.Model): :param key_data: SSH public key certificate used to authenticate with the VM through ssh. The key needs to be at least 2048-bit and in ssh-rsa format. :code:`
`:code:`
` For creating ssh keys, see `Create SSH keys on Linux and Mac for Linux VMs in Azure - `_. :type key_data: str """ diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/models/_models.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/models/_models.py index 667bbc7c8f1e..cfc8360230b1 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/models/_models.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/models/_models.py @@ -2809,16 +2809,16 @@ def __init__( self.id = None -class PrivateEndpointConnection(ProxyOnlyResource): +class PrivateEndpointConnection(msrest.serialization.Model): """The Private Endpoint Connection resource. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource Id. + :ivar id: private endpoint connection Id. :vartype id: str - :ivar name: Resource name. + :ivar name: private endpoint connection name. :vartype name: str - :ivar type: Resource type. + :ivar type: private endpoint connection type. :vartype type: str :param private_endpoint: The resource of private end point. :type private_endpoint: ~azure.mgmt.compute.v2020_09_30.models.PrivateEndpoint @@ -2853,6 +2853,9 @@ def __init__( **kwargs ): super(PrivateEndpointConnection, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None self.private_endpoint = kwargs.get('private_endpoint', None) self.private_link_service_connection_state = kwargs.get('private_link_service_connection_state', None) self.provisioning_state = None diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/models/_models_py3.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/models/_models_py3.py index cebfade08f79..690cb2caaf32 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/models/_models_py3.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/models/_models_py3.py @@ -3099,16 +3099,16 @@ def __init__( self.id = None -class PrivateEndpointConnection(ProxyOnlyResource): +class PrivateEndpointConnection(msrest.serialization.Model): """The Private Endpoint Connection resource. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource Id. + :ivar id: private endpoint connection Id. :vartype id: str - :ivar name: Resource name. + :ivar name: private endpoint connection name. :vartype name: str - :ivar type: Resource type. + :ivar type: private endpoint connection type. :vartype type: str :param private_endpoint: The resource of private end point. :type private_endpoint: ~azure.mgmt.compute.v2020_09_30.models.PrivateEndpoint @@ -3146,6 +3146,9 @@ def __init__( **kwargs ): super(PrivateEndpointConnection, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None self.private_endpoint = private_endpoint self.private_link_service_connection_state = private_link_service_connection_state self.provisioning_state = None diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/__init__.py new file mode 100644 index 000000000000..cdc7f7a1709a --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/__init__.py @@ -0,0 +1,16 @@ +# 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 ._compute_management_client import ComputeManagementClient +__all__ = ['ComputeManagementClient'] + +try: + from ._patch import patch_sdk # type: ignore + patch_sdk() +except ImportError: + pass diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/_compute_management_client.py new file mode 100644 index 000000000000..c4ca4df89e30 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/_compute_management_client.py @@ -0,0 +1,84 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import TYPE_CHECKING + +from azure.mgmt.core import ARMPipelineClient +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Optional + + from azure.core.credentials import TokenCredential + +from ._configuration import ComputeManagementClientConfiguration +from .operations import CloudServiceRoleInstancesOperations +from .operations import CloudServiceRolesOperations +from .operations import CloudServicesOperations +from .operations import CloudServicesUpdateDomainOperations +from . import models + + +class ComputeManagementClient(object): + """Compute Client. + + :ivar cloud_service_role_instances: CloudServiceRoleInstancesOperations operations + :vartype cloud_service_role_instances: azure.mgmt.compute.v2020_10_01_preview.operations.CloudServiceRoleInstancesOperations + :ivar cloud_service_roles: CloudServiceRolesOperations operations + :vartype cloud_service_roles: azure.mgmt.compute.v2020_10_01_preview.operations.CloudServiceRolesOperations + :ivar cloud_services: CloudServicesOperations operations + :vartype cloud_services: azure.mgmt.compute.v2020_10_01_preview.operations.CloudServicesOperations + :ivar cloud_services_update_domain: CloudServicesUpdateDomainOperations operations + :vartype cloud_services_update_domain: azure.mgmt.compute.v2020_10_01_preview.operations.CloudServicesUpdateDomainOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :type subscription_id: str + :param str base_url: Service URL + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + """ + + def __init__( + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + base_url=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> None + if not base_url: + base_url = 'https://management.azure.com' + self._config = ComputeManagementClientConfiguration(credential, subscription_id, **kwargs) + self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + + self.cloud_service_role_instances = CloudServiceRoleInstancesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.cloud_service_roles = CloudServiceRolesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.cloud_services = CloudServicesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.cloud_services_update_domain = CloudServicesUpdateDomainOperations( + self._client, self._config, self._serialize, self._deserialize) + + def close(self): + # type: () -> None + self._client.close() + + def __enter__(self): + # type: () -> ComputeManagementClient + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/_configuration.py new file mode 100644 index 000000000000..13573d8cd14f --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/_configuration.py @@ -0,0 +1,70 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any + + from azure.core.credentials import TokenCredential + +VERSION = "unknown" + +class ComputeManagementClientConfiguration(Configuration): + """Configuration for ComputeManagementClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :type subscription_id: str + """ + + def __init__( + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + super(ComputeManagementClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2020-10-01-preview" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-compute/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs # type: Any + ): + # type: (...) -> None + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/_metadata.json b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/_metadata.json new file mode 100644 index 000000000000..82ff740a4340 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/_metadata.json @@ -0,0 +1,64 @@ +{ + "chosen_version": "2020-10-01-preview", + "total_api_version_list": ["2020-10-01-preview"], + "client": { + "name": "ComputeManagementClient", + "filename": "_compute_management_client", + "description": "Compute Client.", + "base_url": "\u0027https://management.azure.com\u0027", + "custom_base_url": null, + "azure_arm": true, + "has_lro_operations": true, + "client_side_validation": true + }, + "global_parameters": { + "sync": { + "credential": { + "signature": "credential, # type: \"TokenCredential\"", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials.TokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id, # type: str", + "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "docstring_type": "str", + "required": true + } + }, + "async": { + "credential": { + "signature": "credential, # type: \"AsyncTokenCredential\"", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id, # type: str", + "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "docstring_type": "str", + "required": true + } + }, + "constant": { + }, + "call": "credential, subscription_id" + }, + "config": { + "credential": true, + "credential_scopes": ["https://management.azure.com/.default"], + "credential_default_policy_type": "BearerTokenCredentialPolicy", + "credential_default_policy_type_has_async_version": true, + "credential_key_header_name": null + }, + "operation_groups": { + "cloud_service_role_instances": "CloudServiceRoleInstancesOperations", + "cloud_service_roles": "CloudServiceRolesOperations", + "cloud_services": "CloudServicesOperations", + "cloud_services_update_domain": "CloudServicesUpdateDomainOperations" + }, + "operation_mixins": { + }, + "sync_imports": "None", + "async_imports": "None" +} \ No newline at end of file diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/aio/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/aio/__init__.py new file mode 100644 index 000000000000..9e9459635989 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/aio/__init__.py @@ -0,0 +1,10 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._compute_management_client import ComputeManagementClient +__all__ = ['ComputeManagementClient'] diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/aio/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/aio/_compute_management_client.py new file mode 100644 index 000000000000..c83136b7211a --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/aio/_compute_management_client.py @@ -0,0 +1,78 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, Optional, TYPE_CHECKING + +from azure.mgmt.core import AsyncARMPipelineClient +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +from ._configuration import ComputeManagementClientConfiguration +from .operations import CloudServiceRoleInstancesOperations +from .operations import CloudServiceRolesOperations +from .operations import CloudServicesOperations +from .operations import CloudServicesUpdateDomainOperations +from .. import models + + +class ComputeManagementClient(object): + """Compute Client. + + :ivar cloud_service_role_instances: CloudServiceRoleInstancesOperations operations + :vartype cloud_service_role_instances: azure.mgmt.compute.v2020_10_01_preview.aio.operations.CloudServiceRoleInstancesOperations + :ivar cloud_service_roles: CloudServiceRolesOperations operations + :vartype cloud_service_roles: azure.mgmt.compute.v2020_10_01_preview.aio.operations.CloudServiceRolesOperations + :ivar cloud_services: CloudServicesOperations operations + :vartype cloud_services: azure.mgmt.compute.v2020_10_01_preview.aio.operations.CloudServicesOperations + :ivar cloud_services_update_domain: CloudServicesUpdateDomainOperations operations + :vartype cloud_services_update_domain: azure.mgmt.compute.v2020_10_01_preview.aio.operations.CloudServicesUpdateDomainOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :type subscription_id: str + :param str base_url: Service URL + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: Optional[str] = None, + **kwargs: Any + ) -> None: + if not base_url: + base_url = 'https://management.azure.com' + self._config = ComputeManagementClientConfiguration(credential, subscription_id, **kwargs) + self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + + self.cloud_service_role_instances = CloudServiceRoleInstancesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.cloud_service_roles = CloudServiceRolesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.cloud_services = CloudServicesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.cloud_services_update_domain = CloudServicesUpdateDomainOperations( + self._client, self._config, self._serialize, self._deserialize) + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "ComputeManagementClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/aio/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/aio/_configuration.py new file mode 100644 index 000000000000..560f83a3207c --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/aio/_configuration.py @@ -0,0 +1,66 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +VERSION = "unknown" + +class ComputeManagementClientConfiguration(Configuration): + """Configuration for ComputeManagementClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :type subscription_id: str + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + super(ComputeManagementClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2020-10-01-preview" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-compute/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/aio/operations/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/aio/operations/__init__.py new file mode 100644 index 000000000000..0ecb0abd1ee4 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/aio/operations/__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 ._cloud_service_role_instances_operations import CloudServiceRoleInstancesOperations +from ._cloud_service_roles_operations import CloudServiceRolesOperations +from ._cloud_services_operations import CloudServicesOperations +from ._cloud_services_update_domain_operations import CloudServicesUpdateDomainOperations + +__all__ = [ + 'CloudServiceRoleInstancesOperations', + 'CloudServiceRolesOperations', + 'CloudServicesOperations', + 'CloudServicesUpdateDomainOperations', +] diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/aio/operations/_cloud_service_role_instances_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/aio/operations/_cloud_service_role_instances_operations.py new file mode 100644 index 000000000000..d0b19d7a6081 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/aio/operations/_cloud_service_role_instances_operations.py @@ -0,0 +1,780 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, IO, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class CloudServiceRoleInstancesOperations: + """CloudServiceRoleInstancesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.compute.v2020_10_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def _delete_initial( + self, + role_instance_name: str, + resource_group_name: str, + cloud_service_name: str, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'roleInstanceName': self._serialize.url("role_instance_name", role_instance_name, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}'} # type: ignore + + async def begin_delete( + self, + role_instance_name: str, + resource_group_name: str, + cloud_service_name: str, + **kwargs + ) -> AsyncLROPoller[None]: + """Deletes a role instance from a cloud service. + + :param role_instance_name: Name of the role instance. + :type role_instance_name: str + :param resource_group_name: + :type resource_group_name: str + :param cloud_service_name: + :type cloud_service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + role_instance_name=role_instance_name, + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'roleInstanceName': self._serialize.url("role_instance_name", role_instance_name, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}'} # type: ignore + + async def get( + self, + role_instance_name: str, + resource_group_name: str, + cloud_service_name: str, + expand: Optional[str] = "instanceView", + **kwargs + ) -> "_models.RoleInstance": + """Gets a role instance from a cloud service. + + :param role_instance_name: Name of the role instance. + :type role_instance_name: str + :param resource_group_name: + :type resource_group_name: str + :param cloud_service_name: + :type cloud_service_name: str + :param expand: The expand expression to apply to the operation. + :type expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RoleInstance, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2020_10_01_preview.models.RoleInstance + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RoleInstance"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'roleInstanceName': self._serialize.url("role_instance_name", role_instance_name, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RoleInstance', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}'} # type: ignore + + async def get_instance_view( + self, + role_instance_name: str, + resource_group_name: str, + cloud_service_name: str, + **kwargs + ) -> "_models.RoleInstanceView": + """Retrieves information about the run-time state of a role instance in a cloud service. + + :param role_instance_name: Name of the role instance. + :type role_instance_name: str + :param resource_group_name: + :type resource_group_name: str + :param cloud_service_name: + :type cloud_service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RoleInstanceView, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2020_10_01_preview.models.RoleInstanceView + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RoleInstanceView"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01-preview" + accept = "application/json" + + # Construct URL + url = self.get_instance_view.metadata['url'] # type: ignore + path_format_arguments = { + 'roleInstanceName': self._serialize.url("role_instance_name", role_instance_name, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RoleInstanceView', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_instance_view.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/instanceView'} # type: ignore + + def list( + self, + resource_group_name: str, + cloud_service_name: str, + expand: Optional[str] = "instanceView", + **kwargs + ) -> AsyncIterable["_models.RoleInstanceListResult"]: + """Gets the list of all role instances in a cloud service. Use nextLink property in the response + to get the next page of role instances. Do this till nextLink is null to fetch all the role + instances. + + :param resource_group_name: + :type resource_group_name: str + :param cloud_service_name: + :type cloud_service_name: str + :param expand: The expand expression to apply to the operation. + :type expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either RoleInstanceListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_10_01_preview.models.RoleInstanceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RoleInstanceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('RoleInstanceListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances'} # type: ignore + + async def _restart_initial( + self, + role_instance_name: str, + resource_group_name: str, + cloud_service_name: str, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01-preview" + accept = "application/json" + + # Construct URL + url = self._restart_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'roleInstanceName': self._serialize.url("role_instance_name", role_instance_name, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/restart'} # type: ignore + + async def begin_restart( + self, + role_instance_name: str, + resource_group_name: str, + cloud_service_name: str, + **kwargs + ) -> AsyncLROPoller[None]: + """The Reboot Role Instance asynchronous operation requests a reboot of a role instance in the + cloud service. + + :param role_instance_name: Name of the role instance. + :type role_instance_name: str + :param resource_group_name: + :type resource_group_name: str + :param cloud_service_name: + :type cloud_service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._restart_initial( + role_instance_name=role_instance_name, + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'roleInstanceName': self._serialize.url("role_instance_name", role_instance_name, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_restart.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/restart'} # type: ignore + + async def _reimage_initial( + self, + role_instance_name: str, + resource_group_name: str, + cloud_service_name: str, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01-preview" + accept = "application/json" + + # Construct URL + url = self._reimage_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'roleInstanceName': self._serialize.url("role_instance_name", role_instance_name, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/reimage'} # type: ignore + + async def begin_reimage( + self, + role_instance_name: str, + resource_group_name: str, + cloud_service_name: str, + **kwargs + ) -> AsyncLROPoller[None]: + """The Reimage Role Instance asynchronous operation reinstalls the operating system on instances + of web roles or worker roles. + + :param role_instance_name: Name of the role instance. + :type role_instance_name: str + :param resource_group_name: + :type resource_group_name: str + :param cloud_service_name: + :type cloud_service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._reimage_initial( + role_instance_name=role_instance_name, + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'roleInstanceName': self._serialize.url("role_instance_name", role_instance_name, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_reimage.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/reimage'} # type: ignore + + async def _rebuild_initial( + self, + role_instance_name: str, + resource_group_name: str, + cloud_service_name: str, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01-preview" + accept = "application/json" + + # Construct URL + url = self._rebuild_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'roleInstanceName': self._serialize.url("role_instance_name", role_instance_name, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _rebuild_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/rebuild'} # type: ignore + + async def begin_rebuild( + self, + role_instance_name: str, + resource_group_name: str, + cloud_service_name: str, + **kwargs + ) -> AsyncLROPoller[None]: + """The Rebuild Role Instance asynchronous operation reinstalls the operating system on instances + of web roles or worker roles and initializes the storage resources that are used by them. If + you do not want to initialize storage resources, you can use Reimage Role Instance. + + :param role_instance_name: Name of the role instance. + :type role_instance_name: str + :param resource_group_name: + :type resource_group_name: str + :param cloud_service_name: + :type cloud_service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._rebuild_initial( + role_instance_name=role_instance_name, + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'roleInstanceName': self._serialize.url("role_instance_name", role_instance_name, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_rebuild.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/rebuild'} # type: ignore + + async def get_remote_desktop_file( + self, + role_instance_name: str, + resource_group_name: str, + cloud_service_name: str, + **kwargs + ) -> IO: + """Gets a remote desktop file for a role instance in a cloud service. + + :param role_instance_name: Name of the role instance. + :type role_instance_name: str + :param resource_group_name: + :type resource_group_name: str + :param cloud_service_name: + :type cloud_service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IO, or the result of cls(response) + :rtype: IO + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[IO] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01-preview" + accept = "application/x-rdp" + + # Construct URL + url = self.get_remote_desktop_file.metadata['url'] # type: ignore + path_format_arguments = { + 'roleInstanceName': self._serialize.url("role_instance_name", role_instance_name, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=True, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_remote_desktop_file.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/remoteDesktopFile'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/aio/operations/_cloud_service_roles_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/aio/operations/_cloud_service_roles_operations.py new file mode 100644 index 000000000000..093ff1c6a87f --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/aio/operations/_cloud_service_roles_operations.py @@ -0,0 +1,179 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class CloudServiceRolesOperations: + """CloudServiceRolesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.compute.v2020_10_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + role_name: str, + resource_group_name: str, + cloud_service_name: str, + **kwargs + ) -> "_models.CloudServiceRole": + """Gets a role from a cloud service. + + :param role_name: Name of the role. + :type role_name: str + :param resource_group_name: + :type resource_group_name: str + :param cloud_service_name: + :type cloud_service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CloudServiceRole, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2020_10_01_preview.models.CloudServiceRole + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CloudServiceRole"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'roleName': self._serialize.url("role_name", role_name, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CloudServiceRole', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roles/{roleName}'} # type: ignore + + def list( + self, + resource_group_name: str, + cloud_service_name: str, + **kwargs + ) -> AsyncIterable["_models.CloudServiceRoleListResult"]: + """Gets a list of all roles in a cloud service. Use nextLink property in the response to get the + next page of roles. Do this till nextLink is null to fetch all the roles. + + :param resource_group_name: + :type resource_group_name: str + :param cloud_service_name: + :type cloud_service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CloudServiceRoleListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_10_01_preview.models.CloudServiceRoleListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CloudServiceRoleListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('CloudServiceRoleListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roles'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/aio/operations/_cloud_services_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/aio/operations/_cloud_services_operations.py new file mode 100644 index 000000000000..31e05edf341e --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/aio/operations/_cloud_services_operations.py @@ -0,0 +1,1371 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class CloudServicesOperations: + """CloudServicesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.compute.v2020_10_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def _create_or_update_initial( + self, + resource_group_name: str, + cloud_service_name: str, + parameters: Optional["_models.CloudService"] = None, + **kwargs + ) -> "_models.CloudService": + cls = kwargs.pop('cls', None) # type: ClsType["_models.CloudService"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if parameters is not None: + body_content = self._serialize.body(parameters, 'CloudService') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('CloudService', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('CloudService', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}'} # type: ignore + + async def begin_create_or_update( + self, + resource_group_name: str, + cloud_service_name: str, + parameters: Optional["_models.CloudService"] = None, + **kwargs + ) -> AsyncLROPoller["_models.CloudService"]: + """Create or update a cloud service. Please note some properties can be set only during cloud + service creation. + + :param resource_group_name: Name of the resource group. + :type resource_group_name: str + :param cloud_service_name: Name of the cloud service. + :type cloud_service_name: str + :param parameters: The cloud service object. + :type parameters: ~azure.mgmt.compute.v2020_10_01_preview.models.CloudService + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either CloudService or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_10_01_preview.models.CloudService] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.CloudService"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('CloudService', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}'} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + cloud_service_name: str, + parameters: Optional["_models.CloudServiceUpdate"] = None, + **kwargs + ) -> "_models.CloudService": + cls = kwargs.pop('cls', None) # type: ClsType["_models.CloudService"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if parameters is not None: + body_content = self._serialize.body(parameters, 'CloudServiceUpdate') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CloudService', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}'} # type: ignore + + async def begin_update( + self, + resource_group_name: str, + cloud_service_name: str, + parameters: Optional["_models.CloudServiceUpdate"] = None, + **kwargs + ) -> AsyncLROPoller["_models.CloudService"]: + """Update a cloud service. + + :param resource_group_name: Name of the resource group. + :type resource_group_name: str + :param cloud_service_name: Name of the cloud service. + :type cloud_service_name: str + :param parameters: The cloud service object. + :type parameters: ~azure.mgmt.compute.v2020_10_01_preview.models.CloudServiceUpdate + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either CloudService or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_10_01_preview.models.CloudService] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.CloudService"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('CloudService', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + cloud_service_name: str, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + cloud_service_name: str, + **kwargs + ) -> AsyncLROPoller[None]: + """Deletes a cloud service. + + :param resource_group_name: Name of the resource group. + :type resource_group_name: str + :param cloud_service_name: Name of the cloud service. + :type cloud_service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}'} # type: ignore + + async def get( + self, + resource_group_name: str, + cloud_service_name: str, + **kwargs + ) -> "_models.CloudService": + """Display information about a cloud service. + + :param resource_group_name: Name of the resource group. + :type resource_group_name: str + :param cloud_service_name: Name of the cloud service. + :type cloud_service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CloudService, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2020_10_01_preview.models.CloudService + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CloudService"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CloudService', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}'} # type: ignore + + async def get_instance_view( + self, + resource_group_name: str, + cloud_service_name: str, + **kwargs + ) -> "_models.CloudServiceInstanceView": + """Gets the status of a cloud service. + + :param resource_group_name: Name of the resource group. + :type resource_group_name: str + :param cloud_service_name: Name of the cloud service. + :type cloud_service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CloudServiceInstanceView, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2020_10_01_preview.models.CloudServiceInstanceView + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CloudServiceInstanceView"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01-preview" + accept = "application/json" + + # Construct URL + url = self.get_instance_view.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CloudServiceInstanceView', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_instance_view.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/instanceView'} # type: ignore + + def list_all( + self, + **kwargs + ) -> AsyncIterable["_models.CloudServiceListResult"]: + """Gets a list of all cloud services in the subscription, regardless of the associated resource + group. Use nextLink property in the response to get the next page of Cloud Services. Do this + till nextLink is null to fetch all the Cloud Services. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CloudServiceListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_10_01_preview.models.CloudServiceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CloudServiceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_all.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('CloudServiceListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_all.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/cloudServices'} # type: ignore + + def list( + self, + resource_group_name: str, + **kwargs + ) -> AsyncIterable["_models.CloudServiceListResult"]: + """Gets a list of all cloud services under a resource group. Use nextLink property in the response + to get the next page of Cloud Services. Do this till nextLink is null to fetch all the Cloud + Services. + + :param resource_group_name: Name of the resource group. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CloudServiceListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_10_01_preview.models.CloudServiceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CloudServiceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('CloudServiceListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices'} # type: ignore + + async def _start_initial( + self, + resource_group_name: str, + cloud_service_name: str, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01-preview" + accept = "application/json" + + # Construct URL + url = self._start_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/start'} # type: ignore + + async def begin_start( + self, + resource_group_name: str, + cloud_service_name: str, + **kwargs + ) -> AsyncLROPoller[None]: + """Starts the cloud service. + + :param resource_group_name: Name of the resource group. + :type resource_group_name: str + :param cloud_service_name: Name of the cloud service. + :type cloud_service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._start_initial( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_start.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/start'} # type: ignore + + async def _power_off_initial( + self, + resource_group_name: str, + cloud_service_name: str, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01-preview" + accept = "application/json" + + # Construct URL + url = self._power_off_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _power_off_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/poweroff'} # type: ignore + + async def begin_power_off( + self, + resource_group_name: str, + cloud_service_name: str, + **kwargs + ) -> AsyncLROPoller[None]: + """Power off the cloud service. Note that resources are still attached and you are getting charged + for the resources. + + :param resource_group_name: Name of the resource group. + :type resource_group_name: str + :param cloud_service_name: Name of the cloud service. + :type cloud_service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._power_off_initial( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_power_off.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/poweroff'} # type: ignore + + async def _restart_initial( + self, + resource_group_name: str, + cloud_service_name: str, + parameters: Optional["_models.RoleInstances"] = None, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._restart_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if parameters is not None: + body_content = self._serialize.body(parameters, 'RoleInstances') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/restart'} # type: ignore + + async def begin_restart( + self, + resource_group_name: str, + cloud_service_name: str, + parameters: Optional["_models.RoleInstances"] = None, + **kwargs + ) -> AsyncLROPoller[None]: + """Restarts one or more role instances in a cloud service. + + :param resource_group_name: Name of the resource group. + :type resource_group_name: str + :param cloud_service_name: Name of the cloud service. + :type cloud_service_name: str + :param parameters: List of cloud service role instance names. + :type parameters: ~azure.mgmt.compute.v2020_10_01_preview.models.RoleInstances + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._restart_initial( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_restart.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/restart'} # type: ignore + + async def _reimage_initial( + self, + resource_group_name: str, + cloud_service_name: str, + parameters: Optional["_models.RoleInstances"] = None, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._reimage_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if parameters is not None: + body_content = self._serialize.body(parameters, 'RoleInstances') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/reimage'} # type: ignore + + async def begin_reimage( + self, + resource_group_name: str, + cloud_service_name: str, + parameters: Optional["_models.RoleInstances"] = None, + **kwargs + ) -> AsyncLROPoller[None]: + """Reimage asynchronous operation reinstalls the operating system on instances of web roles or + worker roles. + + :param resource_group_name: Name of the resource group. + :type resource_group_name: str + :param cloud_service_name: Name of the cloud service. + :type cloud_service_name: str + :param parameters: List of cloud service role instance names. + :type parameters: ~azure.mgmt.compute.v2020_10_01_preview.models.RoleInstances + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._reimage_initial( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_reimage.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/reimage'} # type: ignore + + async def _rebuild_initial( + self, + resource_group_name: str, + cloud_service_name: str, + parameters: Optional["_models.RoleInstances"] = None, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._rebuild_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if parameters is not None: + body_content = self._serialize.body(parameters, 'RoleInstances') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _rebuild_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/rebuild'} # type: ignore + + async def begin_rebuild( + self, + resource_group_name: str, + cloud_service_name: str, + parameters: Optional["_models.RoleInstances"] = None, + **kwargs + ) -> AsyncLROPoller[None]: + """Rebuild Role Instances reinstalls the operating system on instances of web roles or worker + roles and initializes the storage resources that are used by them. If you do not want to + initialize storage resources, you can use Reimage Role Instances. + + :param resource_group_name: Name of the resource group. + :type resource_group_name: str + :param cloud_service_name: Name of the cloud service. + :type cloud_service_name: str + :param parameters: List of cloud service role instance names. + :type parameters: ~azure.mgmt.compute.v2020_10_01_preview.models.RoleInstances + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._rebuild_initial( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_rebuild.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/rebuild'} # type: ignore + + async def _delete_instances_initial( + self, + resource_group_name: str, + cloud_service_name: str, + parameters: Optional["_models.RoleInstances"] = None, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._delete_instances_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if parameters is not None: + body_content = self._serialize.body(parameters, 'RoleInstances') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_instances_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/delete'} # type: ignore + + async def begin_delete_instances( + self, + resource_group_name: str, + cloud_service_name: str, + parameters: Optional["_models.RoleInstances"] = None, + **kwargs + ) -> AsyncLROPoller[None]: + """Deletes role instances in a cloud service. + + :param resource_group_name: Name of the resource group. + :type resource_group_name: str + :param cloud_service_name: Name of the cloud service. + :type cloud_service_name: str + :param parameters: List of cloud service role instance names. + :type parameters: ~azure.mgmt.compute.v2020_10_01_preview.models.RoleInstances + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_instances_initial( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete_instances.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/delete'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/aio/operations/_cloud_services_update_domain_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/aio/operations/_cloud_services_update_domain_operations.py new file mode 100644 index 000000000000..f6316786dea2 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/aio/operations/_cloud_services_update_domain_operations.py @@ -0,0 +1,314 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class CloudServicesUpdateDomainOperations: + """CloudServicesUpdateDomainOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.compute.v2020_10_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def _walk_update_domain_initial( + self, + resource_group_name: str, + cloud_service_name: str, + update_domain: int, + parameters: Optional["_models.UpdateDomain"] = None, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._walk_update_domain_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_name, 'str'), + 'updateDomain': self._serialize.url("update_domain", update_domain, 'int'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if parameters is not None: + body_content = self._serialize.body(parameters, 'UpdateDomain') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _walk_update_domain_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/updateDomains/{updateDomain}'} # type: ignore + + async def begin_walk_update_domain( + self, + resource_group_name: str, + cloud_service_name: str, + update_domain: int, + parameters: Optional["_models.UpdateDomain"] = None, + **kwargs + ) -> AsyncLROPoller[None]: + """Updates the role instances in the specified update domain. + + :param resource_group_name: Name of the resource group. + :type resource_group_name: str + :param cloud_service_name: Name of the cloud service. + :type cloud_service_name: str + :param update_domain: Specifies an integer value that identifies the update domain. Update + domains are identified with a zero-based index: the first update domain has an ID of 0, the + second has an ID of 1, and so on. + :type update_domain: int + :param parameters: The update domain object. + :type parameters: ~azure.mgmt.compute.v2020_10_01_preview.models.UpdateDomain + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._walk_update_domain_initial( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + update_domain=update_domain, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_name, 'str'), + 'updateDomain': self._serialize.url("update_domain", update_domain, 'int'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_walk_update_domain.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/updateDomains/{updateDomain}'} # type: ignore + + async def get_update_domain( + self, + resource_group_name: str, + cloud_service_name: str, + update_domain: int, + **kwargs + ) -> "_models.UpdateDomain": + """Gets the specified update domain of a cloud service. Use nextLink property in the response to + get the next page of update domains. Do this till nextLink is null to fetch all the update + domains. + + :param resource_group_name: Name of the resource group. + :type resource_group_name: str + :param cloud_service_name: Name of the cloud service. + :type cloud_service_name: str + :param update_domain: Specifies an integer value that identifies the update domain. Update + domains are identified with a zero-based index: the first update domain has an ID of 0, the + second has an ID of 1, and so on. + :type update_domain: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: UpdateDomain, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2020_10_01_preview.models.UpdateDomain + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.UpdateDomain"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01-preview" + accept = "application/json" + + # Construct URL + url = self.get_update_domain.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_name, 'str'), + 'updateDomain': self._serialize.url("update_domain", update_domain, 'int'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('UpdateDomain', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_update_domain.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/updateDomains/{updateDomain}'} # type: ignore + + def list_update_domains( + self, + resource_group_name: str, + cloud_service_name: str, + **kwargs + ) -> AsyncIterable["_models.UpdateDomainListResult"]: + """Gets a list of all update domains in a cloud service. + + :param resource_group_name: Name of the resource group. + :type resource_group_name: str + :param cloud_service_name: Name of the cloud service. + :type cloud_service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either UpdateDomainListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_10_01_preview.models.UpdateDomainListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.UpdateDomainListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_update_domains.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('UpdateDomainListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_update_domains.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/updateDomains'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/models/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/models/__init__.py new file mode 100644 index 000000000000..bfa6fa5f53c9 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/models/__init__.py @@ -0,0 +1,137 @@ +# 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 ApiError + from ._models_py3 import ApiErrorBase + from ._models_py3 import CloudService + from ._models_py3 import CloudServiceExtensionProfile + from ._models_py3 import CloudServiceExtensionProperties + from ._models_py3 import CloudServiceInstanceView + from ._models_py3 import CloudServiceListResult + from ._models_py3 import CloudServiceNetworkProfile + from ._models_py3 import CloudServiceOsProfile + from ._models_py3 import CloudServiceProperties + from ._models_py3 import CloudServiceRole + from ._models_py3 import CloudServiceRoleListResult + from ._models_py3 import CloudServiceRoleProfile + from ._models_py3 import CloudServiceRoleProfileProperties + from ._models_py3 import CloudServiceRoleProperties + from ._models_py3 import CloudServiceRoleSku + from ._models_py3 import CloudServiceUpdate + from ._models_py3 import CloudServiceVaultAndSecretReference + from ._models_py3 import CloudServiceVaultCertificate + from ._models_py3 import CloudServiceVaultSecretGroup + from ._models_py3 import Extension + from ._models_py3 import InnerError + from ._models_py3 import InstanceSku + from ._models_py3 import InstanceViewStatusesSummary + from ._models_py3 import LoadBalancerConfiguration + from ._models_py3 import LoadBalancerConfigurationProperties + from ._models_py3 import LoadBalancerFrontendIPConfiguration + from ._models_py3 import LoadBalancerFrontendIPConfigurationProperties + from ._models_py3 import ResourceInstanceViewStatus + from ._models_py3 import RoleInstance + from ._models_py3 import RoleInstanceListResult + from ._models_py3 import RoleInstanceNetworkProfile + from ._models_py3 import RoleInstanceProperties + from ._models_py3 import RoleInstanceView + from ._models_py3 import RoleInstances + from ._models_py3 import StatusCodeCount + from ._models_py3 import SubResource + from ._models_py3 import UpdateDomain + from ._models_py3 import UpdateDomainListResult +except (SyntaxError, ImportError): + from ._models import ApiError # type: ignore + from ._models import ApiErrorBase # type: ignore + from ._models import CloudService # type: ignore + from ._models import CloudServiceExtensionProfile # type: ignore + from ._models import CloudServiceExtensionProperties # type: ignore + from ._models import CloudServiceInstanceView # type: ignore + from ._models import CloudServiceListResult # type: ignore + from ._models import CloudServiceNetworkProfile # type: ignore + from ._models import CloudServiceOsProfile # type: ignore + from ._models import CloudServiceProperties # type: ignore + from ._models import CloudServiceRole # type: ignore + from ._models import CloudServiceRoleListResult # type: ignore + from ._models import CloudServiceRoleProfile # type: ignore + from ._models import CloudServiceRoleProfileProperties # type: ignore + from ._models import CloudServiceRoleProperties # type: ignore + from ._models import CloudServiceRoleSku # type: ignore + from ._models import CloudServiceUpdate # type: ignore + from ._models import CloudServiceVaultAndSecretReference # type: ignore + from ._models import CloudServiceVaultCertificate # type: ignore + from ._models import CloudServiceVaultSecretGroup # type: ignore + from ._models import Extension # type: ignore + from ._models import InnerError # type: ignore + from ._models import InstanceSku # type: ignore + from ._models import InstanceViewStatusesSummary # type: ignore + from ._models import LoadBalancerConfiguration # type: ignore + from ._models import LoadBalancerConfigurationProperties # type: ignore + from ._models import LoadBalancerFrontendIPConfiguration # type: ignore + from ._models import LoadBalancerFrontendIPConfigurationProperties # type: ignore + from ._models import ResourceInstanceViewStatus # type: ignore + from ._models import RoleInstance # type: ignore + from ._models import RoleInstanceListResult # type: ignore + from ._models import RoleInstanceNetworkProfile # type: ignore + from ._models import RoleInstanceProperties # type: ignore + from ._models import RoleInstanceView # type: ignore + from ._models import RoleInstances # type: ignore + from ._models import StatusCodeCount # type: ignore + from ._models import SubResource # type: ignore + from ._models import UpdateDomain # type: ignore + from ._models import UpdateDomainListResult # type: ignore + +from ._compute_management_client_enums import ( + CloudServiceUpgradeMode, + StatusLevelTypes, +) + +__all__ = [ + 'ApiError', + 'ApiErrorBase', + 'CloudService', + 'CloudServiceExtensionProfile', + 'CloudServiceExtensionProperties', + 'CloudServiceInstanceView', + 'CloudServiceListResult', + 'CloudServiceNetworkProfile', + 'CloudServiceOsProfile', + 'CloudServiceProperties', + 'CloudServiceRole', + 'CloudServiceRoleListResult', + 'CloudServiceRoleProfile', + 'CloudServiceRoleProfileProperties', + 'CloudServiceRoleProperties', + 'CloudServiceRoleSku', + 'CloudServiceUpdate', + 'CloudServiceVaultAndSecretReference', + 'CloudServiceVaultCertificate', + 'CloudServiceVaultSecretGroup', + 'Extension', + 'InnerError', + 'InstanceSku', + 'InstanceViewStatusesSummary', + 'LoadBalancerConfiguration', + 'LoadBalancerConfigurationProperties', + 'LoadBalancerFrontendIPConfiguration', + 'LoadBalancerFrontendIPConfigurationProperties', + 'ResourceInstanceViewStatus', + 'RoleInstance', + 'RoleInstanceListResult', + 'RoleInstanceNetworkProfile', + 'RoleInstanceProperties', + 'RoleInstanceView', + 'RoleInstances', + 'StatusCodeCount', + 'SubResource', + 'UpdateDomain', + 'UpdateDomainListResult', + 'CloudServiceUpgradeMode', + 'StatusLevelTypes', +] diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/models/_compute_management_client_enums.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/models/_compute_management_client_enums.py new file mode 100644 index 000000000000..2335366377fd --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/models/_compute_management_client_enums.py @@ -0,0 +1,50 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from enum import Enum, EnumMeta +from six import with_metaclass + +class _CaseInsensitiveEnumMeta(EnumMeta): + def __getitem__(self, name): + return super().__getitem__(name.upper()) + + def __getattr__(cls, name): + """Return the enum member matching `name` + We use __getattr__ instead of descriptors or inserting into the enum + class' __dict__ in order to support `name` and `value` being both + properties for enum members (which live in the class' __dict__) and + enum members themselves. + """ + try: + return cls._member_map_[name.upper()] + except KeyError: + raise AttributeError(name) + + +class CloudServiceUpgradeMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Update mode for the cloud service. Role instances are allocated to update domains when the + service is deployed. Updates can be initiated manually in each update domain or initiated + automatically in all update domains. + Possible Values are :code:`
`:code:`
`\ **Auto**\ :code:`
`:code:`
`\ + **Manual** :code:`
`:code:`
`\ **Simultaneous**\ :code:`
`:code:`
` + If not specified, the default value is Auto. If set to Manual, PUT UpdateDomain must be called + to apply the update. If set to Auto, the update is automatically applied to each update domain + in sequence. + """ + + AUTO = "Auto" + MANUAL = "Manual" + SIMULTANEOUS = "Simultaneous" + +class StatusLevelTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The level code. + """ + + INFO = "Info" + WARNING = "Warning" + ERROR = "Error" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/models/_models.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/models/_models.py new file mode 100644 index 000000000000..82e445ddebce --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/models/_models.py @@ -0,0 +1,1229 @@ +# 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 msrest.serialization + + +class ApiError(msrest.serialization.Model): + """Api error. + + :param details: The Api error details. + :type details: list[~azure.mgmt.compute.v2020_10_01_preview.models.ApiErrorBase] + :param innererror: The Api inner error. + :type innererror: ~azure.mgmt.compute.v2020_10_01_preview.models.InnerError + :param code: The error code. + :type code: str + :param message: The error message. + :type message: str + :param target: The target of the particular error. + :type target: str + """ + + _attribute_map = { + 'details': {'key': 'details', 'type': '[ApiErrorBase]'}, + 'innererror': {'key': 'innererror', 'type': 'InnerError'}, + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ApiError, self).__init__(**kwargs) + self.details = kwargs.get('details', None) + self.innererror = kwargs.get('innererror', None) + self.code = kwargs.get('code', None) + self.message = kwargs.get('message', None) + self.target = kwargs.get('target', None) + + +class ApiErrorBase(msrest.serialization.Model): + """Api error base. + + :param code: The error code. + :type code: str + :param message: The error message. + :type message: str + :param target: The target of the particular error. + :type target: str + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ApiErrorBase, self).__init__(**kwargs) + self.code = kwargs.get('code', None) + self.message = kwargs.get('message', None) + self.target = kwargs.get('target', None) + + +class CloudService(msrest.serialization.Model): + """Describes the cloud service. + + 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: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param location: Required. Resource location. + :type location: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param properties: Cloud service properties. + :type properties: ~azure.mgmt.compute.v2020_10_01_preview.models.CloudServiceProperties + """ + + _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}'}, + 'properties': {'key': 'properties', 'type': 'CloudServiceProperties'}, + } + + def __init__( + self, + **kwargs + ): + super(CloudService, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = kwargs['location'] + self.tags = kwargs.get('tags', None) + self.properties = kwargs.get('properties', None) + + +class CloudServiceExtensionProfile(msrest.serialization.Model): + """Describes a cloud service extension profile. + + :param extensions: List of extensions for the cloud service. + :type extensions: list[~azure.mgmt.compute.v2020_10_01_preview.models.Extension] + """ + + _attribute_map = { + 'extensions': {'key': 'extensions', 'type': '[Extension]'}, + } + + def __init__( + self, + **kwargs + ): + super(CloudServiceExtensionProfile, self).__init__(**kwargs) + self.extensions = kwargs.get('extensions', None) + + +class CloudServiceExtensionProperties(msrest.serialization.Model): + """Extension Properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param publisher: The name of the extension handler publisher. + :type publisher: str + :param type: Specifies the type of the extension. + :type type: str + :param type_handler_version: Specifies the version of the extension. Specifies the version of + the extension. If this element is not specified or an asterisk (*) is used as the value, the + latest version of the extension is used. If the value is specified with a major version number + and an asterisk as the minor version number (X.), the latest minor version of the specified + major version is selected. If a major version number and a minor version number are specified + (X.Y), the specific extension version is selected. If a version is specified, an auto-upgrade + is performed on the role instance. + :type type_handler_version: str + :param auto_upgrade_minor_version: Explicitly specify whether platform can automatically + upgrade typeHandlerVersion to higher minor versions when they become available. + :type auto_upgrade_minor_version: bool + :param settings: Public settings for the extension. For JSON extensions, this is the JSON + settings for the extension. For XML Extension (like RDP), this is the XML setting for the + extension. + :type settings: str + :param protected_settings: Protected settings for the extension which are encrypted before sent + to the role instance. + :type protected_settings: str + :param protected_settings_from_key_vault: + :type protected_settings_from_key_vault: + ~azure.mgmt.compute.v2020_10_01_preview.models.CloudServiceVaultAndSecretReference + :param force_update_tag: Tag to force apply the provided public and protected settings. + Changing the tag value allows for re-running the extension without changing any of the public + or protected settings. + If forceUpdateTag is not changed, updates to public or protected settings would still be + applied by the handler. + If neither forceUpdateTag nor any of public or protected settings change, extension would flow + to the role instance with the same sequence-number, and + it is up to handler implementation whether to re-run it or not. + :type force_update_tag: str + :ivar provisioning_state: The provisioning state, which only appears in the response. + :vartype provisioning_state: str + :param roles_applied_to: Optional list of roles to apply this extension. If property is not + specified or '*' is specified, extension is applied to all roles in the cloud service. + :type roles_applied_to: list[str] + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'publisher': {'key': 'publisher', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'type_handler_version': {'key': 'typeHandlerVersion', 'type': 'str'}, + 'auto_upgrade_minor_version': {'key': 'autoUpgradeMinorVersion', 'type': 'bool'}, + 'settings': {'key': 'settings', 'type': 'str'}, + 'protected_settings': {'key': 'protectedSettings', 'type': 'str'}, + 'protected_settings_from_key_vault': {'key': 'protectedSettingsFromKeyVault', 'type': 'CloudServiceVaultAndSecretReference'}, + 'force_update_tag': {'key': 'forceUpdateTag', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'roles_applied_to': {'key': 'rolesAppliedTo', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(CloudServiceExtensionProperties, self).__init__(**kwargs) + self.publisher = kwargs.get('publisher', None) + self.type = kwargs.get('type', None) + self.type_handler_version = kwargs.get('type_handler_version', None) + self.auto_upgrade_minor_version = kwargs.get('auto_upgrade_minor_version', None) + self.settings = kwargs.get('settings', None) + self.protected_settings = kwargs.get('protected_settings', None) + self.protected_settings_from_key_vault = kwargs.get('protected_settings_from_key_vault', None) + self.force_update_tag = kwargs.get('force_update_tag', None) + self.provisioning_state = None + self.roles_applied_to = kwargs.get('roles_applied_to', None) + + +class CloudServiceInstanceView(msrest.serialization.Model): + """InstanceView of CloudService as a whole. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param role_instance: Instance view statuses. + :type role_instance: ~azure.mgmt.compute.v2020_10_01_preview.models.InstanceViewStatusesSummary + :ivar sdk_version: The version of the SDK that was used to generate the package for the cloud + service. + :vartype sdk_version: str + :ivar statuses: + :vartype statuses: + list[~azure.mgmt.compute.v2020_10_01_preview.models.ResourceInstanceViewStatus] + """ + + _validation = { + 'sdk_version': {'readonly': True}, + 'statuses': {'readonly': True}, + } + + _attribute_map = { + 'role_instance': {'key': 'roleInstance', 'type': 'InstanceViewStatusesSummary'}, + 'sdk_version': {'key': 'sdkVersion', 'type': 'str'}, + 'statuses': {'key': 'statuses', 'type': '[ResourceInstanceViewStatus]'}, + } + + def __init__( + self, + **kwargs + ): + super(CloudServiceInstanceView, self).__init__(**kwargs) + self.role_instance = kwargs.get('role_instance', None) + self.sdk_version = None + self.statuses = None + + +class CloudServiceListResult(msrest.serialization.Model): + """CloudServiceListResult. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. + :type value: list[~azure.mgmt.compute.v2020_10_01_preview.models.CloudService] + :param next_link: + :type next_link: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[CloudService]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CloudServiceListResult, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = kwargs.get('next_link', None) + + +class CloudServiceNetworkProfile(msrest.serialization.Model): + """Network Profile for the cloud service. + + :param load_balancer_configurations: The list of load balancer configurations for the cloud + service. + :type load_balancer_configurations: + list[~azure.mgmt.compute.v2020_10_01_preview.models.LoadBalancerConfiguration] + :param swappable_cloud_service: + :type swappable_cloud_service: ~azure.mgmt.compute.v2020_10_01_preview.models.SubResource + """ + + _attribute_map = { + 'load_balancer_configurations': {'key': 'loadBalancerConfigurations', 'type': '[LoadBalancerConfiguration]'}, + 'swappable_cloud_service': {'key': 'swappableCloudService', 'type': 'SubResource'}, + } + + def __init__( + self, + **kwargs + ): + super(CloudServiceNetworkProfile, self).__init__(**kwargs) + self.load_balancer_configurations = kwargs.get('load_balancer_configurations', None) + self.swappable_cloud_service = kwargs.get('swappable_cloud_service', None) + + +class CloudServiceOsProfile(msrest.serialization.Model): + """Describes the OS profile for the cloud service. + + :param secrets: Specifies set of certificates that should be installed onto the role instances. + :type secrets: + list[~azure.mgmt.compute.v2020_10_01_preview.models.CloudServiceVaultSecretGroup] + """ + + _attribute_map = { + 'secrets': {'key': 'secrets', 'type': '[CloudServiceVaultSecretGroup]'}, + } + + def __init__( + self, + **kwargs + ): + super(CloudServiceOsProfile, self).__init__(**kwargs) + self.secrets = kwargs.get('secrets', None) + + +class CloudServiceProperties(msrest.serialization.Model): + """Cloud service properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param package_url: Specifies a URL that refers to the location of the service package in the + Blob service. The service package URL can be Shared Access Signature (SAS) URI from any storage + account. + This is a write-only property and is not returned in GET calls. + :type package_url: str + :param configuration: Specifies the XML service configuration (.cscfg) for the cloud service. + :type configuration: str + :param configuration_url: Specifies a URL that refers to the location of the service + configuration in the Blob service. The service package URL can be Shared Access Signature + (SAS) URI from any storage account. + This is a write-only property and is not returned in GET calls. + :type configuration_url: str + :param start_cloud_service: (Optional) Indicates whether to start the cloud service immediately + after it is created. The default value is ``true``. + If false, the service model is still deployed, but the code is not run immediately. Instead, + the service is PoweredOff until you call Start, at which time the service will be started. A + deployed service still incurs charges, even if it is poweredoff. + :type start_cloud_service: bool + :param upgrade_mode: Update mode for the cloud service. Role instances are allocated to update + domains when the service is deployed. Updates can be initiated manually in each update domain + or initiated automatically in all update domains. + Possible Values are :code:`
`:code:`
`\ **Auto**\ :code:`
`:code:`
`\ + **Manual** :code:`
`:code:`
`\ **Simultaneous**\ :code:`
`:code:`
` + If not specified, the default value is Auto. If set to Manual, PUT UpdateDomain must be called + to apply the update. If set to Auto, the update is automatically applied to each update domain + in sequence. Possible values include: "Auto", "Manual", "Simultaneous". + :type upgrade_mode: str or + ~azure.mgmt.compute.v2020_10_01_preview.models.CloudServiceUpgradeMode + :param role_profile: Describes the role profile for the cloud service. + :type role_profile: ~azure.mgmt.compute.v2020_10_01_preview.models.CloudServiceRoleProfile + :param os_profile: Describes the OS profile for the cloud service. + :type os_profile: ~azure.mgmt.compute.v2020_10_01_preview.models.CloudServiceOsProfile + :param network_profile: Network Profile for the cloud service. + :type network_profile: + ~azure.mgmt.compute.v2020_10_01_preview.models.CloudServiceNetworkProfile + :param extension_profile: Describes a cloud service extension profile. + :type extension_profile: + ~azure.mgmt.compute.v2020_10_01_preview.models.CloudServiceExtensionProfile + :ivar provisioning_state: The provisioning state, which only appears in the response. + :vartype provisioning_state: str + :ivar unique_id: The unique identifier for the cloud service. + :vartype unique_id: str + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'unique_id': {'readonly': True}, + } + + _attribute_map = { + 'package_url': {'key': 'packageUrl', 'type': 'str'}, + 'configuration': {'key': 'configuration', 'type': 'str'}, + 'configuration_url': {'key': 'configurationUrl', 'type': 'str'}, + 'start_cloud_service': {'key': 'startCloudService', 'type': 'bool'}, + 'upgrade_mode': {'key': 'upgradeMode', 'type': 'str'}, + 'role_profile': {'key': 'roleProfile', 'type': 'CloudServiceRoleProfile'}, + 'os_profile': {'key': 'osProfile', 'type': 'CloudServiceOsProfile'}, + 'network_profile': {'key': 'networkProfile', 'type': 'CloudServiceNetworkProfile'}, + 'extension_profile': {'key': 'extensionProfile', 'type': 'CloudServiceExtensionProfile'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'unique_id': {'key': 'uniqueId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CloudServiceProperties, self).__init__(**kwargs) + self.package_url = kwargs.get('package_url', None) + self.configuration = kwargs.get('configuration', None) + self.configuration_url = kwargs.get('configuration_url', None) + self.start_cloud_service = kwargs.get('start_cloud_service', None) + self.upgrade_mode = kwargs.get('upgrade_mode', None) + self.role_profile = kwargs.get('role_profile', None) + self.os_profile = kwargs.get('os_profile', None) + self.network_profile = kwargs.get('network_profile', None) + self.extension_profile = kwargs.get('extension_profile', None) + self.provisioning_state = None + self.unique_id = None + + +class CloudServiceRole(msrest.serialization.Model): + """Describes a role of the cloud service. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar location: Resource location. + :vartype location: str + :param sku: Describes the cloud service role sku. + :type sku: ~azure.mgmt.compute.v2020_10_01_preview.models.CloudServiceRoleSku + :param properties: + :type properties: ~azure.mgmt.compute.v2020_10_01_preview.models.CloudServiceRoleProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'CloudServiceRoleSku'}, + 'properties': {'key': 'properties', 'type': 'CloudServiceRoleProperties'}, + } + + def __init__( + self, + **kwargs + ): + super(CloudServiceRole, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = None + self.sku = kwargs.get('sku', None) + self.properties = kwargs.get('properties', None) + + +class CloudServiceRoleListResult(msrest.serialization.Model): + """CloudServiceRoleListResult. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. + :type value: list[~azure.mgmt.compute.v2020_10_01_preview.models.CloudServiceRole] + :param next_link: + :type next_link: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[CloudServiceRole]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CloudServiceRoleListResult, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = kwargs.get('next_link', None) + + +class CloudServiceRoleProfile(msrest.serialization.Model): + """Describes the role profile for the cloud service. + + :param roles: List of roles for the cloud service. + :type roles: + list[~azure.mgmt.compute.v2020_10_01_preview.models.CloudServiceRoleProfileProperties] + """ + + _attribute_map = { + 'roles': {'key': 'roles', 'type': '[CloudServiceRoleProfileProperties]'}, + } + + def __init__( + self, + **kwargs + ): + super(CloudServiceRoleProfile, self).__init__(**kwargs) + self.roles = kwargs.get('roles', None) + + +class CloudServiceRoleProfileProperties(msrest.serialization.Model): + """Describes the role properties. + + :param name: Resource name. + :type name: str + :param sku: Describes the cloud service role sku. + :type sku: ~azure.mgmt.compute.v2020_10_01_preview.models.CloudServiceRoleSku + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'CloudServiceRoleSku'}, + } + + def __init__( + self, + **kwargs + ): + super(CloudServiceRoleProfileProperties, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.sku = kwargs.get('sku', None) + + +class CloudServiceRoleProperties(msrest.serialization.Model): + """CloudServiceRoleProperties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar unique_id: Specifies the ID which uniquely identifies a cloud service role. + :vartype unique_id: str + """ + + _validation = { + 'unique_id': {'readonly': True}, + } + + _attribute_map = { + 'unique_id': {'key': 'uniqueId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CloudServiceRoleProperties, self).__init__(**kwargs) + self.unique_id = None + + +class CloudServiceRoleSku(msrest.serialization.Model): + """Describes the cloud service role sku. + + :param name: The sku name. NOTE: If the new SKU is not supported on the hardware the cloud + service is currently on, you need to delete and recreate the cloud service or move back to the + old sku. + :type name: str + :param tier: Specifies the tier of the cloud service. Possible Values are :code:`
`:code:`
` **Standard** :code:`
`:code:`
` **Basic**. + :type tier: str + :param capacity: Specifies the number of role instances in the cloud service. + :type capacity: long + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'tier': {'key': 'tier', 'type': 'str'}, + 'capacity': {'key': 'capacity', 'type': 'long'}, + } + + def __init__( + self, + **kwargs + ): + super(CloudServiceRoleSku, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.tier = kwargs.get('tier', None) + self.capacity = kwargs.get('capacity', None) + + +class CloudServiceUpdate(msrest.serialization.Model): + """CloudServiceUpdate. + + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + **kwargs + ): + super(CloudServiceUpdate, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + + +class CloudServiceVaultAndSecretReference(msrest.serialization.Model): + """CloudServiceVaultAndSecretReference. + + :param source_vault: + :type source_vault: ~azure.mgmt.compute.v2020_10_01_preview.models.SubResource + :param secret_url: + :type secret_url: str + """ + + _attribute_map = { + 'source_vault': {'key': 'sourceVault', 'type': 'SubResource'}, + 'secret_url': {'key': 'secretUrl', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CloudServiceVaultAndSecretReference, self).__init__(**kwargs) + self.source_vault = kwargs.get('source_vault', None) + self.secret_url = kwargs.get('secret_url', None) + + +class CloudServiceVaultCertificate(msrest.serialization.Model): + """Describes a single certificate reference in a Key Vault, and where the certificate should reside on the role instance. + + :param certificate_url: This is the URL of a certificate that has been uploaded to Key Vault as + a secret. + :type certificate_url: str + """ + + _attribute_map = { + 'certificate_url': {'key': 'certificateUrl', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CloudServiceVaultCertificate, self).__init__(**kwargs) + self.certificate_url = kwargs.get('certificate_url', None) + + +class CloudServiceVaultSecretGroup(msrest.serialization.Model): + """Describes a set of certificates which are all in the same Key Vault. + + :param source_vault: The relative URL of the Key Vault containing all of the certificates in + VaultCertificates. + :type source_vault: ~azure.mgmt.compute.v2020_10_01_preview.models.SubResource + :param vault_certificates: The list of key vault references in SourceVault which contain + certificates. + :type vault_certificates: + list[~azure.mgmt.compute.v2020_10_01_preview.models.CloudServiceVaultCertificate] + """ + + _attribute_map = { + 'source_vault': {'key': 'sourceVault', 'type': 'SubResource'}, + 'vault_certificates': {'key': 'vaultCertificates', 'type': '[CloudServiceVaultCertificate]'}, + } + + def __init__( + self, + **kwargs + ): + super(CloudServiceVaultSecretGroup, self).__init__(**kwargs) + self.source_vault = kwargs.get('source_vault', None) + self.vault_certificates = kwargs.get('vault_certificates', None) + + +class Extension(msrest.serialization.Model): + """Describes a cloud service Extension. + + :param name: The name of the extension. + :type name: str + :param properties: Extension Properties. + :type properties: + ~azure.mgmt.compute.v2020_10_01_preview.models.CloudServiceExtensionProperties + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'CloudServiceExtensionProperties'}, + } + + def __init__( + self, + **kwargs + ): + super(Extension, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.properties = kwargs.get('properties', None) + + +class InnerError(msrest.serialization.Model): + """Inner error details. + + :param exceptiontype: The exception type. + :type exceptiontype: str + :param errordetail: The internal error message or exception dump. + :type errordetail: str + """ + + _attribute_map = { + 'exceptiontype': {'key': 'exceptiontype', 'type': 'str'}, + 'errordetail': {'key': 'errordetail', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(InnerError, self).__init__(**kwargs) + self.exceptiontype = kwargs.get('exceptiontype', None) + self.errordetail = kwargs.get('errordetail', None) + + +class InstanceSku(msrest.serialization.Model): + """InstanceSku. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: The sku name. + :vartype name: str + :ivar tier: The tier of the cloud service role instance. + :vartype tier: str + """ + + _validation = { + 'name': {'readonly': True}, + 'tier': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'tier': {'key': 'tier', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(InstanceSku, self).__init__(**kwargs) + self.name = None + self.tier = None + + +class InstanceViewStatusesSummary(msrest.serialization.Model): + """Instance view statuses. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar statuses_summary: + :vartype statuses_summary: list[~azure.mgmt.compute.v2020_10_01_preview.models.StatusCodeCount] + """ + + _validation = { + 'statuses_summary': {'readonly': True}, + } + + _attribute_map = { + 'statuses_summary': {'key': 'statusesSummary', 'type': '[StatusCodeCount]'}, + } + + def __init__( + self, + **kwargs + ): + super(InstanceViewStatusesSummary, self).__init__(**kwargs) + self.statuses_summary = None + + +class LoadBalancerConfiguration(msrest.serialization.Model): + """Describes the load balancer configuration. + + :param name: Resource Name. + :type name: str + :param properties: + :type properties: + ~azure.mgmt.compute.v2020_10_01_preview.models.LoadBalancerConfigurationProperties + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'LoadBalancerConfigurationProperties'}, + } + + def __init__( + self, + **kwargs + ): + super(LoadBalancerConfiguration, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.properties = kwargs.get('properties', None) + + +class LoadBalancerConfigurationProperties(msrest.serialization.Model): + """LoadBalancerConfigurationProperties. + + :param frontend_ip_configurations: List of IP. + :type frontend_ip_configurations: + list[~azure.mgmt.compute.v2020_10_01_preview.models.LoadBalancerFrontendIPConfiguration] + """ + + _attribute_map = { + 'frontend_ip_configurations': {'key': 'frontendIPConfigurations', 'type': '[LoadBalancerFrontendIPConfiguration]'}, + } + + def __init__( + self, + **kwargs + ): + super(LoadBalancerConfigurationProperties, self).__init__(**kwargs) + self.frontend_ip_configurations = kwargs.get('frontend_ip_configurations', None) + + +class LoadBalancerFrontendIPConfiguration(msrest.serialization.Model): + """LoadBalancerFrontendIPConfiguration. + + :param name: + :type name: str + :param properties: Describes a cloud service IP Configuration. + :type properties: + ~azure.mgmt.compute.v2020_10_01_preview.models.LoadBalancerFrontendIPConfigurationProperties + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'LoadBalancerFrontendIPConfigurationProperties'}, + } + + def __init__( + self, + **kwargs + ): + super(LoadBalancerFrontendIPConfiguration, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.properties = kwargs.get('properties', None) + + +class LoadBalancerFrontendIPConfigurationProperties(msrest.serialization.Model): + """Describes a cloud service IP Configuration. + + :param public_ip_address: + :type public_ip_address: ~azure.mgmt.compute.v2020_10_01_preview.models.SubResource + :param subnet: + :type subnet: ~azure.mgmt.compute.v2020_10_01_preview.models.SubResource + :param private_ip_address: The private IP address referenced by the cloud service. + :type private_ip_address: str + """ + + _attribute_map = { + 'public_ip_address': {'key': 'publicIPAddress', 'type': 'SubResource'}, + 'subnet': {'key': 'subnet', 'type': 'SubResource'}, + 'private_ip_address': {'key': 'privateIPAddress', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(LoadBalancerFrontendIPConfigurationProperties, self).__init__(**kwargs) + self.public_ip_address = kwargs.get('public_ip_address', None) + self.subnet = kwargs.get('subnet', None) + self.private_ip_address = kwargs.get('private_ip_address', None) + + +class ResourceInstanceViewStatus(msrest.serialization.Model): + """Instance view status. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: The status code. + :vartype code: str + :ivar display_status: The short localizable label for the status. + :vartype display_status: str + :ivar message: The detailed status message, including for alerts and error messages. + :vartype message: str + :ivar time: The time of the status. + :vartype time: ~datetime.datetime + :param level: The level code. Possible values include: "Info", "Warning", "Error". + :type level: str or ~azure.mgmt.compute.v2020_10_01_preview.models.StatusLevelTypes + """ + + _validation = { + 'code': {'readonly': True}, + 'display_status': {'readonly': True}, + 'message': {'readonly': True}, + 'time': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'display_status': {'key': 'displayStatus', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'time': {'key': 'time', 'type': 'iso-8601'}, + 'level': {'key': 'level', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ResourceInstanceViewStatus, self).__init__(**kwargs) + self.code = None + self.display_status = None + self.message = None + self.time = None + self.level = kwargs.get('level', None) + + +class RoleInstance(msrest.serialization.Model): + """RoleInstance. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource Name. + :vartype name: str + :ivar type: Resource Type. + :vartype type: str + :ivar location: Resource Location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :param sku: + :type sku: ~azure.mgmt.compute.v2020_10_01_preview.models.InstanceSku + :param properties: + :type properties: ~azure.mgmt.compute.v2020_10_01_preview.models.RoleInstanceProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'readonly': True}, + 'tags': {'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': 'InstanceSku'}, + 'properties': {'key': 'properties', 'type': 'RoleInstanceProperties'}, + } + + def __init__( + self, + **kwargs + ): + super(RoleInstance, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = None + self.tags = None + self.sku = kwargs.get('sku', None) + self.properties = kwargs.get('properties', None) + + +class RoleInstanceListResult(msrest.serialization.Model): + """RoleInstanceListResult. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. + :type value: list[~azure.mgmt.compute.v2020_10_01_preview.models.RoleInstance] + :param next_link: + :type next_link: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[RoleInstance]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(RoleInstanceListResult, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = kwargs.get('next_link', None) + + +class RoleInstanceNetworkProfile(msrest.serialization.Model): + """Describes the network profile for the role instance. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar network_interfaces: Specifies the list of resource Ids for the network interfaces + associated with the role instance. + :vartype network_interfaces: list[~azure.mgmt.compute.v2020_10_01_preview.models.SubResource] + """ + + _validation = { + 'network_interfaces': {'readonly': True}, + } + + _attribute_map = { + 'network_interfaces': {'key': 'networkInterfaces', 'type': '[SubResource]'}, + } + + def __init__( + self, + **kwargs + ): + super(RoleInstanceNetworkProfile, self).__init__(**kwargs) + self.network_interfaces = None + + +class RoleInstanceProperties(msrest.serialization.Model): + """RoleInstanceProperties. + + :param network_profile: Describes the network profile for the role instance. + :type network_profile: + ~azure.mgmt.compute.v2020_10_01_preview.models.RoleInstanceNetworkProfile + :param instance_view: The instance view of the role instance. + :type instance_view: ~azure.mgmt.compute.v2020_10_01_preview.models.RoleInstanceView + """ + + _attribute_map = { + 'network_profile': {'key': 'networkProfile', 'type': 'RoleInstanceNetworkProfile'}, + 'instance_view': {'key': 'instanceView', 'type': 'RoleInstanceView'}, + } + + def __init__( + self, + **kwargs + ): + super(RoleInstanceProperties, self).__init__(**kwargs) + self.network_profile = kwargs.get('network_profile', None) + self.instance_view = kwargs.get('instance_view', None) + + +class RoleInstances(msrest.serialization.Model): + """Specifies a list of role instances from the cloud service. + + All required parameters must be populated in order to send to Azure. + + :param role_instances: Required. List of cloud service role instance names. Value of '*' will + signify all role instances of the cloud service. + :type role_instances: list[str] + """ + + _validation = { + 'role_instances': {'required': True}, + } + + _attribute_map = { + 'role_instances': {'key': 'roleInstances', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(RoleInstances, self).__init__(**kwargs) + self.role_instances = kwargs['role_instances'] + + +class RoleInstanceView(msrest.serialization.Model): + """The instance view of the role instance. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar platform_update_domain: The Update Domain. + :vartype platform_update_domain: int + :ivar platform_fault_domain: The Fault Domain. + :vartype platform_fault_domain: int + :ivar private_id: Specifies a unique identifier generated internally for the cloud service + associated with this role instance. :code:`
`:code:`
` NOTE: If you are using Azure + Diagnostics extension, this property can be used as 'DeploymentId' for querying details. + :vartype private_id: str + :ivar statuses: + :vartype statuses: + list[~azure.mgmt.compute.v2020_10_01_preview.models.ResourceInstanceViewStatus] + """ + + _validation = { + 'platform_update_domain': {'readonly': True}, + 'platform_fault_domain': {'readonly': True}, + 'private_id': {'readonly': True}, + 'statuses': {'readonly': True}, + } + + _attribute_map = { + 'platform_update_domain': {'key': 'platformUpdateDomain', 'type': 'int'}, + 'platform_fault_domain': {'key': 'platformFaultDomain', 'type': 'int'}, + 'private_id': {'key': 'privateId', 'type': 'str'}, + 'statuses': {'key': 'statuses', 'type': '[ResourceInstanceViewStatus]'}, + } + + def __init__( + self, + **kwargs + ): + super(RoleInstanceView, self).__init__(**kwargs) + self.platform_update_domain = None + self.platform_fault_domain = None + self.private_id = None + self.statuses = None + + +class StatusCodeCount(msrest.serialization.Model): + """StatusCodeCount. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: The instance view status code. + :vartype code: str + :ivar count: Number of instances having this status code. + :vartype count: int + """ + + _validation = { + 'code': {'readonly': True}, + 'count': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'count': {'key': 'count', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(StatusCodeCount, self).__init__(**kwargs) + self.code = None + self.count = None + + +class SubResource(msrest.serialization.Model): + """SubResource. + + :param id: Resource Id. + :type id: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SubResource, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + + +class UpdateDomain(msrest.serialization.Model): + """Defines an update domain for the cloud service. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource Name. + :vartype name: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(UpdateDomain, self).__init__(**kwargs) + self.id = None + self.name = None + + +class UpdateDomainListResult(msrest.serialization.Model): + """UpdateDomainListResult. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. + :type value: list[~azure.mgmt.compute.v2020_10_01_preview.models.UpdateDomain] + :param next_link: + :type next_link: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[UpdateDomain]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(UpdateDomainListResult, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = kwargs.get('next_link', None) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/models/_models_py3.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/models/_models_py3.py new file mode 100644 index 000000000000..81684f142e8d --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/models/_models_py3.py @@ -0,0 +1,1340 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Dict, List, Optional, Union + +import msrest.serialization + +from ._compute_management_client_enums import * + + +class ApiError(msrest.serialization.Model): + """Api error. + + :param details: The Api error details. + :type details: list[~azure.mgmt.compute.v2020_10_01_preview.models.ApiErrorBase] + :param innererror: The Api inner error. + :type innererror: ~azure.mgmt.compute.v2020_10_01_preview.models.InnerError + :param code: The error code. + :type code: str + :param message: The error message. + :type message: str + :param target: The target of the particular error. + :type target: str + """ + + _attribute_map = { + 'details': {'key': 'details', 'type': '[ApiErrorBase]'}, + 'innererror': {'key': 'innererror', 'type': 'InnerError'}, + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + } + + def __init__( + self, + *, + details: Optional[List["ApiErrorBase"]] = None, + innererror: Optional["InnerError"] = None, + code: Optional[str] = None, + message: Optional[str] = None, + target: Optional[str] = None, + **kwargs + ): + super(ApiError, self).__init__(**kwargs) + self.details = details + self.innererror = innererror + self.code = code + self.message = message + self.target = target + + +class ApiErrorBase(msrest.serialization.Model): + """Api error base. + + :param code: The error code. + :type code: str + :param message: The error message. + :type message: str + :param target: The target of the particular error. + :type target: str + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + } + + def __init__( + self, + *, + code: Optional[str] = None, + message: Optional[str] = None, + target: Optional[str] = None, + **kwargs + ): + super(ApiErrorBase, self).__init__(**kwargs) + self.code = code + self.message = message + self.target = target + + +class CloudService(msrest.serialization.Model): + """Describes the cloud service. + + 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: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param location: Required. Resource location. + :type location: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param properties: Cloud service properties. + :type properties: ~azure.mgmt.compute.v2020_10_01_preview.models.CloudServiceProperties + """ + + _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}'}, + 'properties': {'key': 'properties', 'type': 'CloudServiceProperties'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + properties: Optional["CloudServiceProperties"] = None, + **kwargs + ): + super(CloudService, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = location + self.tags = tags + self.properties = properties + + +class CloudServiceExtensionProfile(msrest.serialization.Model): + """Describes a cloud service extension profile. + + :param extensions: List of extensions for the cloud service. + :type extensions: list[~azure.mgmt.compute.v2020_10_01_preview.models.Extension] + """ + + _attribute_map = { + 'extensions': {'key': 'extensions', 'type': '[Extension]'}, + } + + def __init__( + self, + *, + extensions: Optional[List["Extension"]] = None, + **kwargs + ): + super(CloudServiceExtensionProfile, self).__init__(**kwargs) + self.extensions = extensions + + +class CloudServiceExtensionProperties(msrest.serialization.Model): + """Extension Properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param publisher: The name of the extension handler publisher. + :type publisher: str + :param type: Specifies the type of the extension. + :type type: str + :param type_handler_version: Specifies the version of the extension. Specifies the version of + the extension. If this element is not specified or an asterisk (*) is used as the value, the + latest version of the extension is used. If the value is specified with a major version number + and an asterisk as the minor version number (X.), the latest minor version of the specified + major version is selected. If a major version number and a minor version number are specified + (X.Y), the specific extension version is selected. If a version is specified, an auto-upgrade + is performed on the role instance. + :type type_handler_version: str + :param auto_upgrade_minor_version: Explicitly specify whether platform can automatically + upgrade typeHandlerVersion to higher minor versions when they become available. + :type auto_upgrade_minor_version: bool + :param settings: Public settings for the extension. For JSON extensions, this is the JSON + settings for the extension. For XML Extension (like RDP), this is the XML setting for the + extension. + :type settings: str + :param protected_settings: Protected settings for the extension which are encrypted before sent + to the role instance. + :type protected_settings: str + :param protected_settings_from_key_vault: + :type protected_settings_from_key_vault: + ~azure.mgmt.compute.v2020_10_01_preview.models.CloudServiceVaultAndSecretReference + :param force_update_tag: Tag to force apply the provided public and protected settings. + Changing the tag value allows for re-running the extension without changing any of the public + or protected settings. + If forceUpdateTag is not changed, updates to public or protected settings would still be + applied by the handler. + If neither forceUpdateTag nor any of public or protected settings change, extension would flow + to the role instance with the same sequence-number, and + it is up to handler implementation whether to re-run it or not. + :type force_update_tag: str + :ivar provisioning_state: The provisioning state, which only appears in the response. + :vartype provisioning_state: str + :param roles_applied_to: Optional list of roles to apply this extension. If property is not + specified or '*' is specified, extension is applied to all roles in the cloud service. + :type roles_applied_to: list[str] + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'publisher': {'key': 'publisher', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'type_handler_version': {'key': 'typeHandlerVersion', 'type': 'str'}, + 'auto_upgrade_minor_version': {'key': 'autoUpgradeMinorVersion', 'type': 'bool'}, + 'settings': {'key': 'settings', 'type': 'str'}, + 'protected_settings': {'key': 'protectedSettings', 'type': 'str'}, + 'protected_settings_from_key_vault': {'key': 'protectedSettingsFromKeyVault', 'type': 'CloudServiceVaultAndSecretReference'}, + 'force_update_tag': {'key': 'forceUpdateTag', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'roles_applied_to': {'key': 'rolesAppliedTo', 'type': '[str]'}, + } + + def __init__( + self, + *, + publisher: Optional[str] = None, + type: Optional[str] = None, + type_handler_version: Optional[str] = None, + auto_upgrade_minor_version: Optional[bool] = None, + settings: Optional[str] = None, + protected_settings: Optional[str] = None, + protected_settings_from_key_vault: Optional["CloudServiceVaultAndSecretReference"] = None, + force_update_tag: Optional[str] = None, + roles_applied_to: Optional[List[str]] = None, + **kwargs + ): + super(CloudServiceExtensionProperties, self).__init__(**kwargs) + self.publisher = publisher + self.type = type + self.type_handler_version = type_handler_version + self.auto_upgrade_minor_version = auto_upgrade_minor_version + self.settings = settings + self.protected_settings = protected_settings + self.protected_settings_from_key_vault = protected_settings_from_key_vault + self.force_update_tag = force_update_tag + self.provisioning_state = None + self.roles_applied_to = roles_applied_to + + +class CloudServiceInstanceView(msrest.serialization.Model): + """InstanceView of CloudService as a whole. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param role_instance: Instance view statuses. + :type role_instance: ~azure.mgmt.compute.v2020_10_01_preview.models.InstanceViewStatusesSummary + :ivar sdk_version: The version of the SDK that was used to generate the package for the cloud + service. + :vartype sdk_version: str + :ivar statuses: + :vartype statuses: + list[~azure.mgmt.compute.v2020_10_01_preview.models.ResourceInstanceViewStatus] + """ + + _validation = { + 'sdk_version': {'readonly': True}, + 'statuses': {'readonly': True}, + } + + _attribute_map = { + 'role_instance': {'key': 'roleInstance', 'type': 'InstanceViewStatusesSummary'}, + 'sdk_version': {'key': 'sdkVersion', 'type': 'str'}, + 'statuses': {'key': 'statuses', 'type': '[ResourceInstanceViewStatus]'}, + } + + def __init__( + self, + *, + role_instance: Optional["InstanceViewStatusesSummary"] = None, + **kwargs + ): + super(CloudServiceInstanceView, self).__init__(**kwargs) + self.role_instance = role_instance + self.sdk_version = None + self.statuses = None + + +class CloudServiceListResult(msrest.serialization.Model): + """CloudServiceListResult. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. + :type value: list[~azure.mgmt.compute.v2020_10_01_preview.models.CloudService] + :param next_link: + :type next_link: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[CloudService]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["CloudService"], + next_link: Optional[str] = None, + **kwargs + ): + super(CloudServiceListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class CloudServiceNetworkProfile(msrest.serialization.Model): + """Network Profile for the cloud service. + + :param load_balancer_configurations: The list of load balancer configurations for the cloud + service. + :type load_balancer_configurations: + list[~azure.mgmt.compute.v2020_10_01_preview.models.LoadBalancerConfiguration] + :param swappable_cloud_service: + :type swappable_cloud_service: ~azure.mgmt.compute.v2020_10_01_preview.models.SubResource + """ + + _attribute_map = { + 'load_balancer_configurations': {'key': 'loadBalancerConfigurations', 'type': '[LoadBalancerConfiguration]'}, + 'swappable_cloud_service': {'key': 'swappableCloudService', 'type': 'SubResource'}, + } + + def __init__( + self, + *, + load_balancer_configurations: Optional[List["LoadBalancerConfiguration"]] = None, + swappable_cloud_service: Optional["SubResource"] = None, + **kwargs + ): + super(CloudServiceNetworkProfile, self).__init__(**kwargs) + self.load_balancer_configurations = load_balancer_configurations + self.swappable_cloud_service = swappable_cloud_service + + +class CloudServiceOsProfile(msrest.serialization.Model): + """Describes the OS profile for the cloud service. + + :param secrets: Specifies set of certificates that should be installed onto the role instances. + :type secrets: + list[~azure.mgmt.compute.v2020_10_01_preview.models.CloudServiceVaultSecretGroup] + """ + + _attribute_map = { + 'secrets': {'key': 'secrets', 'type': '[CloudServiceVaultSecretGroup]'}, + } + + def __init__( + self, + *, + secrets: Optional[List["CloudServiceVaultSecretGroup"]] = None, + **kwargs + ): + super(CloudServiceOsProfile, self).__init__(**kwargs) + self.secrets = secrets + + +class CloudServiceProperties(msrest.serialization.Model): + """Cloud service properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param package_url: Specifies a URL that refers to the location of the service package in the + Blob service. The service package URL can be Shared Access Signature (SAS) URI from any storage + account. + This is a write-only property and is not returned in GET calls. + :type package_url: str + :param configuration: Specifies the XML service configuration (.cscfg) for the cloud service. + :type configuration: str + :param configuration_url: Specifies a URL that refers to the location of the service + configuration in the Blob service. The service package URL can be Shared Access Signature + (SAS) URI from any storage account. + This is a write-only property and is not returned in GET calls. + :type configuration_url: str + :param start_cloud_service: (Optional) Indicates whether to start the cloud service immediately + after it is created. The default value is ``true``. + If false, the service model is still deployed, but the code is not run immediately. Instead, + the service is PoweredOff until you call Start, at which time the service will be started. A + deployed service still incurs charges, even if it is poweredoff. + :type start_cloud_service: bool + :param upgrade_mode: Update mode for the cloud service. Role instances are allocated to update + domains when the service is deployed. Updates can be initiated manually in each update domain + or initiated automatically in all update domains. + Possible Values are :code:`
`:code:`
`\ **Auto**\ :code:`
`:code:`
`\ + **Manual** :code:`
`:code:`
`\ **Simultaneous**\ :code:`
`:code:`
` + If not specified, the default value is Auto. If set to Manual, PUT UpdateDomain must be called + to apply the update. If set to Auto, the update is automatically applied to each update domain + in sequence. Possible values include: "Auto", "Manual", "Simultaneous". + :type upgrade_mode: str or + ~azure.mgmt.compute.v2020_10_01_preview.models.CloudServiceUpgradeMode + :param role_profile: Describes the role profile for the cloud service. + :type role_profile: ~azure.mgmt.compute.v2020_10_01_preview.models.CloudServiceRoleProfile + :param os_profile: Describes the OS profile for the cloud service. + :type os_profile: ~azure.mgmt.compute.v2020_10_01_preview.models.CloudServiceOsProfile + :param network_profile: Network Profile for the cloud service. + :type network_profile: + ~azure.mgmt.compute.v2020_10_01_preview.models.CloudServiceNetworkProfile + :param extension_profile: Describes a cloud service extension profile. + :type extension_profile: + ~azure.mgmt.compute.v2020_10_01_preview.models.CloudServiceExtensionProfile + :ivar provisioning_state: The provisioning state, which only appears in the response. + :vartype provisioning_state: str + :ivar unique_id: The unique identifier for the cloud service. + :vartype unique_id: str + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'unique_id': {'readonly': True}, + } + + _attribute_map = { + 'package_url': {'key': 'packageUrl', 'type': 'str'}, + 'configuration': {'key': 'configuration', 'type': 'str'}, + 'configuration_url': {'key': 'configurationUrl', 'type': 'str'}, + 'start_cloud_service': {'key': 'startCloudService', 'type': 'bool'}, + 'upgrade_mode': {'key': 'upgradeMode', 'type': 'str'}, + 'role_profile': {'key': 'roleProfile', 'type': 'CloudServiceRoleProfile'}, + 'os_profile': {'key': 'osProfile', 'type': 'CloudServiceOsProfile'}, + 'network_profile': {'key': 'networkProfile', 'type': 'CloudServiceNetworkProfile'}, + 'extension_profile': {'key': 'extensionProfile', 'type': 'CloudServiceExtensionProfile'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'unique_id': {'key': 'uniqueId', 'type': 'str'}, + } + + def __init__( + self, + *, + package_url: Optional[str] = None, + configuration: Optional[str] = None, + configuration_url: Optional[str] = None, + start_cloud_service: Optional[bool] = None, + upgrade_mode: Optional[Union[str, "CloudServiceUpgradeMode"]] = None, + role_profile: Optional["CloudServiceRoleProfile"] = None, + os_profile: Optional["CloudServiceOsProfile"] = None, + network_profile: Optional["CloudServiceNetworkProfile"] = None, + extension_profile: Optional["CloudServiceExtensionProfile"] = None, + **kwargs + ): + super(CloudServiceProperties, self).__init__(**kwargs) + self.package_url = package_url + self.configuration = configuration + self.configuration_url = configuration_url + self.start_cloud_service = start_cloud_service + self.upgrade_mode = upgrade_mode + self.role_profile = role_profile + self.os_profile = os_profile + self.network_profile = network_profile + self.extension_profile = extension_profile + self.provisioning_state = None + self.unique_id = None + + +class CloudServiceRole(msrest.serialization.Model): + """Describes a role of the cloud service. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar location: Resource location. + :vartype location: str + :param sku: Describes the cloud service role sku. + :type sku: ~azure.mgmt.compute.v2020_10_01_preview.models.CloudServiceRoleSku + :param properties: + :type properties: ~azure.mgmt.compute.v2020_10_01_preview.models.CloudServiceRoleProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'CloudServiceRoleSku'}, + 'properties': {'key': 'properties', 'type': 'CloudServiceRoleProperties'}, + } + + def __init__( + self, + *, + sku: Optional["CloudServiceRoleSku"] = None, + properties: Optional["CloudServiceRoleProperties"] = None, + **kwargs + ): + super(CloudServiceRole, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = None + self.sku = sku + self.properties = properties + + +class CloudServiceRoleListResult(msrest.serialization.Model): + """CloudServiceRoleListResult. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. + :type value: list[~azure.mgmt.compute.v2020_10_01_preview.models.CloudServiceRole] + :param next_link: + :type next_link: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[CloudServiceRole]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["CloudServiceRole"], + next_link: Optional[str] = None, + **kwargs + ): + super(CloudServiceRoleListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class CloudServiceRoleProfile(msrest.serialization.Model): + """Describes the role profile for the cloud service. + + :param roles: List of roles for the cloud service. + :type roles: + list[~azure.mgmt.compute.v2020_10_01_preview.models.CloudServiceRoleProfileProperties] + """ + + _attribute_map = { + 'roles': {'key': 'roles', 'type': '[CloudServiceRoleProfileProperties]'}, + } + + def __init__( + self, + *, + roles: Optional[List["CloudServiceRoleProfileProperties"]] = None, + **kwargs + ): + super(CloudServiceRoleProfile, self).__init__(**kwargs) + self.roles = roles + + +class CloudServiceRoleProfileProperties(msrest.serialization.Model): + """Describes the role properties. + + :param name: Resource name. + :type name: str + :param sku: Describes the cloud service role sku. + :type sku: ~azure.mgmt.compute.v2020_10_01_preview.models.CloudServiceRoleSku + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'CloudServiceRoleSku'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + sku: Optional["CloudServiceRoleSku"] = None, + **kwargs + ): + super(CloudServiceRoleProfileProperties, self).__init__(**kwargs) + self.name = name + self.sku = sku + + +class CloudServiceRoleProperties(msrest.serialization.Model): + """CloudServiceRoleProperties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar unique_id: Specifies the ID which uniquely identifies a cloud service role. + :vartype unique_id: str + """ + + _validation = { + 'unique_id': {'readonly': True}, + } + + _attribute_map = { + 'unique_id': {'key': 'uniqueId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CloudServiceRoleProperties, self).__init__(**kwargs) + self.unique_id = None + + +class CloudServiceRoleSku(msrest.serialization.Model): + """Describes the cloud service role sku. + + :param name: The sku name. NOTE: If the new SKU is not supported on the hardware the cloud + service is currently on, you need to delete and recreate the cloud service or move back to the + old sku. + :type name: str + :param tier: Specifies the tier of the cloud service. Possible Values are :code:`
`:code:`
` **Standard** :code:`
`:code:`
` **Basic**. + :type tier: str + :param capacity: Specifies the number of role instances in the cloud service. + :type capacity: long + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'tier': {'key': 'tier', 'type': 'str'}, + 'capacity': {'key': 'capacity', 'type': 'long'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + tier: Optional[str] = None, + capacity: Optional[int] = None, + **kwargs + ): + super(CloudServiceRoleSku, self).__init__(**kwargs) + self.name = name + self.tier = tier + self.capacity = capacity + + +class CloudServiceUpdate(msrest.serialization.Model): + """CloudServiceUpdate. + + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(CloudServiceUpdate, self).__init__(**kwargs) + self.tags = tags + + +class CloudServiceVaultAndSecretReference(msrest.serialization.Model): + """CloudServiceVaultAndSecretReference. + + :param source_vault: + :type source_vault: ~azure.mgmt.compute.v2020_10_01_preview.models.SubResource + :param secret_url: + :type secret_url: str + """ + + _attribute_map = { + 'source_vault': {'key': 'sourceVault', 'type': 'SubResource'}, + 'secret_url': {'key': 'secretUrl', 'type': 'str'}, + } + + def __init__( + self, + *, + source_vault: Optional["SubResource"] = None, + secret_url: Optional[str] = None, + **kwargs + ): + super(CloudServiceVaultAndSecretReference, self).__init__(**kwargs) + self.source_vault = source_vault + self.secret_url = secret_url + + +class CloudServiceVaultCertificate(msrest.serialization.Model): + """Describes a single certificate reference in a Key Vault, and where the certificate should reside on the role instance. + + :param certificate_url: This is the URL of a certificate that has been uploaded to Key Vault as + a secret. + :type certificate_url: str + """ + + _attribute_map = { + 'certificate_url': {'key': 'certificateUrl', 'type': 'str'}, + } + + def __init__( + self, + *, + certificate_url: Optional[str] = None, + **kwargs + ): + super(CloudServiceVaultCertificate, self).__init__(**kwargs) + self.certificate_url = certificate_url + + +class CloudServiceVaultSecretGroup(msrest.serialization.Model): + """Describes a set of certificates which are all in the same Key Vault. + + :param source_vault: The relative URL of the Key Vault containing all of the certificates in + VaultCertificates. + :type source_vault: ~azure.mgmt.compute.v2020_10_01_preview.models.SubResource + :param vault_certificates: The list of key vault references in SourceVault which contain + certificates. + :type vault_certificates: + list[~azure.mgmt.compute.v2020_10_01_preview.models.CloudServiceVaultCertificate] + """ + + _attribute_map = { + 'source_vault': {'key': 'sourceVault', 'type': 'SubResource'}, + 'vault_certificates': {'key': 'vaultCertificates', 'type': '[CloudServiceVaultCertificate]'}, + } + + def __init__( + self, + *, + source_vault: Optional["SubResource"] = None, + vault_certificates: Optional[List["CloudServiceVaultCertificate"]] = None, + **kwargs + ): + super(CloudServiceVaultSecretGroup, self).__init__(**kwargs) + self.source_vault = source_vault + self.vault_certificates = vault_certificates + + +class Extension(msrest.serialization.Model): + """Describes a cloud service Extension. + + :param name: The name of the extension. + :type name: str + :param properties: Extension Properties. + :type properties: + ~azure.mgmt.compute.v2020_10_01_preview.models.CloudServiceExtensionProperties + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'CloudServiceExtensionProperties'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + properties: Optional["CloudServiceExtensionProperties"] = None, + **kwargs + ): + super(Extension, self).__init__(**kwargs) + self.name = name + self.properties = properties + + +class InnerError(msrest.serialization.Model): + """Inner error details. + + :param exceptiontype: The exception type. + :type exceptiontype: str + :param errordetail: The internal error message or exception dump. + :type errordetail: str + """ + + _attribute_map = { + 'exceptiontype': {'key': 'exceptiontype', 'type': 'str'}, + 'errordetail': {'key': 'errordetail', 'type': 'str'}, + } + + def __init__( + self, + *, + exceptiontype: Optional[str] = None, + errordetail: Optional[str] = None, + **kwargs + ): + super(InnerError, self).__init__(**kwargs) + self.exceptiontype = exceptiontype + self.errordetail = errordetail + + +class InstanceSku(msrest.serialization.Model): + """InstanceSku. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: The sku name. + :vartype name: str + :ivar tier: The tier of the cloud service role instance. + :vartype tier: str + """ + + _validation = { + 'name': {'readonly': True}, + 'tier': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'tier': {'key': 'tier', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(InstanceSku, self).__init__(**kwargs) + self.name = None + self.tier = None + + +class InstanceViewStatusesSummary(msrest.serialization.Model): + """Instance view statuses. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar statuses_summary: + :vartype statuses_summary: list[~azure.mgmt.compute.v2020_10_01_preview.models.StatusCodeCount] + """ + + _validation = { + 'statuses_summary': {'readonly': True}, + } + + _attribute_map = { + 'statuses_summary': {'key': 'statusesSummary', 'type': '[StatusCodeCount]'}, + } + + def __init__( + self, + **kwargs + ): + super(InstanceViewStatusesSummary, self).__init__(**kwargs) + self.statuses_summary = None + + +class LoadBalancerConfiguration(msrest.serialization.Model): + """Describes the load balancer configuration. + + :param name: Resource Name. + :type name: str + :param properties: + :type properties: + ~azure.mgmt.compute.v2020_10_01_preview.models.LoadBalancerConfigurationProperties + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'LoadBalancerConfigurationProperties'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + properties: Optional["LoadBalancerConfigurationProperties"] = None, + **kwargs + ): + super(LoadBalancerConfiguration, self).__init__(**kwargs) + self.name = name + self.properties = properties + + +class LoadBalancerConfigurationProperties(msrest.serialization.Model): + """LoadBalancerConfigurationProperties. + + :param frontend_ip_configurations: List of IP. + :type frontend_ip_configurations: + list[~azure.mgmt.compute.v2020_10_01_preview.models.LoadBalancerFrontendIPConfiguration] + """ + + _attribute_map = { + 'frontend_ip_configurations': {'key': 'frontendIPConfigurations', 'type': '[LoadBalancerFrontendIPConfiguration]'}, + } + + def __init__( + self, + *, + frontend_ip_configurations: Optional[List["LoadBalancerFrontendIPConfiguration"]] = None, + **kwargs + ): + super(LoadBalancerConfigurationProperties, self).__init__(**kwargs) + self.frontend_ip_configurations = frontend_ip_configurations + + +class LoadBalancerFrontendIPConfiguration(msrest.serialization.Model): + """LoadBalancerFrontendIPConfiguration. + + :param name: + :type name: str + :param properties: Describes a cloud service IP Configuration. + :type properties: + ~azure.mgmt.compute.v2020_10_01_preview.models.LoadBalancerFrontendIPConfigurationProperties + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'LoadBalancerFrontendIPConfigurationProperties'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + properties: Optional["LoadBalancerFrontendIPConfigurationProperties"] = None, + **kwargs + ): + super(LoadBalancerFrontendIPConfiguration, self).__init__(**kwargs) + self.name = name + self.properties = properties + + +class LoadBalancerFrontendIPConfigurationProperties(msrest.serialization.Model): + """Describes a cloud service IP Configuration. + + :param public_ip_address: + :type public_ip_address: ~azure.mgmt.compute.v2020_10_01_preview.models.SubResource + :param subnet: + :type subnet: ~azure.mgmt.compute.v2020_10_01_preview.models.SubResource + :param private_ip_address: The private IP address referenced by the cloud service. + :type private_ip_address: str + """ + + _attribute_map = { + 'public_ip_address': {'key': 'publicIPAddress', 'type': 'SubResource'}, + 'subnet': {'key': 'subnet', 'type': 'SubResource'}, + 'private_ip_address': {'key': 'privateIPAddress', 'type': 'str'}, + } + + def __init__( + self, + *, + public_ip_address: Optional["SubResource"] = None, + subnet: Optional["SubResource"] = None, + private_ip_address: Optional[str] = None, + **kwargs + ): + super(LoadBalancerFrontendIPConfigurationProperties, self).__init__(**kwargs) + self.public_ip_address = public_ip_address + self.subnet = subnet + self.private_ip_address = private_ip_address + + +class ResourceInstanceViewStatus(msrest.serialization.Model): + """Instance view status. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: The status code. + :vartype code: str + :ivar display_status: The short localizable label for the status. + :vartype display_status: str + :ivar message: The detailed status message, including for alerts and error messages. + :vartype message: str + :ivar time: The time of the status. + :vartype time: ~datetime.datetime + :param level: The level code. Possible values include: "Info", "Warning", "Error". + :type level: str or ~azure.mgmt.compute.v2020_10_01_preview.models.StatusLevelTypes + """ + + _validation = { + 'code': {'readonly': True}, + 'display_status': {'readonly': True}, + 'message': {'readonly': True}, + 'time': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'display_status': {'key': 'displayStatus', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'time': {'key': 'time', 'type': 'iso-8601'}, + 'level': {'key': 'level', 'type': 'str'}, + } + + def __init__( + self, + *, + level: Optional[Union[str, "StatusLevelTypes"]] = None, + **kwargs + ): + super(ResourceInstanceViewStatus, self).__init__(**kwargs) + self.code = None + self.display_status = None + self.message = None + self.time = None + self.level = level + + +class RoleInstance(msrest.serialization.Model): + """RoleInstance. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource Name. + :vartype name: str + :ivar type: Resource Type. + :vartype type: str + :ivar location: Resource Location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :param sku: + :type sku: ~azure.mgmt.compute.v2020_10_01_preview.models.InstanceSku + :param properties: + :type properties: ~azure.mgmt.compute.v2020_10_01_preview.models.RoleInstanceProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'readonly': True}, + 'tags': {'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': 'InstanceSku'}, + 'properties': {'key': 'properties', 'type': 'RoleInstanceProperties'}, + } + + def __init__( + self, + *, + sku: Optional["InstanceSku"] = None, + properties: Optional["RoleInstanceProperties"] = None, + **kwargs + ): + super(RoleInstance, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = None + self.tags = None + self.sku = sku + self.properties = properties + + +class RoleInstanceListResult(msrest.serialization.Model): + """RoleInstanceListResult. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. + :type value: list[~azure.mgmt.compute.v2020_10_01_preview.models.RoleInstance] + :param next_link: + :type next_link: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[RoleInstance]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["RoleInstance"], + next_link: Optional[str] = None, + **kwargs + ): + super(RoleInstanceListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class RoleInstanceNetworkProfile(msrest.serialization.Model): + """Describes the network profile for the role instance. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar network_interfaces: Specifies the list of resource Ids for the network interfaces + associated with the role instance. + :vartype network_interfaces: list[~azure.mgmt.compute.v2020_10_01_preview.models.SubResource] + """ + + _validation = { + 'network_interfaces': {'readonly': True}, + } + + _attribute_map = { + 'network_interfaces': {'key': 'networkInterfaces', 'type': '[SubResource]'}, + } + + def __init__( + self, + **kwargs + ): + super(RoleInstanceNetworkProfile, self).__init__(**kwargs) + self.network_interfaces = None + + +class RoleInstanceProperties(msrest.serialization.Model): + """RoleInstanceProperties. + + :param network_profile: Describes the network profile for the role instance. + :type network_profile: + ~azure.mgmt.compute.v2020_10_01_preview.models.RoleInstanceNetworkProfile + :param instance_view: The instance view of the role instance. + :type instance_view: ~azure.mgmt.compute.v2020_10_01_preview.models.RoleInstanceView + """ + + _attribute_map = { + 'network_profile': {'key': 'networkProfile', 'type': 'RoleInstanceNetworkProfile'}, + 'instance_view': {'key': 'instanceView', 'type': 'RoleInstanceView'}, + } + + def __init__( + self, + *, + network_profile: Optional["RoleInstanceNetworkProfile"] = None, + instance_view: Optional["RoleInstanceView"] = None, + **kwargs + ): + super(RoleInstanceProperties, self).__init__(**kwargs) + self.network_profile = network_profile + self.instance_view = instance_view + + +class RoleInstances(msrest.serialization.Model): + """Specifies a list of role instances from the cloud service. + + All required parameters must be populated in order to send to Azure. + + :param role_instances: Required. List of cloud service role instance names. Value of '*' will + signify all role instances of the cloud service. + :type role_instances: list[str] + """ + + _validation = { + 'role_instances': {'required': True}, + } + + _attribute_map = { + 'role_instances': {'key': 'roleInstances', 'type': '[str]'}, + } + + def __init__( + self, + *, + role_instances: List[str], + **kwargs + ): + super(RoleInstances, self).__init__(**kwargs) + self.role_instances = role_instances + + +class RoleInstanceView(msrest.serialization.Model): + """The instance view of the role instance. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar platform_update_domain: The Update Domain. + :vartype platform_update_domain: int + :ivar platform_fault_domain: The Fault Domain. + :vartype platform_fault_domain: int + :ivar private_id: Specifies a unique identifier generated internally for the cloud service + associated with this role instance. :code:`
`:code:`
` NOTE: If you are using Azure + Diagnostics extension, this property can be used as 'DeploymentId' for querying details. + :vartype private_id: str + :ivar statuses: + :vartype statuses: + list[~azure.mgmt.compute.v2020_10_01_preview.models.ResourceInstanceViewStatus] + """ + + _validation = { + 'platform_update_domain': {'readonly': True}, + 'platform_fault_domain': {'readonly': True}, + 'private_id': {'readonly': True}, + 'statuses': {'readonly': True}, + } + + _attribute_map = { + 'platform_update_domain': {'key': 'platformUpdateDomain', 'type': 'int'}, + 'platform_fault_domain': {'key': 'platformFaultDomain', 'type': 'int'}, + 'private_id': {'key': 'privateId', 'type': 'str'}, + 'statuses': {'key': 'statuses', 'type': '[ResourceInstanceViewStatus]'}, + } + + def __init__( + self, + **kwargs + ): + super(RoleInstanceView, self).__init__(**kwargs) + self.platform_update_domain = None + self.platform_fault_domain = None + self.private_id = None + self.statuses = None + + +class StatusCodeCount(msrest.serialization.Model): + """StatusCodeCount. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: The instance view status code. + :vartype code: str + :ivar count: Number of instances having this status code. + :vartype count: int + """ + + _validation = { + 'code': {'readonly': True}, + 'count': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'count': {'key': 'count', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(StatusCodeCount, self).__init__(**kwargs) + self.code = None + self.count = None + + +class SubResource(msrest.serialization.Model): + """SubResource. + + :param id: Resource Id. + :type id: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + **kwargs + ): + super(SubResource, self).__init__(**kwargs) + self.id = id + + +class UpdateDomain(msrest.serialization.Model): + """Defines an update domain for the cloud service. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource Name. + :vartype name: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(UpdateDomain, self).__init__(**kwargs) + self.id = None + self.name = None + + +class UpdateDomainListResult(msrest.serialization.Model): + """UpdateDomainListResult. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. + :type value: list[~azure.mgmt.compute.v2020_10_01_preview.models.UpdateDomain] + :param next_link: + :type next_link: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[UpdateDomain]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["UpdateDomain"], + next_link: Optional[str] = None, + **kwargs + ): + super(UpdateDomainListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/operations/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/operations/__init__.py new file mode 100644 index 000000000000..0ecb0abd1ee4 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/operations/__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 ._cloud_service_role_instances_operations import CloudServiceRoleInstancesOperations +from ._cloud_service_roles_operations import CloudServiceRolesOperations +from ._cloud_services_operations import CloudServicesOperations +from ._cloud_services_update_domain_operations import CloudServicesUpdateDomainOperations + +__all__ = [ + 'CloudServiceRoleInstancesOperations', + 'CloudServiceRolesOperations', + 'CloudServicesOperations', + 'CloudServicesUpdateDomainOperations', +] diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/operations/_cloud_service_role_instances_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/operations/_cloud_service_role_instances_operations.py new file mode 100644 index 000000000000..37d7447cf0e8 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/operations/_cloud_service_role_instances_operations.py @@ -0,0 +1,796 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, IO, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class CloudServiceRoleInstancesOperations(object): + """CloudServiceRoleInstancesOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.compute.v2020_10_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def _delete_initial( + self, + role_instance_name, # type: str + resource_group_name, # type: str + cloud_service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'roleInstanceName': self._serialize.url("role_instance_name", role_instance_name, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}'} # type: ignore + + def begin_delete( + self, + role_instance_name, # type: str + resource_group_name, # type: str + cloud_service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Deletes a role instance from a cloud service. + + :param role_instance_name: Name of the role instance. + :type role_instance_name: str + :param resource_group_name: + :type resource_group_name: str + :param cloud_service_name: + :type cloud_service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + role_instance_name=role_instance_name, + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'roleInstanceName': self._serialize.url("role_instance_name", role_instance_name, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}'} # type: ignore + + def get( + self, + role_instance_name, # type: str + resource_group_name, # type: str + cloud_service_name, # type: str + expand="instanceView", # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "_models.RoleInstance" + """Gets a role instance from a cloud service. + + :param role_instance_name: Name of the role instance. + :type role_instance_name: str + :param resource_group_name: + :type resource_group_name: str + :param cloud_service_name: + :type cloud_service_name: str + :param expand: The expand expression to apply to the operation. + :type expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RoleInstance, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2020_10_01_preview.models.RoleInstance + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RoleInstance"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'roleInstanceName': self._serialize.url("role_instance_name", role_instance_name, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RoleInstance', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}'} # type: ignore + + def get_instance_view( + self, + role_instance_name, # type: str + resource_group_name, # type: str + cloud_service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.RoleInstanceView" + """Retrieves information about the run-time state of a role instance in a cloud service. + + :param role_instance_name: Name of the role instance. + :type role_instance_name: str + :param resource_group_name: + :type resource_group_name: str + :param cloud_service_name: + :type cloud_service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RoleInstanceView, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2020_10_01_preview.models.RoleInstanceView + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RoleInstanceView"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01-preview" + accept = "application/json" + + # Construct URL + url = self.get_instance_view.metadata['url'] # type: ignore + path_format_arguments = { + 'roleInstanceName': self._serialize.url("role_instance_name", role_instance_name, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RoleInstanceView', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_instance_view.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/instanceView'} # type: ignore + + def list( + self, + resource_group_name, # type: str + cloud_service_name, # type: str + expand="instanceView", # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.RoleInstanceListResult"] + """Gets the list of all role instances in a cloud service. Use nextLink property in the response + to get the next page of role instances. Do this till nextLink is null to fetch all the role + instances. + + :param resource_group_name: + :type resource_group_name: str + :param cloud_service_name: + :type cloud_service_name: str + :param expand: The expand expression to apply to the operation. + :type expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either RoleInstanceListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_10_01_preview.models.RoleInstanceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RoleInstanceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('RoleInstanceListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances'} # type: ignore + + def _restart_initial( + self, + role_instance_name, # type: str + resource_group_name, # type: str + cloud_service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01-preview" + accept = "application/json" + + # Construct URL + url = self._restart_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'roleInstanceName': self._serialize.url("role_instance_name", role_instance_name, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/restart'} # type: ignore + + def begin_restart( + self, + role_instance_name, # type: str + resource_group_name, # type: str + cloud_service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """The Reboot Role Instance asynchronous operation requests a reboot of a role instance in the + cloud service. + + :param role_instance_name: Name of the role instance. + :type role_instance_name: str + :param resource_group_name: + :type resource_group_name: str + :param cloud_service_name: + :type cloud_service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._restart_initial( + role_instance_name=role_instance_name, + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'roleInstanceName': self._serialize.url("role_instance_name", role_instance_name, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_restart.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/restart'} # type: ignore + + def _reimage_initial( + self, + role_instance_name, # type: str + resource_group_name, # type: str + cloud_service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01-preview" + accept = "application/json" + + # Construct URL + url = self._reimage_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'roleInstanceName': self._serialize.url("role_instance_name", role_instance_name, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/reimage'} # type: ignore + + def begin_reimage( + self, + role_instance_name, # type: str + resource_group_name, # type: str + cloud_service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """The Reimage Role Instance asynchronous operation reinstalls the operating system on instances + of web roles or worker roles. + + :param role_instance_name: Name of the role instance. + :type role_instance_name: str + :param resource_group_name: + :type resource_group_name: str + :param cloud_service_name: + :type cloud_service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._reimage_initial( + role_instance_name=role_instance_name, + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'roleInstanceName': self._serialize.url("role_instance_name", role_instance_name, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_reimage.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/reimage'} # type: ignore + + def _rebuild_initial( + self, + role_instance_name, # type: str + resource_group_name, # type: str + cloud_service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01-preview" + accept = "application/json" + + # Construct URL + url = self._rebuild_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'roleInstanceName': self._serialize.url("role_instance_name", role_instance_name, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _rebuild_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/rebuild'} # type: ignore + + def begin_rebuild( + self, + role_instance_name, # type: str + resource_group_name, # type: str + cloud_service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """The Rebuild Role Instance asynchronous operation reinstalls the operating system on instances + of web roles or worker roles and initializes the storage resources that are used by them. If + you do not want to initialize storage resources, you can use Reimage Role Instance. + + :param role_instance_name: Name of the role instance. + :type role_instance_name: str + :param resource_group_name: + :type resource_group_name: str + :param cloud_service_name: + :type cloud_service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._rebuild_initial( + role_instance_name=role_instance_name, + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'roleInstanceName': self._serialize.url("role_instance_name", role_instance_name, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_rebuild.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/rebuild'} # type: ignore + + def get_remote_desktop_file( + self, + role_instance_name, # type: str + resource_group_name, # type: str + cloud_service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> IO + """Gets a remote desktop file for a role instance in a cloud service. + + :param role_instance_name: Name of the role instance. + :type role_instance_name: str + :param resource_group_name: + :type resource_group_name: str + :param cloud_service_name: + :type cloud_service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IO, or the result of cls(response) + :rtype: IO + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[IO] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01-preview" + accept = "application/x-rdp" + + # Construct URL + url = self.get_remote_desktop_file.metadata['url'] # type: ignore + path_format_arguments = { + 'roleInstanceName': self._serialize.url("role_instance_name", role_instance_name, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=True, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_remote_desktop_file.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/remoteDesktopFile'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/operations/_cloud_service_roles_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/operations/_cloud_service_roles_operations.py new file mode 100644 index 000000000000..cf24771e9266 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/operations/_cloud_service_roles_operations.py @@ -0,0 +1,185 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class CloudServiceRolesOperations(object): + """CloudServiceRolesOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.compute.v2020_10_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def get( + self, + role_name, # type: str + resource_group_name, # type: str + cloud_service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.CloudServiceRole" + """Gets a role from a cloud service. + + :param role_name: Name of the role. + :type role_name: str + :param resource_group_name: + :type resource_group_name: str + :param cloud_service_name: + :type cloud_service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CloudServiceRole, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2020_10_01_preview.models.CloudServiceRole + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CloudServiceRole"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'roleName': self._serialize.url("role_name", role_name, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CloudServiceRole', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roles/{roleName}'} # type: ignore + + def list( + self, + resource_group_name, # type: str + cloud_service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.CloudServiceRoleListResult"] + """Gets a list of all roles in a cloud service. Use nextLink property in the response to get the + next page of roles. Do this till nextLink is null to fetch all the roles. + + :param resource_group_name: + :type resource_group_name: str + :param cloud_service_name: + :type cloud_service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CloudServiceRoleListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_10_01_preview.models.CloudServiceRoleListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CloudServiceRoleListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('CloudServiceRoleListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roles'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/operations/_cloud_services_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/operations/_cloud_services_operations.py new file mode 100644 index 000000000000..3fb7f728a76b --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/operations/_cloud_services_operations.py @@ -0,0 +1,1397 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class CloudServicesOperations(object): + """CloudServicesOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.compute.v2020_10_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def _create_or_update_initial( + self, + resource_group_name, # type: str + cloud_service_name, # type: str + parameters=None, # type: Optional["_models.CloudService"] + **kwargs # type: Any + ): + # type: (...) -> "_models.CloudService" + cls = kwargs.pop('cls', None) # type: ClsType["_models.CloudService"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if parameters is not None: + body_content = self._serialize.body(parameters, 'CloudService') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('CloudService', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('CloudService', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}'} # type: ignore + + def begin_create_or_update( + self, + resource_group_name, # type: str + cloud_service_name, # type: str + parameters=None, # type: Optional["_models.CloudService"] + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.CloudService"] + """Create or update a cloud service. Please note some properties can be set only during cloud + service creation. + + :param resource_group_name: Name of the resource group. + :type resource_group_name: str + :param cloud_service_name: Name of the cloud service. + :type cloud_service_name: str + :param parameters: The cloud service object. + :type parameters: ~azure.mgmt.compute.v2020_10_01_preview.models.CloudService + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either CloudService or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_10_01_preview.models.CloudService] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.CloudService"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('CloudService', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}'} # type: ignore + + def _update_initial( + self, + resource_group_name, # type: str + cloud_service_name, # type: str + parameters=None, # type: Optional["_models.CloudServiceUpdate"] + **kwargs # type: Any + ): + # type: (...) -> "_models.CloudService" + cls = kwargs.pop('cls', None) # type: ClsType["_models.CloudService"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if parameters is not None: + body_content = self._serialize.body(parameters, 'CloudServiceUpdate') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CloudService', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}'} # type: ignore + + def begin_update( + self, + resource_group_name, # type: str + cloud_service_name, # type: str + parameters=None, # type: Optional["_models.CloudServiceUpdate"] + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.CloudService"] + """Update a cloud service. + + :param resource_group_name: Name of the resource group. + :type resource_group_name: str + :param cloud_service_name: Name of the cloud service. + :type cloud_service_name: str + :param parameters: The cloud service object. + :type parameters: ~azure.mgmt.compute.v2020_10_01_preview.models.CloudServiceUpdate + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either CloudService or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_10_01_preview.models.CloudService] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.CloudService"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('CloudService', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name, # type: str + cloud_service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + cloud_service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Deletes a cloud service. + + :param resource_group_name: Name of the resource group. + :type resource_group_name: str + :param cloud_service_name: Name of the cloud service. + :type cloud_service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}'} # type: ignore + + def get( + self, + resource_group_name, # type: str + cloud_service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.CloudService" + """Display information about a cloud service. + + :param resource_group_name: Name of the resource group. + :type resource_group_name: str + :param cloud_service_name: Name of the cloud service. + :type cloud_service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CloudService, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2020_10_01_preview.models.CloudService + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CloudService"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CloudService', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}'} # type: ignore + + def get_instance_view( + self, + resource_group_name, # type: str + cloud_service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.CloudServiceInstanceView" + """Gets the status of a cloud service. + + :param resource_group_name: Name of the resource group. + :type resource_group_name: str + :param cloud_service_name: Name of the cloud service. + :type cloud_service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CloudServiceInstanceView, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2020_10_01_preview.models.CloudServiceInstanceView + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CloudServiceInstanceView"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01-preview" + accept = "application/json" + + # Construct URL + url = self.get_instance_view.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CloudServiceInstanceView', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_instance_view.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/instanceView'} # type: ignore + + def list_all( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.CloudServiceListResult"] + """Gets a list of all cloud services in the subscription, regardless of the associated resource + group. Use nextLink property in the response to get the next page of Cloud Services. Do this + till nextLink is null to fetch all the Cloud Services. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CloudServiceListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_10_01_preview.models.CloudServiceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CloudServiceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_all.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('CloudServiceListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_all.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/cloudServices'} # type: ignore + + def list( + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.CloudServiceListResult"] + """Gets a list of all cloud services under a resource group. Use nextLink property in the response + to get the next page of Cloud Services. Do this till nextLink is null to fetch all the Cloud + Services. + + :param resource_group_name: Name of the resource group. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CloudServiceListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_10_01_preview.models.CloudServiceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CloudServiceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('CloudServiceListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices'} # type: ignore + + def _start_initial( + self, + resource_group_name, # type: str + cloud_service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01-preview" + accept = "application/json" + + # Construct URL + url = self._start_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/start'} # type: ignore + + def begin_start( + self, + resource_group_name, # type: str + cloud_service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Starts the cloud service. + + :param resource_group_name: Name of the resource group. + :type resource_group_name: str + :param cloud_service_name: Name of the cloud service. + :type cloud_service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._start_initial( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_start.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/start'} # type: ignore + + def _power_off_initial( + self, + resource_group_name, # type: str + cloud_service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01-preview" + accept = "application/json" + + # Construct URL + url = self._power_off_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _power_off_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/poweroff'} # type: ignore + + def begin_power_off( + self, + resource_group_name, # type: str + cloud_service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Power off the cloud service. Note that resources are still attached and you are getting charged + for the resources. + + :param resource_group_name: Name of the resource group. + :type resource_group_name: str + :param cloud_service_name: Name of the cloud service. + :type cloud_service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._power_off_initial( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_power_off.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/poweroff'} # type: ignore + + def _restart_initial( + self, + resource_group_name, # type: str + cloud_service_name, # type: str + parameters=None, # type: Optional["_models.RoleInstances"] + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._restart_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if parameters is not None: + body_content = self._serialize.body(parameters, 'RoleInstances') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/restart'} # type: ignore + + def begin_restart( + self, + resource_group_name, # type: str + cloud_service_name, # type: str + parameters=None, # type: Optional["_models.RoleInstances"] + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Restarts one or more role instances in a cloud service. + + :param resource_group_name: Name of the resource group. + :type resource_group_name: str + :param cloud_service_name: Name of the cloud service. + :type cloud_service_name: str + :param parameters: List of cloud service role instance names. + :type parameters: ~azure.mgmt.compute.v2020_10_01_preview.models.RoleInstances + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._restart_initial( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_restart.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/restart'} # type: ignore + + def _reimage_initial( + self, + resource_group_name, # type: str + cloud_service_name, # type: str + parameters=None, # type: Optional["_models.RoleInstances"] + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._reimage_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if parameters is not None: + body_content = self._serialize.body(parameters, 'RoleInstances') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/reimage'} # type: ignore + + def begin_reimage( + self, + resource_group_name, # type: str + cloud_service_name, # type: str + parameters=None, # type: Optional["_models.RoleInstances"] + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Reimage asynchronous operation reinstalls the operating system on instances of web roles or + worker roles. + + :param resource_group_name: Name of the resource group. + :type resource_group_name: str + :param cloud_service_name: Name of the cloud service. + :type cloud_service_name: str + :param parameters: List of cloud service role instance names. + :type parameters: ~azure.mgmt.compute.v2020_10_01_preview.models.RoleInstances + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._reimage_initial( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_reimage.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/reimage'} # type: ignore + + def _rebuild_initial( + self, + resource_group_name, # type: str + cloud_service_name, # type: str + parameters=None, # type: Optional["_models.RoleInstances"] + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._rebuild_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if parameters is not None: + body_content = self._serialize.body(parameters, 'RoleInstances') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _rebuild_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/rebuild'} # type: ignore + + def begin_rebuild( + self, + resource_group_name, # type: str + cloud_service_name, # type: str + parameters=None, # type: Optional["_models.RoleInstances"] + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Rebuild Role Instances reinstalls the operating system on instances of web roles or worker + roles and initializes the storage resources that are used by them. If you do not want to + initialize storage resources, you can use Reimage Role Instances. + + :param resource_group_name: Name of the resource group. + :type resource_group_name: str + :param cloud_service_name: Name of the cloud service. + :type cloud_service_name: str + :param parameters: List of cloud service role instance names. + :type parameters: ~azure.mgmt.compute.v2020_10_01_preview.models.RoleInstances + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._rebuild_initial( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_rebuild.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/rebuild'} # type: ignore + + def _delete_instances_initial( + self, + resource_group_name, # type: str + cloud_service_name, # type: str + parameters=None, # type: Optional["_models.RoleInstances"] + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._delete_instances_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if parameters is not None: + body_content = self._serialize.body(parameters, 'RoleInstances') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_instances_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/delete'} # type: ignore + + def begin_delete_instances( + self, + resource_group_name, # type: str + cloud_service_name, # type: str + parameters=None, # type: Optional["_models.RoleInstances"] + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Deletes role instances in a cloud service. + + :param resource_group_name: Name of the resource group. + :type resource_group_name: str + :param cloud_service_name: Name of the cloud service. + :type cloud_service_name: str + :param parameters: List of cloud service role instance names. + :type parameters: ~azure.mgmt.compute.v2020_10_01_preview.models.RoleInstances + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_instances_initial( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete_instances.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/delete'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/operations/_cloud_services_update_domain_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/operations/_cloud_services_update_domain_operations.py new file mode 100644 index 000000000000..238654320991 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/operations/_cloud_services_update_domain_operations.py @@ -0,0 +1,322 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class CloudServicesUpdateDomainOperations(object): + """CloudServicesUpdateDomainOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.compute.v2020_10_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def _walk_update_domain_initial( + self, + resource_group_name, # type: str + cloud_service_name, # type: str + update_domain, # type: int + parameters=None, # type: Optional["_models.UpdateDomain"] + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._walk_update_domain_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_name, 'str'), + 'updateDomain': self._serialize.url("update_domain", update_domain, 'int'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if parameters is not None: + body_content = self._serialize.body(parameters, 'UpdateDomain') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _walk_update_domain_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/updateDomains/{updateDomain}'} # type: ignore + + def begin_walk_update_domain( + self, + resource_group_name, # type: str + cloud_service_name, # type: str + update_domain, # type: int + parameters=None, # type: Optional["_models.UpdateDomain"] + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Updates the role instances in the specified update domain. + + :param resource_group_name: Name of the resource group. + :type resource_group_name: str + :param cloud_service_name: Name of the cloud service. + :type cloud_service_name: str + :param update_domain: Specifies an integer value that identifies the update domain. Update + domains are identified with a zero-based index: the first update domain has an ID of 0, the + second has an ID of 1, and so on. + :type update_domain: int + :param parameters: The update domain object. + :type parameters: ~azure.mgmt.compute.v2020_10_01_preview.models.UpdateDomain + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._walk_update_domain_initial( + resource_group_name=resource_group_name, + cloud_service_name=cloud_service_name, + update_domain=update_domain, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_name, 'str'), + 'updateDomain': self._serialize.url("update_domain", update_domain, 'int'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_walk_update_domain.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/updateDomains/{updateDomain}'} # type: ignore + + def get_update_domain( + self, + resource_group_name, # type: str + cloud_service_name, # type: str + update_domain, # type: int + **kwargs # type: Any + ): + # type: (...) -> "_models.UpdateDomain" + """Gets the specified update domain of a cloud service. Use nextLink property in the response to + get the next page of update domains. Do this till nextLink is null to fetch all the update + domains. + + :param resource_group_name: Name of the resource group. + :type resource_group_name: str + :param cloud_service_name: Name of the cloud service. + :type cloud_service_name: str + :param update_domain: Specifies an integer value that identifies the update domain. Update + domains are identified with a zero-based index: the first update domain has an ID of 0, the + second has an ID of 1, and so on. + :type update_domain: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: UpdateDomain, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2020_10_01_preview.models.UpdateDomain + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.UpdateDomain"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01-preview" + accept = "application/json" + + # Construct URL + url = self.get_update_domain.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_name, 'str'), + 'updateDomain': self._serialize.url("update_domain", update_domain, 'int'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('UpdateDomain', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_update_domain.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/updateDomains/{updateDomain}'} # type: ignore + + def list_update_domains( + self, + resource_group_name, # type: str + cloud_service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.UpdateDomainListResult"] + """Gets a list of all update domains in a cloud service. + + :param resource_group_name: Name of the resource group. + :type resource_group_name: str + :param cloud_service_name: Name of the cloud service. + :type cloud_service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either UpdateDomainListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_10_01_preview.models.UpdateDomainListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.UpdateDomainListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_update_domains.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'cloudServiceName': self._serialize.url("cloud_service_name", cloud_service_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('UpdateDomainListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_update_domains.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/updateDomains'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/py.typed b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file