From 360d98450677d76abeb806dfc9308b4a7f469627 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Mon, 14 Mar 2022 19:55:32 +0000 Subject: [PATCH] CodeGen from PR 17985 in Azure/azure-rest-api-specs Merge fd6bae5f5c9407bf8f66ce57792a425202eb85ed into 08fa2b41d6a430eb6bb8ac49453684b6fb5c3900 --- sdk/compute/azure-mgmt-compute/_meta.json | 4 +- .../compute/_compute_management_client.py | 59 +- .../compute/aio/_compute_management_client.py | 59 +- .../azure/mgmt/compute/models.py | 2 +- .../mgmt/compute/v2015_06_15/_version.py | 2 +- .../mgmt/compute/v2016_03_30/_version.py | 2 +- .../compute/v2016_04_30_preview/_version.py | 2 +- .../mgmt/compute/v2017_03_30/_version.py | 2 +- .../mgmt/compute/v2017_09_01/_version.py | 2 +- .../mgmt/compute/v2017_12_01/_version.py | 2 +- .../mgmt/compute/v2018_04_01/_version.py | 2 +- .../mgmt/compute/v2018_06_01/_version.py | 2 +- .../mgmt/compute/v2018_09_30/_version.py | 2 +- .../mgmt/compute/v2018_10_01/_version.py | 2 +- .../mgmt/compute/v2019_03_01/_version.py | 2 +- .../mgmt/compute/v2019_04_01/_version.py | 2 +- .../mgmt/compute/v2019_07_01/_version.py | 2 +- .../mgmt/compute/v2019_11_01/_version.py | 2 +- .../mgmt/compute/v2019_12_01/_version.py | 2 +- .../mgmt/compute/v2020_05_01/_version.py | 2 +- .../mgmt/compute/v2020_06_01/_version.py | 2 +- .../mgmt/compute/v2020_06_30/_version.py | 2 +- .../mgmt/compute/v2020_09_30/_version.py | 2 +- .../compute/v2020_10_01_preview/_version.py | 2 +- .../mgmt/compute/v2020_12_01/_version.py | 2 +- .../mgmt/compute/v2021_03_01/_version.py | 2 +- .../mgmt/compute/v2021_04_01/_version.py | 2 +- .../mgmt/compute/v2021_07_01/_version.py | 2 +- .../_community_galleries_operations.py | 3 +- ...unity_gallery_image_versions_operations.py | 3 +- .../_community_gallery_images_operations.py | 3 +- .../_shared_galleries_operations.py | 6 +- ...hared_gallery_image_versions_operations.py | 6 +- .../_shared_gallery_images_operations.py | 6 +- .../compute/v2021_07_01/models/__init__.py | 8 + .../compute/v2021_07_01/models/_models_py3.py | 157 + .../_community_galleries_operations.py | 3 +- ...unity_gallery_image_versions_operations.py | 3 +- .../_community_gallery_images_operations.py | 3 +- .../_shared_galleries_operations.py | 6 +- ...hared_gallery_image_versions_operations.py | 6 +- .../_shared_gallery_images_operations.py | 6 +- .../mgmt/compute/v2021_08_01/_version.py | 2 +- .../mgmt/compute/v2021_10_01/_version.py | 2 +- .../compute/v2021_10_01/models/__init__.py | 2 - .../_compute_management_client_enums.py | 7 - .../compute/v2021_10_01/models/_models_py3.py | 18 - .../mgmt/compute/v2021_11_01/_version.py | 2 +- .../compute/v2021_11_01/models/__init__.py | 2 - .../_compute_management_client_enums.py | 7 - .../compute/v2021_11_01/models/_models_py3.py | 8 - .../mgmt/compute/v2022_01_03/__init__.py | 18 + .../v2022_01_03/_compute_management_client.py | 136 + .../compute/v2022_01_03/_configuration.py | 68 + .../mgmt/compute/v2022_01_03/_metadata.json | 113 + .../azure/mgmt/compute/v2022_01_03/_patch.py | 31 + .../azure/mgmt/compute/v2022_01_03/_vendor.py | 27 + .../mgmt/compute/v2022_01_03/_version.py | 9 + .../mgmt/compute/v2022_01_03/aio/__init__.py | 15 + .../aio/_compute_management_client.py | 134 + .../compute/v2022_01_03/aio/_configuration.py | 67 + .../mgmt/compute/v2022_01_03/aio/_patch.py | 31 + .../v2022_01_03/aio/operations/__init__.py | 35 + .../_community_galleries_operations.py | 96 + ...unity_gallery_image_versions_operations.py | 189 + .../_community_gallery_images_operations.py | 177 + .../aio/operations/_galleries_operations.py | 578 +++ ...gallery_application_versions_operations.py | 587 +++ .../_gallery_applications_operations.py | 545 +++ .../_gallery_image_versions_operations.py | 583 +++ .../operations/_gallery_images_operations.py | 540 +++ .../_gallery_sharing_profile_operations.py | 168 + .../_shared_galleries_operations.py | 173 + ...hared_gallery_image_versions_operations.py | 197 + .../_shared_gallery_images_operations.py | 184 + .../compute/v2022_01_03/models/__init__.py | 211 + .../_compute_management_client_enums.py | 208 + .../compute/v2022_01_03/models/_models_py3.py | 4020 +++++++++++++++++ .../v2022_01_03/operations/__init__.py | 35 + .../_community_galleries_operations.py | 133 + ...unity_gallery_image_versions_operations.py | 266 ++ .../_community_gallery_images_operations.py | 250 + .../operations/_galleries_operations.py | 805 ++++ ...gallery_application_versions_operations.py | 804 ++++ .../_gallery_applications_operations.py | 748 +++ .../_gallery_image_versions_operations.py | 800 ++++ .../operations/_gallery_images_operations.py | 742 +++ .../_gallery_sharing_profile_operations.py | 214 + .../_shared_galleries_operations.py | 245 + ...hared_gallery_image_versions_operations.py | 278 ++ .../_shared_gallery_images_operations.py | 261 ++ .../azure/mgmt/compute/v2022_01_03/py.typed | 1 + 92 files changed, 15045 insertions(+), 118 deletions(-) create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/__init__.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/_compute_management_client.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/_configuration.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/_metadata.json create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/_patch.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/_vendor.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/_version.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/aio/__init__.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/aio/_compute_management_client.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/aio/_configuration.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/aio/_patch.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/aio/operations/__init__.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/aio/operations/_community_galleries_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/aio/operations/_community_gallery_image_versions_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/aio/operations/_community_gallery_images_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/aio/operations/_galleries_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/aio/operations/_gallery_application_versions_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/aio/operations/_gallery_applications_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/aio/operations/_gallery_image_versions_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/aio/operations/_gallery_images_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/aio/operations/_gallery_sharing_profile_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/aio/operations/_shared_galleries_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/aio/operations/_shared_gallery_image_versions_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/aio/operations/_shared_gallery_images_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/models/__init__.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/models/_compute_management_client_enums.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/models/_models_py3.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/operations/__init__.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/operations/_community_galleries_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/operations/_community_gallery_image_versions_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/operations/_community_gallery_images_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/operations/_galleries_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/operations/_gallery_application_versions_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/operations/_gallery_applications_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/operations/_gallery_image_versions_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/operations/_gallery_images_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/operations/_gallery_sharing_profile_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/operations/_shared_galleries_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/operations/_shared_gallery_image_versions_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/operations/_shared_gallery_images_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/py.typed diff --git a/sdk/compute/azure-mgmt-compute/_meta.json b/sdk/compute/azure-mgmt-compute/_meta.json index e0cfed6c0a7d..4a1917c688a0 100644 --- a/sdk/compute/azure-mgmt-compute/_meta.json +++ b/sdk/compute/azure-mgmt-compute/_meta.json @@ -4,8 +4,8 @@ "@autorest/python@5.12.0", "@autorest/modelerfour@4.19.3" ], - "commit": "0105ac02e25089e55a7d4126f8fd303f9415b115", + "commit": "616c3676b7216b5f092a0e760b3403fb964f31fe", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest_command": "autorest specification/compute/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --python3-only --track2 --use=@autorest/python@5.12.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2", + "autorest_command": "autorest specification/compute/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --python3-only --track2 --use=@autorest/python@5.12.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2", "readme": "specification/compute/resource-manager/readme.md" } \ No newline at end of file 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 c704b8bf16e7..bf5ec4d87d49 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 @@ -55,7 +55,7 @@ class ComputeManagementClient(MultiApiClientMixin, _SDKClient): :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ - DEFAULT_API_VERSION = '2021-12-01' + DEFAULT_API_VERSION = '2022-01-03' _PROFILE_TAG = "azure.mgmt.compute.ComputeManagementClient" LATEST_PROFILE = ProfileDefinition({ _PROFILE_TAG: { @@ -68,17 +68,12 @@ class ComputeManagementClient(MultiApiClientMixin, _SDKClient): 'cloud_service_roles': '2021-03-01', 'cloud_services': '2021-03-01', 'cloud_services_update_domain': '2021-03-01', - 'community_galleries': '2021-07-01', - 'community_gallery_image_versions': '2021-07-01', - 'community_gallery_images': '2021-07-01', 'dedicated_host_groups': '2021-11-01', 'dedicated_hosts': '2021-11-01', - 'galleries': '2021-10-01', - 'gallery_application_versions': '2021-10-01', - 'gallery_applications': '2021-10-01', - 'gallery_image_versions': '2021-10-01', - 'gallery_images': '2021-10-01', - 'gallery_sharing_profile': '2021-10-01', + 'disk_accesses': '2021-12-01', + 'disk_encryption_sets': '2021-12-01', + 'disk_restore_point': '2021-12-01', + 'disks': '2021-12-01', 'images': '2021-11-01', 'log_analytics': '2021-11-01', 'operations': '2021-11-01', @@ -86,9 +81,7 @@ class ComputeManagementClient(MultiApiClientMixin, _SDKClient): 'resource_skus': '2021-07-01', 'restore_point_collections': '2021-11-01', 'restore_points': '2021-11-01', - 'shared_galleries': '2021-07-01', - 'shared_gallery_image_versions': '2021-07-01', - 'shared_gallery_images': '2021-07-01', + 'snapshots': '2021-12-01', 'ssh_public_keys': '2021-11-01', 'usage': '2021-11-01', 'virtual_machine_extension_images': '2021-11-01', @@ -160,6 +153,7 @@ def models(cls, api_version=DEFAULT_API_VERSION): * 2021-10-01: :mod:`v2021_10_01.models` * 2021-11-01: :mod:`v2021_11_01.models` * 2021-12-01: :mod:`v2021_12_01.models` + * 2022-01-03: :mod:`v2022_01_03.models` """ if api_version == '2015-06-15': from .v2015_06_15 import models @@ -245,6 +239,9 @@ def models(cls, api_version=DEFAULT_API_VERSION): elif api_version == '2021-12-01': from .v2021_12_01 import models return models + elif api_version == '2022-01-03': + from .v2022_01_03 import models + return models raise ValueError("API version {} is not available".format(api_version)) @property @@ -428,10 +425,13 @@ def community_galleries(self): """Instance depends on the API version: * 2021-07-01: :class:`CommunityGalleriesOperations` + * 2022-01-03: :class:`CommunityGalleriesOperations` """ api_version = self._get_api_version('community_galleries') if api_version == '2021-07-01': from .v2021_07_01.operations import CommunityGalleriesOperations as OperationClass + elif api_version == '2022-01-03': + from .v2022_01_03.operations import CommunityGalleriesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'community_galleries'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -441,10 +441,13 @@ def community_gallery_image_versions(self): """Instance depends on the API version: * 2021-07-01: :class:`CommunityGalleryImageVersionsOperations` + * 2022-01-03: :class:`CommunityGalleryImageVersionsOperations` """ api_version = self._get_api_version('community_gallery_image_versions') if api_version == '2021-07-01': from .v2021_07_01.operations import CommunityGalleryImageVersionsOperations as OperationClass + elif api_version == '2022-01-03': + from .v2022_01_03.operations import CommunityGalleryImageVersionsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'community_gallery_image_versions'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -454,10 +457,13 @@ def community_gallery_images(self): """Instance depends on the API version: * 2021-07-01: :class:`CommunityGalleryImagesOperations` + * 2022-01-03: :class:`CommunityGalleryImagesOperations` """ api_version = self._get_api_version('community_gallery_images') if api_version == '2021-07-01': from .v2021_07_01.operations import CommunityGalleryImagesOperations as OperationClass + elif api_version == '2022-01-03': + from .v2022_01_03.operations import CommunityGalleryImagesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'community_gallery_images'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -695,6 +701,7 @@ def galleries(self): * 2020-09-30: :class:`GalleriesOperations` * 2021-07-01: :class:`GalleriesOperations` * 2021-10-01: :class:`GalleriesOperations` + * 2022-01-03: :class:`GalleriesOperations` """ api_version = self._get_api_version('galleries') if api_version == '2018-06-01': @@ -711,6 +718,8 @@ def galleries(self): from .v2021_07_01.operations import GalleriesOperations as OperationClass elif api_version == '2021-10-01': from .v2021_10_01.operations import GalleriesOperations as OperationClass + elif api_version == '2022-01-03': + from .v2022_01_03.operations import GalleriesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'galleries'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -725,6 +734,7 @@ def gallery_application_versions(self): * 2020-09-30: :class:`GalleryApplicationVersionsOperations` * 2021-07-01: :class:`GalleryApplicationVersionsOperations` * 2021-10-01: :class:`GalleryApplicationVersionsOperations` + * 2022-01-03: :class:`GalleryApplicationVersionsOperations` """ api_version = self._get_api_version('gallery_application_versions') if api_version == '2019-03-01': @@ -739,6 +749,8 @@ def gallery_application_versions(self): from .v2021_07_01.operations import GalleryApplicationVersionsOperations as OperationClass elif api_version == '2021-10-01': from .v2021_10_01.operations import GalleryApplicationVersionsOperations as OperationClass + elif api_version == '2022-01-03': + from .v2022_01_03.operations import GalleryApplicationVersionsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'gallery_application_versions'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -753,6 +765,7 @@ def gallery_applications(self): * 2020-09-30: :class:`GalleryApplicationsOperations` * 2021-07-01: :class:`GalleryApplicationsOperations` * 2021-10-01: :class:`GalleryApplicationsOperations` + * 2022-01-03: :class:`GalleryApplicationsOperations` """ api_version = self._get_api_version('gallery_applications') if api_version == '2019-03-01': @@ -767,6 +780,8 @@ def gallery_applications(self): from .v2021_07_01.operations import GalleryApplicationsOperations as OperationClass elif api_version == '2021-10-01': from .v2021_10_01.operations import GalleryApplicationsOperations as OperationClass + elif api_version == '2022-01-03': + from .v2022_01_03.operations import GalleryApplicationsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'gallery_applications'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -782,6 +797,7 @@ def gallery_image_versions(self): * 2020-09-30: :class:`GalleryImageVersionsOperations` * 2021-07-01: :class:`GalleryImageVersionsOperations` * 2021-10-01: :class:`GalleryImageVersionsOperations` + * 2022-01-03: :class:`GalleryImageVersionsOperations` """ api_version = self._get_api_version('gallery_image_versions') if api_version == '2018-06-01': @@ -798,6 +814,8 @@ def gallery_image_versions(self): from .v2021_07_01.operations import GalleryImageVersionsOperations as OperationClass elif api_version == '2021-10-01': from .v2021_10_01.operations import GalleryImageVersionsOperations as OperationClass + elif api_version == '2022-01-03': + from .v2022_01_03.operations import GalleryImageVersionsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'gallery_image_versions'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -813,6 +831,7 @@ def gallery_images(self): * 2020-09-30: :class:`GalleryImagesOperations` * 2021-07-01: :class:`GalleryImagesOperations` * 2021-10-01: :class:`GalleryImagesOperations` + * 2022-01-03: :class:`GalleryImagesOperations` """ api_version = self._get_api_version('gallery_images') if api_version == '2018-06-01': @@ -829,6 +848,8 @@ def gallery_images(self): from .v2021_07_01.operations import GalleryImagesOperations as OperationClass elif api_version == '2021-10-01': from .v2021_10_01.operations import GalleryImagesOperations as OperationClass + elif api_version == '2022-01-03': + from .v2022_01_03.operations import GalleryImagesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'gallery_images'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -840,6 +861,7 @@ def gallery_sharing_profile(self): * 2020-09-30: :class:`GallerySharingProfileOperations` * 2021-07-01: :class:`GallerySharingProfileOperations` * 2021-10-01: :class:`GallerySharingProfileOperations` + * 2022-01-03: :class:`GallerySharingProfileOperations` """ api_version = self._get_api_version('gallery_sharing_profile') if api_version == '2020-09-30': @@ -848,6 +870,8 @@ def gallery_sharing_profile(self): from .v2021_07_01.operations import GallerySharingProfileOperations as OperationClass elif api_version == '2021-10-01': from .v2021_10_01.operations import GallerySharingProfileOperations as OperationClass + elif api_version == '2022-01-03': + from .v2022_01_03.operations import GallerySharingProfileOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'gallery_sharing_profile'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -1123,12 +1147,15 @@ def shared_galleries(self): * 2020-09-30: :class:`SharedGalleriesOperations` * 2021-07-01: :class:`SharedGalleriesOperations` + * 2022-01-03: :class:`SharedGalleriesOperations` """ api_version = self._get_api_version('shared_galleries') if api_version == '2020-09-30': from .v2020_09_30.operations import SharedGalleriesOperations as OperationClass elif api_version == '2021-07-01': from .v2021_07_01.operations import SharedGalleriesOperations as OperationClass + elif api_version == '2022-01-03': + from .v2022_01_03.operations import SharedGalleriesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'shared_galleries'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -1139,12 +1166,15 @@ def shared_gallery_image_versions(self): * 2020-09-30: :class:`SharedGalleryImageVersionsOperations` * 2021-07-01: :class:`SharedGalleryImageVersionsOperations` + * 2022-01-03: :class:`SharedGalleryImageVersionsOperations` """ api_version = self._get_api_version('shared_gallery_image_versions') if api_version == '2020-09-30': from .v2020_09_30.operations import SharedGalleryImageVersionsOperations as OperationClass elif api_version == '2021-07-01': from .v2021_07_01.operations import SharedGalleryImageVersionsOperations as OperationClass + elif api_version == '2022-01-03': + from .v2022_01_03.operations import SharedGalleryImageVersionsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'shared_gallery_image_versions'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -1155,12 +1185,15 @@ def shared_gallery_images(self): * 2020-09-30: :class:`SharedGalleryImagesOperations` * 2021-07-01: :class:`SharedGalleryImagesOperations` + * 2022-01-03: :class:`SharedGalleryImagesOperations` """ api_version = self._get_api_version('shared_gallery_images') if api_version == '2020-09-30': from .v2020_09_30.operations import SharedGalleryImagesOperations as OperationClass elif api_version == '2021-07-01': from .v2021_07_01.operations import SharedGalleryImagesOperations as OperationClass + elif api_version == '2022-01-03': + from .v2022_01_03.operations import SharedGalleryImagesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'shared_gallery_images'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) diff --git a/sdk/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 042e5c61067d..c4165996bf24 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 @@ -54,7 +54,7 @@ class ComputeManagementClient(MultiApiClientMixin, _SDKClient): :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ - DEFAULT_API_VERSION = '2021-12-01' + DEFAULT_API_VERSION = '2022-01-03' _PROFILE_TAG = "azure.mgmt.compute.ComputeManagementClient" LATEST_PROFILE = ProfileDefinition({ _PROFILE_TAG: { @@ -67,17 +67,12 @@ class ComputeManagementClient(MultiApiClientMixin, _SDKClient): 'cloud_service_roles': '2021-03-01', 'cloud_services': '2021-03-01', 'cloud_services_update_domain': '2021-03-01', - 'community_galleries': '2021-07-01', - 'community_gallery_image_versions': '2021-07-01', - 'community_gallery_images': '2021-07-01', 'dedicated_host_groups': '2021-11-01', 'dedicated_hosts': '2021-11-01', - 'galleries': '2021-10-01', - 'gallery_application_versions': '2021-10-01', - 'gallery_applications': '2021-10-01', - 'gallery_image_versions': '2021-10-01', - 'gallery_images': '2021-10-01', - 'gallery_sharing_profile': '2021-10-01', + 'disk_accesses': '2021-12-01', + 'disk_encryption_sets': '2021-12-01', + 'disk_restore_point': '2021-12-01', + 'disks': '2021-12-01', 'images': '2021-11-01', 'log_analytics': '2021-11-01', 'operations': '2021-11-01', @@ -85,9 +80,7 @@ class ComputeManagementClient(MultiApiClientMixin, _SDKClient): 'resource_skus': '2021-07-01', 'restore_point_collections': '2021-11-01', 'restore_points': '2021-11-01', - 'shared_galleries': '2021-07-01', - 'shared_gallery_image_versions': '2021-07-01', - 'shared_gallery_images': '2021-07-01', + 'snapshots': '2021-12-01', 'ssh_public_keys': '2021-11-01', 'usage': '2021-11-01', 'virtual_machine_extension_images': '2021-11-01', @@ -159,6 +152,7 @@ def models(cls, api_version=DEFAULT_API_VERSION): * 2021-10-01: :mod:`v2021_10_01.models` * 2021-11-01: :mod:`v2021_11_01.models` * 2021-12-01: :mod:`v2021_12_01.models` + * 2022-01-03: :mod:`v2022_01_03.models` """ if api_version == '2015-06-15': from ..v2015_06_15 import models @@ -244,6 +238,9 @@ def models(cls, api_version=DEFAULT_API_VERSION): elif api_version == '2021-12-01': from ..v2021_12_01 import models return models + elif api_version == '2022-01-03': + from ..v2022_01_03 import models + return models raise ValueError("API version {} is not available".format(api_version)) @property @@ -427,10 +424,13 @@ def community_galleries(self): """Instance depends on the API version: * 2021-07-01: :class:`CommunityGalleriesOperations` + * 2022-01-03: :class:`CommunityGalleriesOperations` """ api_version = self._get_api_version('community_galleries') if api_version == '2021-07-01': from ..v2021_07_01.aio.operations import CommunityGalleriesOperations as OperationClass + elif api_version == '2022-01-03': + from ..v2022_01_03.aio.operations import CommunityGalleriesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'community_galleries'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -440,10 +440,13 @@ def community_gallery_image_versions(self): """Instance depends on the API version: * 2021-07-01: :class:`CommunityGalleryImageVersionsOperations` + * 2022-01-03: :class:`CommunityGalleryImageVersionsOperations` """ api_version = self._get_api_version('community_gallery_image_versions') if api_version == '2021-07-01': from ..v2021_07_01.aio.operations import CommunityGalleryImageVersionsOperations as OperationClass + elif api_version == '2022-01-03': + from ..v2022_01_03.aio.operations import CommunityGalleryImageVersionsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'community_gallery_image_versions'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -453,10 +456,13 @@ def community_gallery_images(self): """Instance depends on the API version: * 2021-07-01: :class:`CommunityGalleryImagesOperations` + * 2022-01-03: :class:`CommunityGalleryImagesOperations` """ api_version = self._get_api_version('community_gallery_images') if api_version == '2021-07-01': from ..v2021_07_01.aio.operations import CommunityGalleryImagesOperations as OperationClass + elif api_version == '2022-01-03': + from ..v2022_01_03.aio.operations import CommunityGalleryImagesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'community_gallery_images'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -694,6 +700,7 @@ def galleries(self): * 2020-09-30: :class:`GalleriesOperations` * 2021-07-01: :class:`GalleriesOperations` * 2021-10-01: :class:`GalleriesOperations` + * 2022-01-03: :class:`GalleriesOperations` """ api_version = self._get_api_version('galleries') if api_version == '2018-06-01': @@ -710,6 +717,8 @@ def galleries(self): from ..v2021_07_01.aio.operations import GalleriesOperations as OperationClass elif api_version == '2021-10-01': from ..v2021_10_01.aio.operations import GalleriesOperations as OperationClass + elif api_version == '2022-01-03': + from ..v2022_01_03.aio.operations import GalleriesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'galleries'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -724,6 +733,7 @@ def gallery_application_versions(self): * 2020-09-30: :class:`GalleryApplicationVersionsOperations` * 2021-07-01: :class:`GalleryApplicationVersionsOperations` * 2021-10-01: :class:`GalleryApplicationVersionsOperations` + * 2022-01-03: :class:`GalleryApplicationVersionsOperations` """ api_version = self._get_api_version('gallery_application_versions') if api_version == '2019-03-01': @@ -738,6 +748,8 @@ def gallery_application_versions(self): from ..v2021_07_01.aio.operations import GalleryApplicationVersionsOperations as OperationClass elif api_version == '2021-10-01': from ..v2021_10_01.aio.operations import GalleryApplicationVersionsOperations as OperationClass + elif api_version == '2022-01-03': + from ..v2022_01_03.aio.operations import GalleryApplicationVersionsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'gallery_application_versions'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -752,6 +764,7 @@ def gallery_applications(self): * 2020-09-30: :class:`GalleryApplicationsOperations` * 2021-07-01: :class:`GalleryApplicationsOperations` * 2021-10-01: :class:`GalleryApplicationsOperations` + * 2022-01-03: :class:`GalleryApplicationsOperations` """ api_version = self._get_api_version('gallery_applications') if api_version == '2019-03-01': @@ -766,6 +779,8 @@ def gallery_applications(self): from ..v2021_07_01.aio.operations import GalleryApplicationsOperations as OperationClass elif api_version == '2021-10-01': from ..v2021_10_01.aio.operations import GalleryApplicationsOperations as OperationClass + elif api_version == '2022-01-03': + from ..v2022_01_03.aio.operations import GalleryApplicationsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'gallery_applications'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -781,6 +796,7 @@ def gallery_image_versions(self): * 2020-09-30: :class:`GalleryImageVersionsOperations` * 2021-07-01: :class:`GalleryImageVersionsOperations` * 2021-10-01: :class:`GalleryImageVersionsOperations` + * 2022-01-03: :class:`GalleryImageVersionsOperations` """ api_version = self._get_api_version('gallery_image_versions') if api_version == '2018-06-01': @@ -797,6 +813,8 @@ def gallery_image_versions(self): from ..v2021_07_01.aio.operations import GalleryImageVersionsOperations as OperationClass elif api_version == '2021-10-01': from ..v2021_10_01.aio.operations import GalleryImageVersionsOperations as OperationClass + elif api_version == '2022-01-03': + from ..v2022_01_03.aio.operations import GalleryImageVersionsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'gallery_image_versions'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -812,6 +830,7 @@ def gallery_images(self): * 2020-09-30: :class:`GalleryImagesOperations` * 2021-07-01: :class:`GalleryImagesOperations` * 2021-10-01: :class:`GalleryImagesOperations` + * 2022-01-03: :class:`GalleryImagesOperations` """ api_version = self._get_api_version('gallery_images') if api_version == '2018-06-01': @@ -828,6 +847,8 @@ def gallery_images(self): from ..v2021_07_01.aio.operations import GalleryImagesOperations as OperationClass elif api_version == '2021-10-01': from ..v2021_10_01.aio.operations import GalleryImagesOperations as OperationClass + elif api_version == '2022-01-03': + from ..v2022_01_03.aio.operations import GalleryImagesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'gallery_images'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -839,6 +860,7 @@ def gallery_sharing_profile(self): * 2020-09-30: :class:`GallerySharingProfileOperations` * 2021-07-01: :class:`GallerySharingProfileOperations` * 2021-10-01: :class:`GallerySharingProfileOperations` + * 2022-01-03: :class:`GallerySharingProfileOperations` """ api_version = self._get_api_version('gallery_sharing_profile') if api_version == '2020-09-30': @@ -847,6 +869,8 @@ def gallery_sharing_profile(self): from ..v2021_07_01.aio.operations import GallerySharingProfileOperations as OperationClass elif api_version == '2021-10-01': from ..v2021_10_01.aio.operations import GallerySharingProfileOperations as OperationClass + elif api_version == '2022-01-03': + from ..v2022_01_03.aio.operations import GallerySharingProfileOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'gallery_sharing_profile'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -1122,12 +1146,15 @@ def shared_galleries(self): * 2020-09-30: :class:`SharedGalleriesOperations` * 2021-07-01: :class:`SharedGalleriesOperations` + * 2022-01-03: :class:`SharedGalleriesOperations` """ api_version = self._get_api_version('shared_galleries') if api_version == '2020-09-30': from ..v2020_09_30.aio.operations import SharedGalleriesOperations as OperationClass elif api_version == '2021-07-01': from ..v2021_07_01.aio.operations import SharedGalleriesOperations as OperationClass + elif api_version == '2022-01-03': + from ..v2022_01_03.aio.operations import SharedGalleriesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'shared_galleries'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -1138,12 +1165,15 @@ def shared_gallery_image_versions(self): * 2020-09-30: :class:`SharedGalleryImageVersionsOperations` * 2021-07-01: :class:`SharedGalleryImageVersionsOperations` + * 2022-01-03: :class:`SharedGalleryImageVersionsOperations` """ api_version = self._get_api_version('shared_gallery_image_versions') if api_version == '2020-09-30': from ..v2020_09_30.aio.operations import SharedGalleryImageVersionsOperations as OperationClass elif api_version == '2021-07-01': from ..v2021_07_01.aio.operations import SharedGalleryImageVersionsOperations as OperationClass + elif api_version == '2022-01-03': + from ..v2022_01_03.aio.operations import SharedGalleryImageVersionsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'shared_gallery_image_versions'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -1154,12 +1184,15 @@ def shared_gallery_images(self): * 2020-09-30: :class:`SharedGalleryImagesOperations` * 2021-07-01: :class:`SharedGalleryImagesOperations` + * 2022-01-03: :class:`SharedGalleryImagesOperations` """ api_version = self._get_api_version('shared_gallery_images') if api_version == '2020-09-30': from ..v2020_09_30.aio.operations import SharedGalleryImagesOperations as OperationClass elif api_version == '2021-07-01': from ..v2021_07_01.aio.operations import SharedGalleryImagesOperations as OperationClass + elif api_version == '2022-01-03': + from ..v2022_01_03.aio.operations import SharedGalleryImagesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'shared_gallery_images'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/models.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/models.py index a77d6b519e97..724fe25f8874 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/models.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/models.py @@ -6,6 +6,6 @@ # -------------------------------------------------------------------------- from .v2021_03_01.models import * from .v2021_07_01.models import * -from .v2021_10_01.models import * from .v2021_11_01.models import * from .v2021_12_01.models import * +from .v2022_01_03.models import * diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/_version.py index 5b330c36d73d..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "26.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/_version.py index 5b330c36d73d..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "26.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/_version.py index 5b330c36d73d..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "26.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/_version.py index 5b330c36d73d..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "26.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/_version.py index 5b330c36d73d..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "26.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/_version.py index 5b330c36d73d..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "26.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/_version.py index 5b330c36d73d..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "26.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/_version.py index 5b330c36d73d..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "26.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/_version.py index 5b330c36d73d..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "26.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/_version.py index 5b330c36d73d..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "26.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/_version.py index 5b330c36d73d..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "26.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/_version.py index 5b330c36d73d..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "26.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/_version.py index 5b330c36d73d..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "26.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/_version.py index 5b330c36d73d..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "26.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/_version.py index 5b330c36d73d..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "26.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/_version.py index 5b330c36d73d..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "26.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/_version.py index 5b330c36d73d..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "26.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/_version.py index 5b330c36d73d..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "26.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/_version.py index 5b330c36d73d..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "26.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/_version.py index 5b330c36d73d..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "26.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/_version.py index 5b330c36d73d..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "26.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/_version.py index 5b330c36d73d..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "26.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/_version.py index 5b330c36d73d..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "26.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/_version.py index 5b330c36d73d..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "26.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_community_galleries_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_community_galleries_operations.py index 390843086dc0..172edfdc55b3 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_community_galleries_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_community_galleries_operations.py @@ -83,7 +83,8 @@ async def get( 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) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated2, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CommunityGallery', pipeline_response) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_community_gallery_image_versions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_community_gallery_image_versions_operations.py index 3920762372d8..dbcf65f7a7e4 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_community_gallery_image_versions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_community_gallery_image_versions_operations.py @@ -94,7 +94,8 @@ async def get( 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) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated2, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CommunityGalleryImageVersion', pipeline_response) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_community_gallery_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_community_gallery_images_operations.py index 1f18facd1572..63fede1b2320 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_community_gallery_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_community_gallery_images_operations.py @@ -87,7 +87,8 @@ async def get( 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) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated2, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CommunityGalleryImage', pipeline_response) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_shared_galleries_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_shared_galleries_operations.py index 1de63639fd23..aeaa4e9bfdb4 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_shared_galleries_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_shared_galleries_operations.py @@ -111,7 +111,8 @@ async def get_next(next_link=None): 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) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -160,7 +161,8 @@ async def get( 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) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SharedGallery', pipeline_response) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_shared_gallery_image_versions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_shared_gallery_image_versions_operations.py index 63f59eee3b02..ec30ee38c4c4 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_shared_gallery_image_versions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_shared_gallery_image_versions_operations.py @@ -123,7 +123,8 @@ async def get_next(next_link=None): 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) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -184,7 +185,8 @@ async def get( 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) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SharedGalleryImageVersion', pipeline_response) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_shared_gallery_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_shared_gallery_images_operations.py index 1e6e8c2254e9..a650cd71a5d8 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_shared_gallery_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_shared_gallery_images_operations.py @@ -117,7 +117,8 @@ async def get_next(next_link=None): 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) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -171,7 +172,8 @@ async def get( 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) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SharedGalleryImage', pipeline_response) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/models/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/models/__init__.py index b70380135adb..a14b12f01086 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/models/__init__.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/models/__init__.py @@ -10,6 +10,8 @@ from ._models_py3 import AdditionalUnattendContent from ._models_py3 import ApiEntityReference from ._models_py3 import ApiError +from ._models_py3 import ApiErrorAutoGenerated +from ._models_py3 import ApiErrorAutoGenerated2 from ._models_py3 import ApiErrorBase from ._models_py3 import ApplicationProfile from ._models_py3 import AutomaticOSUpgradePolicy @@ -33,6 +35,8 @@ from ._models_py3 import CapacityReservationProfile from ._models_py3 import CapacityReservationUpdate from ._models_py3 import CapacityReservationUtilization +from ._models_py3 import CloudErrorAutoGenerated +from ._models_py3 import CloudErrorAutoGenerated2 from ._models_py3 import CommunityGallery from ._models_py3 import CommunityGalleryImage from ._models_py3 import CommunityGalleryImageVersion @@ -405,6 +409,8 @@ 'AdditionalUnattendContent', 'ApiEntityReference', 'ApiError', + 'ApiErrorAutoGenerated', + 'ApiErrorAutoGenerated2', 'ApiErrorBase', 'ApplicationProfile', 'AutomaticOSUpgradePolicy', @@ -428,6 +434,8 @@ 'CapacityReservationProfile', 'CapacityReservationUpdate', 'CapacityReservationUtilization', + 'CloudErrorAutoGenerated', + 'CloudErrorAutoGenerated2', 'CommunityGallery', 'CommunityGalleryImage', 'CommunityGalleryImageVersion', diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/models/_models_py3.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/models/_models_py3.py index ac796fe3957b..0600f11a20b8 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/models/_models_py3.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/models/_models_py3.py @@ -9,6 +9,7 @@ import datetime from typing import Any, Dict, List, Optional, Union +from azure.core.exceptions import HttpResponseError import msrest.serialization from ._compute_management_client_enums import * @@ -193,6 +194,112 @@ def __init__( self.message = message +class ApiErrorAutoGenerated(msrest.serialization.Model): + """Api error. + + :ivar details: The Api error details. + :vartype details: list[~azure.mgmt.compute.v2021_07_01.models.ApiErrorBase] + :ivar innererror: The Api inner error. + :vartype innererror: ~azure.mgmt.compute.v2021_07_01.models.InnerError + :ivar code: The error code. + :vartype code: str + :ivar target: The target of the particular error. + :vartype target: str + :ivar message: The error message. + :vartype message: str + """ + + _attribute_map = { + 'details': {'key': 'details', 'type': '[ApiErrorBase]'}, + 'innererror': {'key': 'innererror', 'type': 'InnerError'}, + 'code': {'key': 'code', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__( + self, + *, + details: Optional[List["ApiErrorBase"]] = None, + innererror: Optional["InnerError"] = None, + code: Optional[str] = None, + target: Optional[str] = None, + message: Optional[str] = None, + **kwargs + ): + """ + :keyword details: The Api error details. + :paramtype details: list[~azure.mgmt.compute.v2021_07_01.models.ApiErrorBase] + :keyword innererror: The Api inner error. + :paramtype innererror: ~azure.mgmt.compute.v2021_07_01.models.InnerError + :keyword code: The error code. + :paramtype code: str + :keyword target: The target of the particular error. + :paramtype target: str + :keyword message: The error message. + :paramtype message: str + """ + super(ApiErrorAutoGenerated, self).__init__(**kwargs) + self.details = details + self.innererror = innererror + self.code = code + self.target = target + self.message = message + + +class ApiErrorAutoGenerated2(msrest.serialization.Model): + """Api error. + + :ivar details: The Api error details. + :vartype details: list[~azure.mgmt.compute.v2021_07_01.models.ApiErrorBase] + :ivar innererror: The Api inner error. + :vartype innererror: ~azure.mgmt.compute.v2021_07_01.models.InnerError + :ivar code: The error code. + :vartype code: str + :ivar target: The target of the particular error. + :vartype target: str + :ivar message: The error message. + :vartype message: str + """ + + _attribute_map = { + 'details': {'key': 'details', 'type': '[ApiErrorBase]'}, + 'innererror': {'key': 'innererror', 'type': 'InnerError'}, + 'code': {'key': 'code', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__( + self, + *, + details: Optional[List["ApiErrorBase"]] = None, + innererror: Optional["InnerError"] = None, + code: Optional[str] = None, + target: Optional[str] = None, + message: Optional[str] = None, + **kwargs + ): + """ + :keyword details: The Api error details. + :paramtype details: list[~azure.mgmt.compute.v2021_07_01.models.ApiErrorBase] + :keyword innererror: The Api inner error. + :paramtype innererror: ~azure.mgmt.compute.v2021_07_01.models.InnerError + :keyword code: The error code. + :paramtype code: str + :keyword target: The target of the particular error. + :paramtype target: str + :keyword message: The error message. + :paramtype message: str + """ + super(ApiErrorAutoGenerated2, self).__init__(**kwargs) + self.details = details + self.innererror = innererror + self.code = code + self.target = target + self.message = message + + class ApiErrorBase(msrest.serialization.Model): """Api error base. @@ -1430,6 +1537,56 @@ def __init__( self.virtual_machines_allocated = None +class CloudErrorAutoGenerated(msrest.serialization.Model): + """An error response from the Compute service. + + :ivar error: Api error. + :vartype error: ~azure.mgmt.compute.v2021_07_01.models.ApiErrorAutoGenerated + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ApiErrorAutoGenerated'}, + } + + def __init__( + self, + *, + error: Optional["ApiErrorAutoGenerated"] = None, + **kwargs + ): + """ + :keyword error: Api error. + :paramtype error: ~azure.mgmt.compute.v2021_07_01.models.ApiErrorAutoGenerated + """ + super(CloudErrorAutoGenerated, self).__init__(**kwargs) + self.error = error + + +class CloudErrorAutoGenerated2(msrest.serialization.Model): + """An error response from the Compute service. + + :ivar error: Api error. + :vartype error: ~azure.mgmt.compute.v2021_07_01.models.ApiErrorAutoGenerated2 + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ApiErrorAutoGenerated2'}, + } + + def __init__( + self, + *, + error: Optional["ApiErrorAutoGenerated2"] = None, + **kwargs + ): + """ + :keyword error: Api error. + :paramtype error: ~azure.mgmt.compute.v2021_07_01.models.ApiErrorAutoGenerated2 + """ + super(CloudErrorAutoGenerated2, self).__init__(**kwargs) + self.error = error + + class PirCommunityGalleryResource(msrest.serialization.Model): """Base information about the community gallery resource in pir. diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_community_galleries_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_community_galleries_operations.py index e83842f23440..6183f91fcfc3 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_community_galleries_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_community_galleries_operations.py @@ -120,7 +120,8 @@ def get( 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) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated2, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CommunityGallery', pipeline_response) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_community_gallery_image_versions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_community_gallery_image_versions_operations.py index 2981f2073905..ed810ce341b6 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_community_gallery_image_versions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_community_gallery_image_versions_operations.py @@ -135,7 +135,8 @@ def get( 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) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated2, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CommunityGalleryImageVersion', pipeline_response) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_community_gallery_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_community_gallery_images_operations.py index 9447656ae5d8..19a03b458e97 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_community_gallery_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_community_gallery_images_operations.py @@ -126,7 +126,8 @@ def get( 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) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated2, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CommunityGalleryImage', pipeline_response) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_shared_galleries_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_shared_galleries_operations.py index c786acad5486..9fcc039cfdf3 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_shared_galleries_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_shared_galleries_operations.py @@ -183,7 +183,8 @@ def get_next(next_link=None): 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) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -232,7 +233,8 @@ def get( 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) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SharedGallery', pipeline_response) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_shared_gallery_image_versions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_shared_gallery_image_versions_operations.py index 8267b6dc6556..04ff220b732b 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_shared_gallery_image_versions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_shared_gallery_image_versions_operations.py @@ -204,7 +204,8 @@ def get_next(next_link=None): 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) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -265,7 +266,8 @@ def get( 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) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SharedGalleryImageVersion', pipeline_response) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_shared_gallery_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_shared_gallery_images_operations.py index 009f67a38b10..876303696c93 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_shared_gallery_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_shared_gallery_images_operations.py @@ -194,7 +194,8 @@ def get_next(next_link=None): 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) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -248,7 +249,8 @@ def get( 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) + error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SharedGalleryImage', pipeline_response) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/_version.py index 5b330c36d73d..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "26.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/_version.py index 5b330c36d73d..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "26.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/models/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/models/__init__.py index b74bafca71bc..5a7f4ca73a4c 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/models/__init__.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/models/__init__.py @@ -66,7 +66,6 @@ from ._compute_management_client_enums import ( AggregatedReplicationState, - Architecture, ConfidentialVMEncryptionType, GalleryApplicationVersionPropertiesProvisioningState, GalleryExpandParams, @@ -147,7 +146,6 @@ 'UserArtifactManage', 'UserArtifactSource', 'AggregatedReplicationState', - 'Architecture', 'ConfidentialVMEncryptionType', 'GalleryApplicationVersionPropertiesProvisioningState', 'GalleryExpandParams', diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/models/_compute_management_client_enums.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/models/_compute_management_client_enums.py index 4e18b05290fc..5d781142bbd2 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/models/_compute_management_client_enums.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/models/_compute_management_client_enums.py @@ -20,13 +20,6 @@ class AggregatedReplicationState(with_metaclass(CaseInsensitiveEnumMeta, str, En COMPLETED = "Completed" FAILED = "Failed" -class Architecture(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """The architecture of the image. Applicable to OS disks only. - """ - - X64 = "x64" - ARM64 = "Arm64" - class ConfidentialVMEncryptionType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """confidential VM encryption types """ diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/models/_models_py3.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/models/_models_py3.py index 8e98684a4707..fe09d11f9a8b 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/models/_models_py3.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/models/_models_py3.py @@ -1398,9 +1398,6 @@ class GalleryImage(Resource): ~azure.mgmt.compute.v2021_10_01.models.GalleryImagePropertiesProvisioningState :ivar features: A list of gallery image features. :vartype features: list[~azure.mgmt.compute.v2021_10_01.models.GalleryImageFeature] - :ivar architecture: The architecture of the image. Applicable to OS disks only. Possible values - include: "x64", "Arm64". - :vartype architecture: str or ~azure.mgmt.compute.v2021_10_01.models.Architecture """ _validation = { @@ -1431,7 +1428,6 @@ class GalleryImage(Resource): 'purchase_plan': {'key': 'properties.purchasePlan', 'type': 'ImagePurchasePlan'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, 'features': {'key': 'properties.features', 'type': '[GalleryImageFeature]'}, - 'architecture': {'key': 'properties.architecture', 'type': 'str'}, } def __init__( @@ -1452,7 +1448,6 @@ def __init__( disallowed: Optional["Disallowed"] = None, purchase_plan: Optional["ImagePurchasePlan"] = None, features: Optional[List["GalleryImageFeature"]] = None, - architecture: Optional[Union[str, "Architecture"]] = None, **kwargs ): """ @@ -1496,9 +1491,6 @@ def __init__( :paramtype purchase_plan: ~azure.mgmt.compute.v2021_10_01.models.ImagePurchasePlan :keyword features: A list of gallery image features. :paramtype features: list[~azure.mgmt.compute.v2021_10_01.models.GalleryImageFeature] - :keyword architecture: The architecture of the image. Applicable to OS disks only. Possible - values include: "x64", "Arm64". - :paramtype architecture: str or ~azure.mgmt.compute.v2021_10_01.models.Architecture """ super(GalleryImage, self).__init__(location=location, tags=tags, **kwargs) self.description = description @@ -1515,7 +1507,6 @@ def __init__( self.purchase_plan = purchase_plan self.provisioning_state = None self.features = features - self.architecture = architecture class GalleryImageFeature(msrest.serialization.Model): @@ -1690,9 +1681,6 @@ class GalleryImageUpdate(UpdateResourceDefinition): ~azure.mgmt.compute.v2021_10_01.models.GalleryImagePropertiesProvisioningState :ivar features: A list of gallery image features. :vartype features: list[~azure.mgmt.compute.v2021_10_01.models.GalleryImageFeature] - :ivar architecture: The architecture of the image. Applicable to OS disks only. Possible values - include: "x64", "Arm64". - :vartype architecture: str or ~azure.mgmt.compute.v2021_10_01.models.Architecture """ _validation = { @@ -1721,7 +1709,6 @@ class GalleryImageUpdate(UpdateResourceDefinition): 'purchase_plan': {'key': 'properties.purchasePlan', 'type': 'ImagePurchasePlan'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, 'features': {'key': 'properties.features', 'type': '[GalleryImageFeature]'}, - 'architecture': {'key': 'properties.architecture', 'type': 'str'}, } def __init__( @@ -1741,7 +1728,6 @@ def __init__( disallowed: Optional["Disallowed"] = None, purchase_plan: Optional["ImagePurchasePlan"] = None, features: Optional[List["GalleryImageFeature"]] = None, - architecture: Optional[Union[str, "Architecture"]] = None, **kwargs ): """ @@ -1783,9 +1769,6 @@ def __init__( :paramtype purchase_plan: ~azure.mgmt.compute.v2021_10_01.models.ImagePurchasePlan :keyword features: A list of gallery image features. :paramtype features: list[~azure.mgmt.compute.v2021_10_01.models.GalleryImageFeature] - :keyword architecture: The architecture of the image. Applicable to OS disks only. Possible - values include: "x64", "Arm64". - :paramtype architecture: str or ~azure.mgmt.compute.v2021_10_01.models.Architecture """ super(GalleryImageUpdate, self).__init__(tags=tags, **kwargs) self.description = description @@ -1802,7 +1785,6 @@ def __init__( self.purchase_plan = purchase_plan self.provisioning_state = None self.features = features - self.architecture = architecture class GalleryImageVersion(Resource): diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/_version.py index 5b330c36d73d..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "26.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/models/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/models/__init__.py index ddefdfeddb5a..f2f25d61113b 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/models/__init__.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/models/__init__.py @@ -251,7 +251,6 @@ from ._compute_management_client_enums import ( - ArchitectureTypes, AvailabilitySetSkuTypes, CachingTypes, CapacityReservationGroupInstanceViewTypes, @@ -565,7 +564,6 @@ 'WinRMListener', 'WindowsConfiguration', 'WindowsParameters', - 'ArchitectureTypes', 'AvailabilitySetSkuTypes', 'CachingTypes', 'CapacityReservationGroupInstanceViewTypes', diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/models/_compute_management_client_enums.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/models/_compute_management_client_enums.py index cc45c3208c4b..da3f4c2bca52 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/models/_compute_management_client_enums.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/models/_compute_management_client_enums.py @@ -11,13 +11,6 @@ from azure.core import CaseInsensitiveEnumMeta -class ArchitectureTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Specifies the Architecture Type - """ - - X64 = "x64" - ARM64 = "Arm64" - class AvailabilitySetSkuTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the sku of an Availability Set. Use 'Aligned' for virtual machines with managed disks and 'Classic' for virtual machines with unmanaged disks. Default value is 'Classic'. diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/models/_models_py3.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/models/_models_py3.py index 5b06f8d55e7c..dd242c766463 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/models/_models_py3.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/models/_models_py3.py @@ -9021,8 +9021,6 @@ class VirtualMachineImage(VirtualMachineImageResource): :vartype disallowed: ~azure.mgmt.compute.v2021_11_01.models.DisallowedConfiguration :ivar features: :vartype features: list[~azure.mgmt.compute.v2021_11_01.models.VirtualMachineImageFeature] - :ivar architecture: Specifies the Architecture Type. Possible values include: "x64", "Arm64". - :vartype architecture: str or ~azure.mgmt.compute.v2021_11_01.models.ArchitectureTypes """ _validation = { @@ -9043,7 +9041,6 @@ class VirtualMachineImage(VirtualMachineImageResource): 'hyper_v_generation': {'key': 'properties.hyperVGeneration', 'type': 'str'}, 'disallowed': {'key': 'properties.disallowed', 'type': 'DisallowedConfiguration'}, 'features': {'key': 'properties.features', 'type': '[VirtualMachineImageFeature]'}, - 'architecture': {'key': 'properties.architecture', 'type': 'str'}, } def __init__( @@ -9061,7 +9058,6 @@ def __init__( hyper_v_generation: Optional[Union[str, "HyperVGenerationTypes"]] = None, disallowed: Optional["DisallowedConfiguration"] = None, features: Optional[List["VirtualMachineImageFeature"]] = None, - architecture: Optional[Union[str, "ArchitectureTypes"]] = None, **kwargs ): """ @@ -9097,9 +9093,6 @@ def __init__( :paramtype disallowed: ~azure.mgmt.compute.v2021_11_01.models.DisallowedConfiguration :keyword features: :paramtype features: list[~azure.mgmt.compute.v2021_11_01.models.VirtualMachineImageFeature] - :keyword architecture: Specifies the Architecture Type. Possible values include: "x64", - "Arm64". - :paramtype architecture: str or ~azure.mgmt.compute.v2021_11_01.models.ArchitectureTypes """ super(VirtualMachineImage, self).__init__(id=id, name=name, location=location, tags=tags, extended_location=extended_location, **kwargs) self.plan = plan @@ -9109,7 +9102,6 @@ def __init__( self.hyper_v_generation = hyper_v_generation self.disallowed = disallowed self.features = features - self.architecture = architecture class VirtualMachineImageFeature(msrest.serialization.Model): diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/__init__.py new file mode 100644 index 000000000000..fd39b8a6c901 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/__init__.py @@ -0,0 +1,18 @@ +# 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 +from ._version import VERSION + +__version__ = VERSION +__all__ = ['ComputeManagementClient'] + +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/_compute_management_client.py new file mode 100644 index 000000000000..e6a96ddc6074 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/_compute_management_client.py @@ -0,0 +1,136 @@ +# 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 copy import deepcopy +from typing import Any, Optional, TYPE_CHECKING + +from azure.core.rest import HttpRequest, HttpResponse +from azure.mgmt.core import ARMPipelineClient +from msrest import Deserializer, Serializer + +from . import models +from ._configuration import ComputeManagementClientConfiguration +from .operations import CommunityGalleriesOperations, CommunityGalleryImageVersionsOperations, CommunityGalleryImagesOperations, GalleriesOperations, GalleryApplicationVersionsOperations, GalleryApplicationsOperations, GalleryImageVersionsOperations, GalleryImagesOperations, GallerySharingProfileOperations, SharedGalleriesOperations, SharedGalleryImageVersionsOperations, SharedGalleryImagesOperations + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential + +class ComputeManagementClient: + """Compute Client. + + :ivar galleries: GalleriesOperations operations + :vartype galleries: azure.mgmt.compute.v2022_01_03.operations.GalleriesOperations + :ivar gallery_images: GalleryImagesOperations operations + :vartype gallery_images: azure.mgmt.compute.v2022_01_03.operations.GalleryImagesOperations + :ivar gallery_image_versions: GalleryImageVersionsOperations operations + :vartype gallery_image_versions: + azure.mgmt.compute.v2022_01_03.operations.GalleryImageVersionsOperations + :ivar gallery_applications: GalleryApplicationsOperations operations + :vartype gallery_applications: + azure.mgmt.compute.v2022_01_03.operations.GalleryApplicationsOperations + :ivar gallery_application_versions: GalleryApplicationVersionsOperations operations + :vartype gallery_application_versions: + azure.mgmt.compute.v2022_01_03.operations.GalleryApplicationVersionsOperations + :ivar gallery_sharing_profile: GallerySharingProfileOperations operations + :vartype gallery_sharing_profile: + azure.mgmt.compute.v2022_01_03.operations.GallerySharingProfileOperations + :ivar shared_galleries: SharedGalleriesOperations operations + :vartype shared_galleries: azure.mgmt.compute.v2022_01_03.operations.SharedGalleriesOperations + :ivar shared_gallery_images: SharedGalleryImagesOperations operations + :vartype shared_gallery_images: + azure.mgmt.compute.v2022_01_03.operations.SharedGalleryImagesOperations + :ivar shared_gallery_image_versions: SharedGalleryImageVersionsOperations operations + :vartype shared_gallery_image_versions: + azure.mgmt.compute.v2022_01_03.operations.SharedGalleryImageVersionsOperations + :ivar community_galleries: CommunityGalleriesOperations operations + :vartype community_galleries: + azure.mgmt.compute.v2022_01_03.operations.CommunityGalleriesOperations + :ivar community_gallery_images: CommunityGalleryImagesOperations operations + :vartype community_gallery_images: + azure.mgmt.compute.v2022_01_03.operations.CommunityGalleryImagesOperations + :ivar community_gallery_image_versions: CommunityGalleryImageVersionsOperations operations + :vartype community_gallery_image_versions: + azure.mgmt.compute.v2022_01_03.operations.CommunityGalleryImageVersionsOperations + :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 base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + """ + + def __init__( + self, + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = ComputeManagementClientConfiguration(credential=credential, subscription_id=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._serialize.client_side_validation = False + self.galleries = GalleriesOperations(self._client, self._config, self._serialize, self._deserialize) + self.gallery_images = GalleryImagesOperations(self._client, self._config, self._serialize, self._deserialize) + self.gallery_image_versions = GalleryImageVersionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.gallery_applications = GalleryApplicationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.gallery_application_versions = GalleryApplicationVersionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.gallery_sharing_profile = GallerySharingProfileOperations(self._client, self._config, self._serialize, self._deserialize) + self.shared_galleries = SharedGalleriesOperations(self._client, self._config, self._serialize, self._deserialize) + self.shared_gallery_images = SharedGalleryImagesOperations(self._client, self._config, self._serialize, self._deserialize) + self.shared_gallery_image_versions = SharedGalleryImageVersionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.community_galleries = CommunityGalleriesOperations(self._client, self._config, self._serialize, self._deserialize) + self.community_gallery_images = CommunityGalleryImagesOperations(self._client, self._config, self._serialize, self._deserialize) + self.community_gallery_image_versions = CommunityGalleryImageVersionsOperations(self._client, self._config, self._serialize, self._deserialize) + + + def _send_request( + self, + request, # type: HttpRequest + **kwargs: Any + ) -> HttpResponse: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.HttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) + + 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/v2022_01_03/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/_configuration.py new file mode 100644 index 000000000000..59c658e75b4a --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/_configuration.py @@ -0,0 +1,68 @@ +# 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 ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy + +from ._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential + + +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: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(ComputeManagementClientConfiguration, self).__init__(**kwargs) + 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.") + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2022-01-03" + 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 = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/_metadata.json b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/_metadata.json new file mode 100644 index 000000000000..dd8a7b614c18 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/_metadata.json @@ -0,0 +1,113 @@ +{ + "chosen_version": "2022-01-03", + "total_api_version_list": ["2022-01-03"], + "client": { + "name": "ComputeManagementClient", + "filename": "_compute_management_client", + "description": "Compute Client.", + "host_value": "\"https://management.azure.com\"", + "parameterized_host_template": null, + "azure_arm": true, + "has_lro_operations": true, + "client_side_validation": false, + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + }, + "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: \"AsyncTokenCredential\",", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id: str,", + "description": "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", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version=None, # type: Optional[str]", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url=\"https://management.azure.com\", # type: str", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url: str = \"https://management.azure.com\",", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + } + } + }, + "config": { + "credential": true, + "credential_scopes": ["https://management.azure.com/.default"], + "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + }, + "operation_groups": { + "galleries": "GalleriesOperations", + "gallery_images": "GalleryImagesOperations", + "gallery_image_versions": "GalleryImageVersionsOperations", + "gallery_applications": "GalleryApplicationsOperations", + "gallery_application_versions": "GalleryApplicationVersionsOperations", + "gallery_sharing_profile": "GallerySharingProfileOperations", + "shared_galleries": "SharedGalleriesOperations", + "shared_gallery_images": "SharedGalleryImagesOperations", + "shared_gallery_image_versions": "SharedGalleryImageVersionsOperations", + "community_galleries": "CommunityGalleriesOperations", + "community_gallery_images": "CommunityGalleryImagesOperations", + "community_gallery_image_versions": "CommunityGalleryImageVersionsOperations" + } +} \ No newline at end of file diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/_patch.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/_vendor.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/_version.py new file mode 100644 index 000000000000..e5754a47ce68 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/_version.py @@ -0,0 +1,9 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/aio/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/aio/__init__.py new file mode 100644 index 000000000000..9c044a7dd939 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/aio/__init__.py @@ -0,0 +1,15 @@ +# 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'] + +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/aio/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/aio/_compute_management_client.py new file mode 100644 index 000000000000..ca930e0e7fa3 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/aio/_compute_management_client.py @@ -0,0 +1,134 @@ +# 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 copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING + +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.mgmt.core import AsyncARMPipelineClient +from msrest import Deserializer, Serializer + +from .. import models +from ._configuration import ComputeManagementClientConfiguration +from .operations import CommunityGalleriesOperations, CommunityGalleryImageVersionsOperations, CommunityGalleryImagesOperations, GalleriesOperations, GalleryApplicationVersionsOperations, GalleryApplicationsOperations, GalleryImageVersionsOperations, GalleryImagesOperations, GallerySharingProfileOperations, SharedGalleriesOperations, SharedGalleryImageVersionsOperations, SharedGalleryImagesOperations + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +class ComputeManagementClient: + """Compute Client. + + :ivar galleries: GalleriesOperations operations + :vartype galleries: azure.mgmt.compute.v2022_01_03.aio.operations.GalleriesOperations + :ivar gallery_images: GalleryImagesOperations operations + :vartype gallery_images: azure.mgmt.compute.v2022_01_03.aio.operations.GalleryImagesOperations + :ivar gallery_image_versions: GalleryImageVersionsOperations operations + :vartype gallery_image_versions: + azure.mgmt.compute.v2022_01_03.aio.operations.GalleryImageVersionsOperations + :ivar gallery_applications: GalleryApplicationsOperations operations + :vartype gallery_applications: + azure.mgmt.compute.v2022_01_03.aio.operations.GalleryApplicationsOperations + :ivar gallery_application_versions: GalleryApplicationVersionsOperations operations + :vartype gallery_application_versions: + azure.mgmt.compute.v2022_01_03.aio.operations.GalleryApplicationVersionsOperations + :ivar gallery_sharing_profile: GallerySharingProfileOperations operations + :vartype gallery_sharing_profile: + azure.mgmt.compute.v2022_01_03.aio.operations.GallerySharingProfileOperations + :ivar shared_galleries: SharedGalleriesOperations operations + :vartype shared_galleries: + azure.mgmt.compute.v2022_01_03.aio.operations.SharedGalleriesOperations + :ivar shared_gallery_images: SharedGalleryImagesOperations operations + :vartype shared_gallery_images: + azure.mgmt.compute.v2022_01_03.aio.operations.SharedGalleryImagesOperations + :ivar shared_gallery_image_versions: SharedGalleryImageVersionsOperations operations + :vartype shared_gallery_image_versions: + azure.mgmt.compute.v2022_01_03.aio.operations.SharedGalleryImageVersionsOperations + :ivar community_galleries: CommunityGalleriesOperations operations + :vartype community_galleries: + azure.mgmt.compute.v2022_01_03.aio.operations.CommunityGalleriesOperations + :ivar community_gallery_images: CommunityGalleryImagesOperations operations + :vartype community_gallery_images: + azure.mgmt.compute.v2022_01_03.aio.operations.CommunityGalleryImagesOperations + :ivar community_gallery_image_versions: CommunityGalleryImageVersionsOperations operations + :vartype community_gallery_image_versions: + azure.mgmt.compute.v2022_01_03.aio.operations.CommunityGalleryImageVersionsOperations + :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 base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :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: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = ComputeManagementClientConfiguration(credential=credential, subscription_id=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._serialize.client_side_validation = False + self.galleries = GalleriesOperations(self._client, self._config, self._serialize, self._deserialize) + self.gallery_images = GalleryImagesOperations(self._client, self._config, self._serialize, self._deserialize) + self.gallery_image_versions = GalleryImageVersionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.gallery_applications = GalleryApplicationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.gallery_application_versions = GalleryApplicationVersionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.gallery_sharing_profile = GallerySharingProfileOperations(self._client, self._config, self._serialize, self._deserialize) + self.shared_galleries = SharedGalleriesOperations(self._client, self._config, self._serialize, self._deserialize) + self.shared_gallery_images = SharedGalleryImagesOperations(self._client, self._config, self._serialize, self._deserialize) + self.shared_gallery_image_versions = SharedGalleryImageVersionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.community_galleries = CommunityGalleriesOperations(self._client, self._config, self._serialize, self._deserialize) + self.community_gallery_images = CommunityGalleryImagesOperations(self._client, self._config, self._serialize, self._deserialize) + self.community_gallery_image_versions = CommunityGalleryImageVersionsOperations(self._client, self._config, self._serialize, self._deserialize) + + + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.AsyncHttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) + + 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/v2022_01_03/aio/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/aio/_configuration.py new file mode 100644 index 000000000000..aad3cc238057 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/aio/_configuration.py @@ -0,0 +1,67 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy + +from .._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +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: + super(ComputeManagementClientConfiguration, self).__init__(**kwargs) + 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.") + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2022-01-03" + 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 = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/aio/_patch.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/aio/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/aio/operations/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/aio/operations/__init__.py new file mode 100644 index 000000000000..336e2221f2b0 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/aio/operations/__init__.py @@ -0,0 +1,35 @@ +# 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 ._galleries_operations import GalleriesOperations +from ._gallery_images_operations import GalleryImagesOperations +from ._gallery_image_versions_operations import GalleryImageVersionsOperations +from ._gallery_applications_operations import GalleryApplicationsOperations +from ._gallery_application_versions_operations import GalleryApplicationVersionsOperations +from ._gallery_sharing_profile_operations import GallerySharingProfileOperations +from ._shared_galleries_operations import SharedGalleriesOperations +from ._shared_gallery_images_operations import SharedGalleryImagesOperations +from ._shared_gallery_image_versions_operations import SharedGalleryImageVersionsOperations +from ._community_galleries_operations import CommunityGalleriesOperations +from ._community_gallery_images_operations import CommunityGalleryImagesOperations +from ._community_gallery_image_versions_operations import CommunityGalleryImageVersionsOperations + +__all__ = [ + 'GalleriesOperations', + 'GalleryImagesOperations', + 'GalleryImageVersionsOperations', + 'GalleryApplicationsOperations', + 'GalleryApplicationVersionsOperations', + 'GallerySharingProfileOperations', + 'SharedGalleriesOperations', + 'SharedGalleryImagesOperations', + 'SharedGalleryImageVersionsOperations', + 'CommunityGalleriesOperations', + 'CommunityGalleryImagesOperations', + 'CommunityGalleryImageVersionsOperations', +] diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/aio/operations/_community_galleries_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/aio/operations/_community_galleries_operations.py new file mode 100644 index 000000000000..f0eec27cbd65 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/aio/operations/_community_galleries_operations.py @@ -0,0 +1,96 @@ +# 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 functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._community_galleries_operations import build_get_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class CommunityGalleriesOperations: + """CommunityGalleriesOperations 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.v2022_01_03.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 + + @distributed_trace_async + async def get( + self, + location: str, + public_gallery_name: str, + **kwargs: Any + ) -> "_models.CommunityGallery": + """Get a community gallery by gallery public name. + + :param location: Resource location. + :type location: str + :param public_gallery_name: The public name of the community gallery. + :type public_gallery_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CommunityGallery, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2022_01_03.models.CommunityGallery + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CommunityGallery"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + location=location, + public_gallery_name=public_gallery_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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('CommunityGallery', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/communityGalleries/{publicGalleryName}'} # type: ignore + diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/aio/operations/_community_gallery_image_versions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/aio/operations/_community_gallery_image_versions_operations.py new file mode 100644 index 000000000000..e0e444860732 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/aio/operations/_community_gallery_image_versions_operations.py @@ -0,0 +1,189 @@ +# 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 functools +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 +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._community_gallery_image_versions_operations import build_get_request, build_list_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class CommunityGalleryImageVersionsOperations: + """CommunityGalleryImageVersionsOperations 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.v2022_01_03.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 + + @distributed_trace_async + async def get( + self, + location: str, + public_gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + **kwargs: Any + ) -> "_models.CommunityGalleryImageVersion": + """Get a community gallery image version. + + :param location: Resource location. + :type location: str + :param public_gallery_name: The public name of the community gallery. + :type public_gallery_name: str + :param gallery_image_name: The name of the community gallery image definition. + :type gallery_image_name: str + :param gallery_image_version_name: The name of the community gallery image version. Needs to + follow semantic version name pattern: The allowed characters are digit and period. Digits must + be within the range of a 32-bit integer. Format: + :code:``.:code:``.:code:``. + :type gallery_image_version_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CommunityGalleryImageVersion, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2022_01_03.models.CommunityGalleryImageVersion + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CommunityGalleryImageVersion"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + location=location, + public_gallery_name=public_gallery_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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('CommunityGalleryImageVersion', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/communityGalleries/{publicGalleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore + + + @distributed_trace + def list( + self, + location: str, + public_gallery_name: str, + gallery_image_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.CommunityGalleryImageVersionList"]: + """List community gallery image versions inside an image. + + :param location: Resource location. + :type location: str + :param public_gallery_name: The public name of the community gallery. + :type public_gallery_name: str + :param gallery_image_name: The name of the community gallery image definition. + :type gallery_image_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CommunityGalleryImageVersionList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2022_01_03.models.CommunityGalleryImageVersionList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CommunityGalleryImageVersionList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + location=location, + public_gallery_name=public_gallery_name, + gallery_image_name=gallery_image_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + location=location, + public_gallery_name=public_gallery_name, + gallery_image_name=gallery_image_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("CommunityGalleryImageVersionList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/communityGalleries/{publicGalleryName}/images/{galleryImageName}/versions'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/aio/operations/_community_gallery_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/aio/operations/_community_gallery_images_operations.py new file mode 100644 index 000000000000..9e31ae522707 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/aio/operations/_community_gallery_images_operations.py @@ -0,0 +1,177 @@ +# 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 functools +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 +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._community_gallery_images_operations import build_get_request, build_list_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class CommunityGalleryImagesOperations: + """CommunityGalleryImagesOperations 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.v2022_01_03.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 + + @distributed_trace_async + async def get( + self, + location: str, + public_gallery_name: str, + gallery_image_name: str, + **kwargs: Any + ) -> "_models.CommunityGalleryImage": + """Get a community gallery image. + + :param location: Resource location. + :type location: str + :param public_gallery_name: The public name of the community gallery. + :type public_gallery_name: str + :param gallery_image_name: The name of the community gallery image definition. + :type gallery_image_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CommunityGalleryImage, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2022_01_03.models.CommunityGalleryImage + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CommunityGalleryImage"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + location=location, + public_gallery_name=public_gallery_name, + gallery_image_name=gallery_image_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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('CommunityGalleryImage', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/communityGalleries/{publicGalleryName}/images/{galleryImageName}'} # type: ignore + + + @distributed_trace + def list( + self, + location: str, + public_gallery_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.CommunityGalleryImageList"]: + """List community gallery images inside a gallery. + + :param location: Resource location. + :type location: str + :param public_gallery_name: The public name of the community gallery. + :type public_gallery_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CommunityGalleryImageList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2022_01_03.models.CommunityGalleryImageList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CommunityGalleryImageList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + location=location, + public_gallery_name=public_gallery_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + location=location, + public_gallery_name=public_gallery_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("CommunityGalleryImageList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/communityGalleries/{publicGalleryName}/images'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/aio/operations/_galleries_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/aio/operations/_galleries_operations.py new file mode 100644 index 000000000000..fe9781d87f10 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/aio/operations/_galleries_operations.py @@ -0,0 +1,578 @@ +# 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 functools +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 +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._galleries_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_resource_group_request, build_list_request, build_update_request_initial +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class GalleriesOperations: + """GalleriesOperations 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.v2022_01_03.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, + gallery_name: str, + gallery: "_models.Gallery", + **kwargs: Any + ) -> "_models.Gallery": + cls = kwargs.pop('cls', None) # type: ClsType["_models.Gallery"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(gallery, 'Gallery') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + 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('Gallery', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Gallery', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('Gallery', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}'} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + gallery_name: str, + gallery: "_models.Gallery", + **kwargs: Any + ) -> AsyncLROPoller["_models.Gallery"]: + """Create or update a Shared Image Gallery. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. The allowed characters are alphabets + and numbers with dots and periods allowed in the middle. The maximum length is 80 characters. + :type gallery_name: str + :param gallery: Parameters supplied to the create or update Shared Image Gallery operation. + :type gallery: ~azure.mgmt.compute.v2022_01_03.models.Gallery + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Gallery or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2022_01_03.models.Gallery] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Gallery"] + 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, + gallery_name=gallery_name, + gallery=gallery, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('Gallery', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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/galleries/{galleryName}'} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + gallery_name: str, + gallery: "_models.GalleryUpdate", + **kwargs: Any + ) -> "_models.Gallery": + cls = kwargs.pop('cls', None) # type: ClsType["_models.Gallery"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(gallery, 'GalleryUpdate') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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('Gallery', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}'} # type: ignore + + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + gallery_name: str, + gallery: "_models.GalleryUpdate", + **kwargs: Any + ) -> AsyncLROPoller["_models.Gallery"]: + """Update a Shared Image Gallery. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. The allowed characters are alphabets + and numbers with dots and periods allowed in the middle. The maximum length is 80 characters. + :type gallery_name: str + :param gallery: Parameters supplied to the update Shared Image Gallery operation. + :type gallery: ~azure.mgmt.compute.v2022_01_03.models.GalleryUpdate + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Gallery or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2022_01_03.models.Gallery] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Gallery"] + 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, + gallery_name=gallery_name, + gallery=gallery, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('Gallery', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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/galleries/{galleryName}'} # type: ignore + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + gallery_name: str, + select: Optional[Union[str, "_models.SelectPermissions"]] = None, + expand: Optional[Union[str, "_models.GalleryExpandParams"]] = None, + **kwargs: Any + ) -> "_models.Gallery": + """Retrieves information about a Shared Image Gallery. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. + :type gallery_name: str + :param select: The select expression to apply on the operation. + :type select: str or ~azure.mgmt.compute.v2022_01_03.models.SelectPermissions + :param expand: The expand query option to apply on the operation. + :type expand: str or ~azure.mgmt.compute.v2022_01_03.models.GalleryExpandParams + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Gallery, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2022_01_03.models.Gallery + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Gallery"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + select=select, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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('Gallery', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}'} # type: ignore + + + async def _delete_initial( + self, + resource_group_name: str, + gallery_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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/galleries/{galleryName}'} # type: ignore + + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + gallery_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete a Shared Image Gallery. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery to be deleted. + :type gallery_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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, + gallery_name=gallery_name, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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/galleries/{galleryName}'} # type: ignore + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.GalleryList"]: + """List galleries under a resource group. + + :param resource_group_name: The 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 GalleryList or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2022_01_03.models.GalleryList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("GalleryList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries'} # type: ignore + + @distributed_trace + def list( + self, + **kwargs: Any + ) -> AsyncIterable["_models.GalleryList"]: + """List galleries under a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either GalleryList or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2022_01_03.models.GalleryList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("GalleryList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/galleries'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/aio/operations/_gallery_application_versions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/aio/operations/_gallery_application_versions_operations.py new file mode 100644 index 000000000000..53badf96f2e2 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/aio/operations/_gallery_application_versions_operations.py @@ -0,0 +1,587 @@ +# 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 functools +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 +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._gallery_application_versions_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_gallery_application_request, build_update_request_initial +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class GalleryApplicationVersionsOperations: + """GalleryApplicationVersionsOperations 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.v2022_01_03.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, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + gallery_application_version: "_models.GalleryApplicationVersion", + **kwargs: Any + ) -> "_models.GalleryApplicationVersion": + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplicationVersion"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(gallery_application_version, 'GalleryApplicationVersion') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + gallery_application_version_name=gallery_application_version_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + 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('GalleryApplicationVersion', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('GalleryApplicationVersion', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('GalleryApplicationVersion', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}'} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + gallery_application_version: "_models.GalleryApplicationVersion", + **kwargs: Any + ) -> AsyncLROPoller["_models.GalleryApplicationVersion"]: + """Create or update a gallery Application Version. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param gallery_name: The name of the Shared Application Gallery in which the Application + Definition resides. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition in which the + Application Version is to be created. + :type gallery_application_name: str + :param gallery_application_version_name: The name of the gallery Application Version to be + created. Needs to follow semantic version name pattern: The allowed characters are digit and + period. Digits must be within the range of a 32-bit integer. Format: + :code:``.:code:``.:code:``. + :type gallery_application_version_name: str + :param gallery_application_version: Parameters supplied to the create or update gallery + Application Version operation. + :type gallery_application_version: + ~azure.mgmt.compute.v2022_01_03.models.GalleryApplicationVersion + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either GalleryApplicationVersion or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2022_01_03.models.GalleryApplicationVersion] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplicationVersion"] + 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, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + gallery_application_version_name=gallery_application_version_name, + gallery_application_version=gallery_application_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('GalleryApplicationVersion', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}'} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + gallery_application_version: "_models.GalleryApplicationVersionUpdate", + **kwargs: Any + ) -> "_models.GalleryApplicationVersion": + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplicationVersion"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(gallery_application_version, 'GalleryApplicationVersionUpdate') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + gallery_application_version_name=gallery_application_version_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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('GalleryApplicationVersion', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}'} # type: ignore + + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + gallery_application_version: "_models.GalleryApplicationVersionUpdate", + **kwargs: Any + ) -> AsyncLROPoller["_models.GalleryApplicationVersion"]: + """Update a gallery Application Version. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param gallery_name: The name of the Shared Application Gallery in which the Application + Definition resides. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition in which the + Application Version is to be updated. + :type gallery_application_name: str + :param gallery_application_version_name: The name of the gallery Application Version to be + updated. Needs to follow semantic version name pattern: The allowed characters are digit and + period. Digits must be within the range of a 32-bit integer. Format: + :code:``.:code:``.:code:``. + :type gallery_application_version_name: str + :param gallery_application_version: Parameters supplied to the update gallery Application + Version operation. + :type gallery_application_version: + ~azure.mgmt.compute.v2022_01_03.models.GalleryApplicationVersionUpdate + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either GalleryApplicationVersion or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2022_01_03.models.GalleryApplicationVersion] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplicationVersion"] + 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, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + gallery_application_version_name=gallery_application_version_name, + gallery_application_version=gallery_application_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('GalleryApplicationVersion', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}'} # type: ignore + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + expand: Optional[Union[str, "_models.ReplicationStatusTypes"]] = None, + **kwargs: Any + ) -> "_models.GalleryApplicationVersion": + """Retrieves information about a gallery Application Version. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param gallery_name: The name of the Shared Application Gallery in which the Application + Definition resides. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition in which the + Application Version resides. + :type gallery_application_name: str + :param gallery_application_version_name: The name of the gallery Application Version to be + retrieved. + :type gallery_application_version_name: str + :param expand: The expand expression to apply on the operation. + :type expand: str or ~azure.mgmt.compute.v2022_01_03.models.ReplicationStatusTypes + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GalleryApplicationVersion, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2022_01_03.models.GalleryApplicationVersion + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplicationVersion"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + gallery_application_version_name=gallery_application_version_name, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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('GalleryApplicationVersion', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}'} # type: ignore + + + async def _delete_initial( + self, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + gallery_application_version_name=gallery_application_version_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}'} # type: ignore + + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete a gallery Application Version. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param gallery_name: The name of the Shared Application Gallery in which the Application + Definition resides. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition in which the + Application Version resides. + :type gallery_application_name: str + :param gallery_application_version_name: The name of the gallery Application Version to be + deleted. + :type gallery_application_version_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + gallery_application_version_name=gallery_application_version_name, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}'} # type: ignore + + @distributed_trace + def list_by_gallery_application( + self, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.GalleryApplicationVersionList"]: + """List gallery Application Versions in a gallery Application Definition. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param gallery_name: The name of the Shared Application Gallery in which the Application + Definition resides. + :type gallery_name: str + :param gallery_application_name: The name of the Shared Application Gallery Application + Definition from which the Application Versions are to be listed. + :type gallery_application_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either GalleryApplicationVersionList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2022_01_03.models.GalleryApplicationVersionList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplicationVersionList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_gallery_application_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + template_url=self.list_by_gallery_application.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_gallery_application_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("GalleryApplicationVersionList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_gallery_application.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/aio/operations/_gallery_applications_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/aio/operations/_gallery_applications_operations.py new file mode 100644 index 000000000000..eb7e778a5cea --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/aio/operations/_gallery_applications_operations.py @@ -0,0 +1,545 @@ +# 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 functools +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 +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._gallery_applications_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_gallery_request, build_update_request_initial +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class GalleryApplicationsOperations: + """GalleryApplicationsOperations 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.v2022_01_03.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, + gallery_name: str, + gallery_application_name: str, + gallery_application: "_models.GalleryApplication", + **kwargs: Any + ) -> "_models.GalleryApplication": + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplication"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(gallery_application, 'GalleryApplication') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + 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('GalleryApplication', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('GalleryApplication', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('GalleryApplication', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}'} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application: "_models.GalleryApplication", + **kwargs: Any + ) -> AsyncLROPoller["_models.GalleryApplication"]: + """Create or update a gallery Application Definition. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param gallery_name: The name of the Shared Application Gallery in which the Application + Definition is to be created. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition to be created + or updated. The allowed characters are alphabets and numbers with dots, dashes, and periods + allowed in the middle. The maximum length is 80 characters. + :type gallery_application_name: str + :param gallery_application: Parameters supplied to the create or update gallery Application + operation. + :type gallery_application: ~azure.mgmt.compute.v2022_01_03.models.GalleryApplication + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either GalleryApplication or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2022_01_03.models.GalleryApplication] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplication"] + 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, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + gallery_application=gallery_application, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('GalleryApplication', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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/galleries/{galleryName}/applications/{galleryApplicationName}'} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application: "_models.GalleryApplicationUpdate", + **kwargs: Any + ) -> "_models.GalleryApplication": + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplication"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(gallery_application, 'GalleryApplicationUpdate') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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('GalleryApplication', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}'} # type: ignore + + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application: "_models.GalleryApplicationUpdate", + **kwargs: Any + ) -> AsyncLROPoller["_models.GalleryApplication"]: + """Update a gallery Application Definition. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param gallery_name: The name of the Shared Application Gallery in which the Application + Definition is to be updated. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition to be updated. + The allowed characters are alphabets and numbers with dots, dashes, and periods allowed in the + middle. The maximum length is 80 characters. + :type gallery_application_name: str + :param gallery_application: Parameters supplied to the update gallery Application operation. + :type gallery_application: ~azure.mgmt.compute.v2022_01_03.models.GalleryApplicationUpdate + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either GalleryApplication or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2022_01_03.models.GalleryApplication] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplication"] + 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, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + gallery_application=gallery_application, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('GalleryApplication', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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/galleries/{galleryName}/applications/{galleryApplicationName}'} # type: ignore + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + **kwargs: Any + ) -> "_models.GalleryApplication": + """Retrieves information about a gallery Application Definition. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param gallery_name: The name of the Shared Application Gallery from which the Application + Definitions are to be retrieved. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition to be + retrieved. + :type gallery_application_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GalleryApplication, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2022_01_03.models.GalleryApplication + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplication"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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('GalleryApplication', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}'} # type: ignore + + + async def _delete_initial( + self, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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/galleries/{galleryName}/applications/{galleryApplicationName}'} # type: ignore + + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete a gallery Application. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param gallery_name: The name of the Shared Application Gallery in which the Application + Definition is to be deleted. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition to be deleted. + :type gallery_application_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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/galleries/{galleryName}/applications/{galleryApplicationName}'} # type: ignore + + @distributed_trace + def list_by_gallery( + self, + resource_group_name: str, + gallery_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.GalleryApplicationList"]: + """List gallery Application Definitions in a gallery. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param gallery_name: The name of the Shared Application Gallery from which Application + Definitions are to be listed. + :type gallery_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either GalleryApplicationList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2022_01_03.models.GalleryApplicationList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplicationList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_gallery_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + template_url=self.list_by_gallery.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_gallery_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("GalleryApplicationList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_gallery.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/aio/operations/_gallery_image_versions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/aio/operations/_gallery_image_versions_operations.py new file mode 100644 index 000000000000..5ac1a5c637a0 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/aio/operations/_gallery_image_versions_operations.py @@ -0,0 +1,583 @@ +# 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 functools +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 +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._gallery_image_versions_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_gallery_image_request, build_update_request_initial +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class GalleryImageVersionsOperations: + """GalleryImageVersionsOperations 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.v2022_01_03.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, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + gallery_image_version: "_models.GalleryImageVersion", + **kwargs: Any + ) -> "_models.GalleryImageVersion": + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageVersion"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(gallery_image_version, 'GalleryImageVersion') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + 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('GalleryImageVersion', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('GalleryImageVersion', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('GalleryImageVersion', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + gallery_image_version: "_models.GalleryImageVersion", + **kwargs: Any + ) -> AsyncLROPoller["_models.GalleryImageVersion"]: + """Create or update a gallery image version. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery in which the Image Definition + resides. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition in which the Image Version + is to be created. + :type gallery_image_name: str + :param gallery_image_version_name: The name of the gallery image version to be created. Needs + to follow semantic version name pattern: The allowed characters are digit and period. Digits + must be within the range of a 32-bit integer. Format: + :code:``.:code:``.:code:``. + :type gallery_image_version_name: str + :param gallery_image_version: Parameters supplied to the create or update gallery image version + operation. + :type gallery_image_version: ~azure.mgmt.compute.v2022_01_03.models.GalleryImageVersion + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either GalleryImageVersion or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2022_01_03.models.GalleryImageVersion] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageVersion"] + 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, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, + gallery_image_version=gallery_image_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('GalleryImageVersion', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + gallery_image_version: "_models.GalleryImageVersionUpdate", + **kwargs: Any + ) -> "_models.GalleryImageVersion": + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageVersion"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(gallery_image_version, 'GalleryImageVersionUpdate') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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('GalleryImageVersion', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore + + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + gallery_image_version: "_models.GalleryImageVersionUpdate", + **kwargs: Any + ) -> AsyncLROPoller["_models.GalleryImageVersion"]: + """Update a gallery image version. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery in which the Image Definition + resides. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition in which the Image Version + is to be updated. + :type gallery_image_name: str + :param gallery_image_version_name: The name of the gallery image version to be updated. Needs + to follow semantic version name pattern: The allowed characters are digit and period. Digits + must be within the range of a 32-bit integer. Format: + :code:``.:code:``.:code:``. + :type gallery_image_version_name: str + :param gallery_image_version: Parameters supplied to the update gallery image version + operation. + :type gallery_image_version: ~azure.mgmt.compute.v2022_01_03.models.GalleryImageVersionUpdate + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either GalleryImageVersion or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2022_01_03.models.GalleryImageVersion] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageVersion"] + 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, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, + gallery_image_version=gallery_image_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('GalleryImageVersion', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + expand: Optional[Union[str, "_models.ReplicationStatusTypes"]] = None, + **kwargs: Any + ) -> "_models.GalleryImageVersion": + """Retrieves information about a gallery image version. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery in which the Image Definition + resides. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition in which the Image Version + resides. + :type gallery_image_name: str + :param gallery_image_version_name: The name of the gallery image version to be retrieved. + :type gallery_image_version_name: str + :param expand: The expand expression to apply on the operation. + :type expand: str or ~azure.mgmt.compute.v2022_01_03.models.ReplicationStatusTypes + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GalleryImageVersion, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2022_01_03.models.GalleryImageVersion + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageVersion"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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('GalleryImageVersion', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore + + + async def _delete_initial( + self, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore + + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete a gallery image version. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery in which the Image Definition + resides. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition in which the Image Version + resides. + :type gallery_image_name: str + :param gallery_image_version_name: The name of the gallery image version to be deleted. + :type gallery_image_version_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore + + @distributed_trace + def list_by_gallery_image( + self, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.GalleryImageVersionList"]: + """List gallery image versions in a gallery image definition. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery in which the Image Definition + resides. + :type gallery_name: str + :param gallery_image_name: The name of the Shared Image Gallery Image Definition from which the + Image Versions are to be listed. + :type gallery_image_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either GalleryImageVersionList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2022_01_03.models.GalleryImageVersionList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageVersionList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_gallery_image_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + template_url=self.list_by_gallery_image.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_gallery_image_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("GalleryImageVersionList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_gallery_image.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/aio/operations/_gallery_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/aio/operations/_gallery_images_operations.py new file mode 100644 index 000000000000..2dfc41afc314 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/aio/operations/_gallery_images_operations.py @@ -0,0 +1,540 @@ +# 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 functools +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 +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._gallery_images_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_gallery_request, build_update_request_initial +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class GalleryImagesOperations: + """GalleryImagesOperations 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.v2022_01_03.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, + gallery_name: str, + gallery_image_name: str, + gallery_image: "_models.GalleryImage", + **kwargs: Any + ) -> "_models.GalleryImage": + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImage"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(gallery_image, 'GalleryImage') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + 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('GalleryImage', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('GalleryImage', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('GalleryImage', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}'} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image: "_models.GalleryImage", + **kwargs: Any + ) -> AsyncLROPoller["_models.GalleryImage"]: + """Create or update a gallery image definition. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery in which the Image Definition is to + be created. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition to be created or updated. + The allowed characters are alphabets and numbers with dots, dashes, and periods allowed in the + middle. The maximum length is 80 characters. + :type gallery_image_name: str + :param gallery_image: Parameters supplied to the create or update gallery image operation. + :type gallery_image: ~azure.mgmt.compute.v2022_01_03.models.GalleryImage + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either GalleryImage or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2022_01_03.models.GalleryImage] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImage"] + 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, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + gallery_image=gallery_image, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('GalleryImage', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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/galleries/{galleryName}/images/{galleryImageName}'} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image: "_models.GalleryImageUpdate", + **kwargs: Any + ) -> "_models.GalleryImage": + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImage"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(gallery_image, 'GalleryImageUpdate') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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('GalleryImage', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}'} # type: ignore + + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image: "_models.GalleryImageUpdate", + **kwargs: Any + ) -> AsyncLROPoller["_models.GalleryImage"]: + """Update a gallery image definition. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery in which the Image Definition is to + be updated. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition to be updated. The allowed + characters are alphabets and numbers with dots, dashes, and periods allowed in the middle. The + maximum length is 80 characters. + :type gallery_image_name: str + :param gallery_image: Parameters supplied to the update gallery image operation. + :type gallery_image: ~azure.mgmt.compute.v2022_01_03.models.GalleryImageUpdate + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either GalleryImage or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2022_01_03.models.GalleryImage] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImage"] + 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, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + gallery_image=gallery_image, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('GalleryImage', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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/galleries/{galleryName}/images/{galleryImageName}'} # type: ignore + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + **kwargs: Any + ) -> "_models.GalleryImage": + """Retrieves information about a gallery image definition. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery from which the Image Definitions are + to be retrieved. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition to be retrieved. + :type gallery_image_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GalleryImage, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2022_01_03.models.GalleryImage + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImage"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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('GalleryImage', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}'} # type: ignore + + + async def _delete_initial( + self, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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/galleries/{galleryName}/images/{galleryImageName}'} # type: ignore + + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete a gallery image. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery in which the Image Definition is to + be deleted. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition to be deleted. + :type gallery_image_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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/galleries/{galleryName}/images/{galleryImageName}'} # type: ignore + + @distributed_trace + def list_by_gallery( + self, + resource_group_name: str, + gallery_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.GalleryImageList"]: + """List gallery image definitions in a gallery. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery from which Image Definitions are to + be listed. + :type gallery_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either GalleryImageList or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2022_01_03.models.GalleryImageList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_gallery_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + template_url=self.list_by_gallery.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_gallery_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("GalleryImageList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_gallery.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/aio/operations/_gallery_sharing_profile_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/aio/operations/_gallery_sharing_profile_operations.py new file mode 100644 index 000000000000..72d10077ce4f --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/aio/operations/_gallery_sharing_profile_operations.py @@ -0,0 +1,168 @@ +# 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 functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._gallery_sharing_profile_operations import build_update_request_initial +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class GallerySharingProfileOperations: + """GallerySharingProfileOperations 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.v2022_01_03.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 _update_initial( + self, + resource_group_name: str, + gallery_name: str, + sharing_update: "_models.SharingUpdate", + **kwargs: Any + ) -> "_models.SharingUpdate": + cls = kwargs.pop('cls', None) # type: ClsType["_models.SharingUpdate"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(sharing_update, 'SharingUpdate') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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 response.status_code == 200: + deserialized = self._deserialize('SharingUpdate', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('SharingUpdate', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/share'} # type: ignore + + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + gallery_name: str, + sharing_update: "_models.SharingUpdate", + **kwargs: Any + ) -> AsyncLROPoller["_models.SharingUpdate"]: + """Update sharing profile of a gallery. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. + :type gallery_name: str + :param sharing_update: Parameters supplied to the update gallery sharing profile. + :type sharing_update: ~azure.mgmt.compute.v2022_01_03.models.SharingUpdate + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either SharingUpdate or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2022_01_03.models.SharingUpdate] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SharingUpdate"] + 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, + gallery_name=gallery_name, + sharing_update=sharing_update, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('SharingUpdate', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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/galleries/{galleryName}/share'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/aio/operations/_shared_galleries_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/aio/operations/_shared_galleries_operations.py new file mode 100644 index 000000000000..caff1d536b56 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/aio/operations/_shared_galleries_operations.py @@ -0,0 +1,173 @@ +# 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 functools +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 +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._shared_galleries_operations import build_get_request, build_list_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class SharedGalleriesOperations: + """SharedGalleriesOperations 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.v2022_01_03.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 + + @distributed_trace + def list( + self, + location: str, + shared_to: Optional[Union[str, "_models.SharedToValues"]] = None, + **kwargs: Any + ) -> AsyncIterable["_models.SharedGalleryList"]: + """List shared galleries by subscription id or tenant id. + + :param location: Resource location. + :type location: str + :param shared_to: The query parameter to decide what shared galleries to fetch when doing + listing operations. + :type shared_to: str or ~azure.mgmt.compute.v2022_01_03.models.SharedToValues + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SharedGalleryList or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2022_01_03.models.SharedGalleryList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedGalleryList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + location=location, + shared_to=shared_to, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + location=location, + shared_to=shared_to, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("SharedGalleryList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries'} # type: ignore + + @distributed_trace_async + async def get( + self, + location: str, + gallery_unique_name: str, + **kwargs: Any + ) -> "_models.SharedGallery": + """Get a shared gallery by subscription id or tenant id. + + :param location: Resource location. + :type location: str + :param gallery_unique_name: The unique name of the Shared Gallery. + :type gallery_unique_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SharedGallery, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2022_01_03.models.SharedGallery + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedGallery"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + location=location, + gallery_unique_name=gallery_unique_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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('SharedGallery', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}'} # type: ignore + diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/aio/operations/_shared_gallery_image_versions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/aio/operations/_shared_gallery_image_versions_operations.py new file mode 100644 index 000000000000..d301fa888705 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/aio/operations/_shared_gallery_image_versions_operations.py @@ -0,0 +1,197 @@ +# 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 functools +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 +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._shared_gallery_image_versions_operations import build_get_request, build_list_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class SharedGalleryImageVersionsOperations: + """SharedGalleryImageVersionsOperations 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.v2022_01_03.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 + + @distributed_trace + def list( + self, + location: str, + gallery_unique_name: str, + gallery_image_name: str, + shared_to: Optional[Union[str, "_models.SharedToValues"]] = None, + **kwargs: Any + ) -> AsyncIterable["_models.SharedGalleryImageVersionList"]: + """List shared gallery image versions by subscription id or tenant id. + + :param location: Resource location. + :type location: str + :param gallery_unique_name: The unique name of the Shared Gallery. + :type gallery_unique_name: str + :param gallery_image_name: The name of the Shared Gallery Image Definition from which the Image + Versions are to be listed. + :type gallery_image_name: str + :param shared_to: The query parameter to decide what shared galleries to fetch when doing + listing operations. + :type shared_to: str or ~azure.mgmt.compute.v2022_01_03.models.SharedToValues + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SharedGalleryImageVersionList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2022_01_03.models.SharedGalleryImageVersionList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedGalleryImageVersionList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + location=location, + gallery_unique_name=gallery_unique_name, + gallery_image_name=gallery_image_name, + shared_to=shared_to, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + location=location, + gallery_unique_name=gallery_unique_name, + gallery_image_name=gallery_image_name, + shared_to=shared_to, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("SharedGalleryImageVersionList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}/images/{galleryImageName}/versions'} # type: ignore + + @distributed_trace_async + async def get( + self, + location: str, + gallery_unique_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + **kwargs: Any + ) -> "_models.SharedGalleryImageVersion": + """Get a shared gallery image version by subscription id or tenant id. + + :param location: Resource location. + :type location: str + :param gallery_unique_name: The unique name of the Shared Gallery. + :type gallery_unique_name: str + :param gallery_image_name: The name of the Shared Gallery Image Definition from which the Image + Versions are to be listed. + :type gallery_image_name: str + :param gallery_image_version_name: The name of the gallery image version to be created. Needs + to follow semantic version name pattern: The allowed characters are digit and period. Digits + must be within the range of a 32-bit integer. Format: + :code:``.:code:``.:code:``. + :type gallery_image_version_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SharedGalleryImageVersion, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2022_01_03.models.SharedGalleryImageVersion + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedGalleryImageVersion"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + location=location, + gallery_unique_name=gallery_unique_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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('SharedGalleryImageVersion', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore + diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/aio/operations/_shared_gallery_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/aio/operations/_shared_gallery_images_operations.py new file mode 100644 index 000000000000..005a7d601e3a --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/aio/operations/_shared_gallery_images_operations.py @@ -0,0 +1,184 @@ +# 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 functools +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 +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._shared_gallery_images_operations import build_get_request, build_list_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class SharedGalleryImagesOperations: + """SharedGalleryImagesOperations 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.v2022_01_03.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 + + @distributed_trace + def list( + self, + location: str, + gallery_unique_name: str, + shared_to: Optional[Union[str, "_models.SharedToValues"]] = None, + **kwargs: Any + ) -> AsyncIterable["_models.SharedGalleryImageList"]: + """List shared gallery images by subscription id or tenant id. + + :param location: Resource location. + :type location: str + :param gallery_unique_name: The unique name of the Shared Gallery. + :type gallery_unique_name: str + :param shared_to: The query parameter to decide what shared galleries to fetch when doing + listing operations. + :type shared_to: str or ~azure.mgmt.compute.v2022_01_03.models.SharedToValues + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SharedGalleryImageList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2022_01_03.models.SharedGalleryImageList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedGalleryImageList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + location=location, + gallery_unique_name=gallery_unique_name, + shared_to=shared_to, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + location=location, + gallery_unique_name=gallery_unique_name, + shared_to=shared_to, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("SharedGalleryImageList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}/images'} # type: ignore + + @distributed_trace_async + async def get( + self, + location: str, + gallery_unique_name: str, + gallery_image_name: str, + **kwargs: Any + ) -> "_models.SharedGalleryImage": + """Get a shared gallery image by subscription id or tenant id. + + :param location: Resource location. + :type location: str + :param gallery_unique_name: The unique name of the Shared Gallery. + :type gallery_unique_name: str + :param gallery_image_name: The name of the Shared Gallery Image Definition from which the Image + Versions are to be listed. + :type gallery_image_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SharedGalleryImage, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2022_01_03.models.SharedGalleryImage + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedGalleryImage"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + location=location, + gallery_unique_name=gallery_unique_name, + gallery_image_name=gallery_image_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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('SharedGalleryImage', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}/images/{galleryImageName}'} # type: ignore + diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/models/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/models/__init__.py new file mode 100644 index 000000000000..2eaaab8d3f7b --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/models/__init__.py @@ -0,0 +1,211 @@ +# 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 ._models_py3 import ApiError +from ._models_py3 import ApiErrorBase +from ._models_py3 import CommunityGallery +from ._models_py3 import CommunityGalleryImage +from ._models_py3 import CommunityGalleryImageList +from ._models_py3 import CommunityGalleryImageVersion +from ._models_py3 import CommunityGalleryImageVersionList +from ._models_py3 import CommunityGalleryInfo +from ._models_py3 import DataDiskImageEncryption +from ._models_py3 import Disallowed +from ._models_py3 import DiskImageEncryption +from ._models_py3 import EncryptionImages +from ._models_py3 import Gallery +from ._models_py3 import GalleryApplication +from ._models_py3 import GalleryApplicationList +from ._models_py3 import GalleryApplicationUpdate +from ._models_py3 import GalleryApplicationVersion +from ._models_py3 import GalleryApplicationVersionList +from ._models_py3 import GalleryApplicationVersionPublishingProfile +from ._models_py3 import GalleryApplicationVersionUpdate +from ._models_py3 import GalleryArtifactPublishingProfileBase +from ._models_py3 import GalleryArtifactSource +from ._models_py3 import GalleryArtifactVersionSource +from ._models_py3 import GalleryDataDiskImage +from ._models_py3 import GalleryDiskImage +from ._models_py3 import GalleryExtendedLocation +from ._models_py3 import GalleryIdentifier +from ._models_py3 import GalleryImage +from ._models_py3 import GalleryImageFeature +from ._models_py3 import GalleryImageIdentifier +from ._models_py3 import GalleryImageList +from ._models_py3 import GalleryImageUpdate +from ._models_py3 import GalleryImageVersion +from ._models_py3 import GalleryImageVersionList +from ._models_py3 import GalleryImageVersionPublishingProfile +from ._models_py3 import GalleryImageVersionStorageProfile +from ._models_py3 import GalleryImageVersionUpdate +from ._models_py3 import GalleryList +from ._models_py3 import GalleryOSDiskImage +from ._models_py3 import GalleryTargetExtendedLocation +from ._models_py3 import GalleryUpdate +from ._models_py3 import ImagePurchasePlan +from ._models_py3 import InnerError +from ._models_py3 import ManagedArtifact +from ._models_py3 import OSDiskImageEncryption +from ._models_py3 import OSDiskImageSecurityProfile +from ._models_py3 import PirCommunityGalleryResource +from ._models_py3 import PirResource +from ._models_py3 import PirSharedGalleryResource +from ._models_py3 import RecommendedMachineConfiguration +from ._models_py3 import RegionalReplicationStatus +from ._models_py3 import RegionalSharingStatus +from ._models_py3 import ReplicationStatus +from ._models_py3 import Resource +from ._models_py3 import ResourceRange +from ._models_py3 import SharedGallery +from ._models_py3 import SharedGalleryDataDiskImage +from ._models_py3 import SharedGalleryDiskImage +from ._models_py3 import SharedGalleryImage +from ._models_py3 import SharedGalleryImageList +from ._models_py3 import SharedGalleryImageVersion +from ._models_py3 import SharedGalleryImageVersionList +from ._models_py3 import SharedGalleryImageVersionStorageProfile +from ._models_py3 import SharedGalleryList +from ._models_py3 import SharedGalleryOSDiskImage +from ._models_py3 import SharingProfile +from ._models_py3 import SharingProfileGroup +from ._models_py3 import SharingStatus +from ._models_py3 import SharingUpdate +from ._models_py3 import SoftDeletePolicy +from ._models_py3 import TargetRegion +from ._models_py3 import UpdateResourceDefinition +from ._models_py3 import UserArtifactManage +from ._models_py3 import UserArtifactSource + + +from ._compute_management_client_enums import ( + AggregatedReplicationState, + Architecture, + ConfidentialVMEncryptionType, + GalleryApplicationVersionPropertiesProvisioningState, + GalleryExpandParams, + GalleryExtendedLocationType, + GalleryImagePropertiesProvisioningState, + GalleryImageVersionPropertiesProvisioningState, + GalleryPropertiesProvisioningState, + GallerySharingPermissionTypes, + HostCaching, + HyperVGeneration, + OperatingSystemStateTypes, + OperatingSystemTypes, + ReplicationMode, + ReplicationState, + ReplicationStatusTypes, + SelectPermissions, + SharedGalleryHostCaching, + SharedToValues, + SharingProfileGroupTypes, + SharingState, + SharingUpdateOperationTypes, + StorageAccountType, +) + +__all__ = [ + 'ApiError', + 'ApiErrorBase', + 'CommunityGallery', + 'CommunityGalleryImage', + 'CommunityGalleryImageList', + 'CommunityGalleryImageVersion', + 'CommunityGalleryImageVersionList', + 'CommunityGalleryInfo', + 'DataDiskImageEncryption', + 'Disallowed', + 'DiskImageEncryption', + 'EncryptionImages', + 'Gallery', + 'GalleryApplication', + 'GalleryApplicationList', + 'GalleryApplicationUpdate', + 'GalleryApplicationVersion', + 'GalleryApplicationVersionList', + 'GalleryApplicationVersionPublishingProfile', + 'GalleryApplicationVersionUpdate', + 'GalleryArtifactPublishingProfileBase', + 'GalleryArtifactSource', + 'GalleryArtifactVersionSource', + 'GalleryDataDiskImage', + 'GalleryDiskImage', + 'GalleryExtendedLocation', + 'GalleryIdentifier', + 'GalleryImage', + 'GalleryImageFeature', + 'GalleryImageIdentifier', + 'GalleryImageList', + 'GalleryImageUpdate', + 'GalleryImageVersion', + 'GalleryImageVersionList', + 'GalleryImageVersionPublishingProfile', + 'GalleryImageVersionStorageProfile', + 'GalleryImageVersionUpdate', + 'GalleryList', + 'GalleryOSDiskImage', + 'GalleryTargetExtendedLocation', + 'GalleryUpdate', + 'ImagePurchasePlan', + 'InnerError', + 'ManagedArtifact', + 'OSDiskImageEncryption', + 'OSDiskImageSecurityProfile', + 'PirCommunityGalleryResource', + 'PirResource', + 'PirSharedGalleryResource', + 'RecommendedMachineConfiguration', + 'RegionalReplicationStatus', + 'RegionalSharingStatus', + 'ReplicationStatus', + 'Resource', + 'ResourceRange', + 'SharedGallery', + 'SharedGalleryDataDiskImage', + 'SharedGalleryDiskImage', + 'SharedGalleryImage', + 'SharedGalleryImageList', + 'SharedGalleryImageVersion', + 'SharedGalleryImageVersionList', + 'SharedGalleryImageVersionStorageProfile', + 'SharedGalleryList', + 'SharedGalleryOSDiskImage', + 'SharingProfile', + 'SharingProfileGroup', + 'SharingStatus', + 'SharingUpdate', + 'SoftDeletePolicy', + 'TargetRegion', + 'UpdateResourceDefinition', + 'UserArtifactManage', + 'UserArtifactSource', + 'AggregatedReplicationState', + 'Architecture', + 'ConfidentialVMEncryptionType', + 'GalleryApplicationVersionPropertiesProvisioningState', + 'GalleryExpandParams', + 'GalleryExtendedLocationType', + 'GalleryImagePropertiesProvisioningState', + 'GalleryImageVersionPropertiesProvisioningState', + 'GalleryPropertiesProvisioningState', + 'GallerySharingPermissionTypes', + 'HostCaching', + 'HyperVGeneration', + 'OperatingSystemStateTypes', + 'OperatingSystemTypes', + 'ReplicationMode', + 'ReplicationState', + 'ReplicationStatusTypes', + 'SelectPermissions', + 'SharedGalleryHostCaching', + 'SharedToValues', + 'SharingProfileGroupTypes', + 'SharingState', + 'SharingUpdateOperationTypes', + 'StorageAccountType', +] diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/models/_compute_management_client_enums.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/models/_compute_management_client_enums.py new file mode 100644 index 000000000000..18e5f3f70785 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/models/_compute_management_client_enums.py @@ -0,0 +1,208 @@ +# 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 +from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta + + +class AggregatedReplicationState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """This is the aggregated replication status based on all the regional replication status flags. + """ + + UNKNOWN = "Unknown" + IN_PROGRESS = "InProgress" + COMPLETED = "Completed" + FAILED = "Failed" + +class Architecture(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The architecture of the image. Applicable to OS disks only. + """ + + X64 = "x64" + ARM64 = "Arm64" + +class ConfidentialVMEncryptionType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """confidential VM encryption types + """ + + ENCRYPTED_VM_GUEST_STATE_ONLY_WITH_PMK = "EncryptedVMGuestStateOnlyWithPmk" + ENCRYPTED_WITH_PMK = "EncryptedWithPmk" + ENCRYPTED_WITH_CMK = "EncryptedWithCmk" + +class GalleryApplicationVersionPropertiesProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The provisioning state, which only appears in the response. + """ + + CREATING = "Creating" + UPDATING = "Updating" + FAILED = "Failed" + SUCCEEDED = "Succeeded" + DELETING = "Deleting" + MIGRATING = "Migrating" + +class GalleryExpandParams(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + + SHARING_PROFILE_GROUPS = "SharingProfile/Groups" + +class GalleryExtendedLocationType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """It is type of the extended location. + """ + + EDGE_ZONE = "EdgeZone" + UNKNOWN = "Unknown" + +class GalleryImagePropertiesProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The provisioning state, which only appears in the response. + """ + + CREATING = "Creating" + UPDATING = "Updating" + FAILED = "Failed" + SUCCEEDED = "Succeeded" + DELETING = "Deleting" + MIGRATING = "Migrating" + +class GalleryImageVersionPropertiesProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The provisioning state, which only appears in the response. + """ + + CREATING = "Creating" + UPDATING = "Updating" + FAILED = "Failed" + SUCCEEDED = "Succeeded" + DELETING = "Deleting" + MIGRATING = "Migrating" + +class GalleryPropertiesProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The provisioning state, which only appears in the response. + """ + + CREATING = "Creating" + UPDATING = "Updating" + FAILED = "Failed" + SUCCEEDED = "Succeeded" + DELETING = "Deleting" + MIGRATING = "Migrating" + +class GallerySharingPermissionTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """This property allows you to specify the permission of sharing gallery. :code:`
`:code:`
` + Possible values are: :code:`
`:code:`
` **Private** :code:`
`:code:`
` **Groups** + :code:`
`:code:`
` **Community** + """ + + PRIVATE = "Private" + GROUPS = "Groups" + COMMUNITY = "Community" + +class HostCaching(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The host caching of the disk. Valid values are 'None', 'ReadOnly', and 'ReadWrite' + """ + + NONE = "None" + READ_ONLY = "ReadOnly" + READ_WRITE = "ReadWrite" + +class HyperVGeneration(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The hypervisor generation of the Virtual Machine. Applicable to OS disks only. + """ + + V1 = "V1" + V2 = "V2" + +class OperatingSystemStateTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """This property allows the user to specify whether the virtual machines created under this image + are 'Generalized' or 'Specialized'. + """ + + GENERALIZED = "Generalized" + SPECIALIZED = "Specialized" + +class OperatingSystemTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """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" + LINUX = "Linux" + +class ReplicationMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Optional parameter which specifies the mode to be used for replication. This property is not + updatable. + """ + + FULL = "Full" + SHALLOW = "Shallow" + +class ReplicationState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """This is the regional replication state. + """ + + UNKNOWN = "Unknown" + REPLICATING = "Replicating" + COMPLETED = "Completed" + FAILED = "Failed" + +class ReplicationStatusTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + + REPLICATION_STATUS = "ReplicationStatus" + +class SelectPermissions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + + PERMISSIONS = "Permissions" + +class SharedGalleryHostCaching(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The host caching of the disk. Valid values are 'None', 'ReadOnly', and 'ReadWrite' + """ + + NONE = "None" + READ_ONLY = "ReadOnly" + READ_WRITE = "ReadWrite" + +class SharedToValues(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + + TENANT = "tenant" + +class SharingProfileGroupTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """This property allows you to specify the type of sharing group. :code:`
`:code:`
` + Possible values are: :code:`
`:code:`
` **Subscriptions** :code:`
`:code:`
` + **AADTenants** + """ + + SUBSCRIPTIONS = "Subscriptions" + AAD_TENANTS = "AADTenants" + +class SharingState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The sharing state of the gallery, which only appears in the response. + """ + + SUCCEEDED = "Succeeded" + IN_PROGRESS = "InProgress" + FAILED = "Failed" + UNKNOWN = "Unknown" + +class SharingUpdateOperationTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """This property allows you to specify the operation type of gallery sharing update. + :code:`
`:code:`
` Possible values are: :code:`
`:code:`
` **Add** + :code:`
`:code:`
` **Remove** :code:`
`:code:`
` **Reset** + """ + + ADD = "Add" + REMOVE = "Remove" + RESET = "Reset" + ENABLE_COMMUNITY = "EnableCommunity" + +class StorageAccountType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Specifies the storage account type to be used to store the image. This property is not + updatable. + """ + + STANDARD_LRS = "Standard_LRS" + STANDARD_ZRS = "Standard_ZRS" + PREMIUM_LRS = "Premium_LRS" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/models/_models_py3.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/models/_models_py3.py new file mode 100644 index 000000000000..3be273f83959 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/models/_models_py3.py @@ -0,0 +1,4020 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +import datetime +from typing import Any, Dict, List, Optional, Union + +import msrest.serialization + +from ._compute_management_client_enums import * + + +class ApiError(msrest.serialization.Model): + """Api error. + + :ivar details: The Api error details. + :vartype details: list[~azure.mgmt.compute.v2022_01_03.models.ApiErrorBase] + :ivar innererror: The Api inner error. + :vartype innererror: ~azure.mgmt.compute.v2022_01_03.models.InnerError + :ivar code: The error code. + :vartype code: str + :ivar target: The target of the particular error. + :vartype target: str + :ivar message: The error message. + :vartype message: str + """ + + _attribute_map = { + 'details': {'key': 'details', 'type': '[ApiErrorBase]'}, + 'innererror': {'key': 'innererror', 'type': 'InnerError'}, + 'code': {'key': 'code', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__( + self, + *, + details: Optional[List["ApiErrorBase"]] = None, + innererror: Optional["InnerError"] = None, + code: Optional[str] = None, + target: Optional[str] = None, + message: Optional[str] = None, + **kwargs + ): + """ + :keyword details: The Api error details. + :paramtype details: list[~azure.mgmt.compute.v2022_01_03.models.ApiErrorBase] + :keyword innererror: The Api inner error. + :paramtype innererror: ~azure.mgmt.compute.v2022_01_03.models.InnerError + :keyword code: The error code. + :paramtype code: str + :keyword target: The target of the particular error. + :paramtype target: str + :keyword message: The error message. + :paramtype message: str + """ + super(ApiError, self).__init__(**kwargs) + self.details = details + self.innererror = innererror + self.code = code + self.target = target + self.message = message + + +class ApiErrorBase(msrest.serialization.Model): + """Api error base. + + :ivar code: The error code. + :vartype code: str + :ivar target: The target of the particular error. + :vartype target: str + :ivar message: The error message. + :vartype message: str + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__( + self, + *, + code: Optional[str] = None, + target: Optional[str] = None, + message: Optional[str] = None, + **kwargs + ): + """ + :keyword code: The error code. + :paramtype code: str + :keyword target: The target of the particular error. + :paramtype target: str + :keyword message: The error message. + :paramtype message: str + """ + super(ApiErrorBase, self).__init__(**kwargs) + self.code = code + self.target = target + self.message = message + + +class PirCommunityGalleryResource(msrest.serialization.Model): + """Base information about the community gallery resource in pir. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Resource name. + :vartype name: str + :ivar location: Resource location. + :vartype location: str + :ivar type: Resource type. + :vartype type: str + :ivar unique_id: The unique id of this community gallery. + :vartype unique_id: str + """ + + _validation = { + 'name': {'readonly': True}, + 'location': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'unique_id': {'key': 'identifier.uniqueId', 'type': 'str'}, + } + + def __init__( + self, + *, + unique_id: Optional[str] = None, + **kwargs + ): + """ + :keyword unique_id: The unique id of this community gallery. + :paramtype unique_id: str + """ + super(PirCommunityGalleryResource, self).__init__(**kwargs) + self.name = None + self.location = None + self.type = None + self.unique_id = unique_id + + +class CommunityGallery(PirCommunityGalleryResource): + """Specifies information about the Community Gallery that you want to create or update. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Resource name. + :vartype name: str + :ivar location: Resource location. + :vartype location: str + :ivar type: Resource type. + :vartype type: str + :ivar unique_id: The unique id of this community gallery. + :vartype unique_id: str + """ + + _validation = { + 'name': {'readonly': True}, + 'location': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'unique_id': {'key': 'identifier.uniqueId', 'type': 'str'}, + } + + def __init__( + self, + *, + unique_id: Optional[str] = None, + **kwargs + ): + """ + :keyword unique_id: The unique id of this community gallery. + :paramtype unique_id: str + """ + super(CommunityGallery, self).__init__(unique_id=unique_id, **kwargs) + + +class CommunityGalleryImage(PirCommunityGalleryResource): + """Specifies information about the gallery image definition that you want to create or update. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Resource name. + :vartype name: str + :ivar location: Resource location. + :vartype location: str + :ivar type: Resource type. + :vartype type: str + :ivar unique_id: The unique id of this community gallery. + :vartype unique_id: str + :ivar os_type: This property allows you to specify the type of the OS that is included in the + disk when creating a VM from a managed image. :code:`
`:code:`
` Possible values are: + :code:`
`:code:`
` **Windows** :code:`
`:code:`
` **Linux**. Possible values + include: "Windows", "Linux". + :vartype os_type: str or ~azure.mgmt.compute.v2022_01_03.models.OperatingSystemTypes + :ivar os_state: This property allows the user to specify whether the virtual machines created + under this image are 'Generalized' or 'Specialized'. Possible values include: "Generalized", + "Specialized". + :vartype os_state: str or ~azure.mgmt.compute.v2022_01_03.models.OperatingSystemStateTypes + :ivar end_of_life_date: The end of life date of the gallery image definition. This property can + be used for decommissioning purposes. This property is updatable. + :vartype end_of_life_date: ~datetime.datetime + :ivar identifier: This is the gallery image definition identifier. + :vartype identifier: ~azure.mgmt.compute.v2022_01_03.models.GalleryImageIdentifier + :ivar recommended: The properties describe the recommended machine configuration for this Image + Definition. These properties are updatable. + :vartype recommended: ~azure.mgmt.compute.v2022_01_03.models.RecommendedMachineConfiguration + :ivar disallowed: Describes the disallowed disk types. + :vartype disallowed: ~azure.mgmt.compute.v2022_01_03.models.Disallowed + :ivar hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS + disks only. Possible values include: "V1", "V2". + :vartype hyper_v_generation: str or ~azure.mgmt.compute.v2022_01_03.models.HyperVGeneration + :ivar features: A list of gallery image features. + :vartype features: list[~azure.mgmt.compute.v2022_01_03.models.GalleryImageFeature] + :ivar purchase_plan: Describes the gallery image definition purchase plan. This is used by + marketplace images. + :vartype purchase_plan: ~azure.mgmt.compute.v2022_01_03.models.ImagePurchasePlan + :ivar architecture: The architecture of the image. Applicable to OS disks only. Possible values + include: "x64", "Arm64". + :vartype architecture: str or ~azure.mgmt.compute.v2022_01_03.models.Architecture + """ + + _validation = { + 'name': {'readonly': True}, + 'location': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'unique_id': {'key': 'identifier.uniqueId', 'type': 'str'}, + 'os_type': {'key': 'properties.osType', 'type': 'str'}, + 'os_state': {'key': 'properties.osState', 'type': 'str'}, + 'end_of_life_date': {'key': 'properties.endOfLifeDate', 'type': 'iso-8601'}, + 'identifier': {'key': 'properties.identifier', 'type': 'GalleryImageIdentifier'}, + 'recommended': {'key': 'properties.recommended', 'type': 'RecommendedMachineConfiguration'}, + 'disallowed': {'key': 'properties.disallowed', 'type': 'Disallowed'}, + 'hyper_v_generation': {'key': 'properties.hyperVGeneration', 'type': 'str'}, + 'features': {'key': 'properties.features', 'type': '[GalleryImageFeature]'}, + 'purchase_plan': {'key': 'properties.purchasePlan', 'type': 'ImagePurchasePlan'}, + 'architecture': {'key': 'properties.architecture', 'type': 'str'}, + } + + def __init__( + self, + *, + unique_id: Optional[str] = None, + os_type: Optional[Union[str, "OperatingSystemTypes"]] = None, + os_state: Optional[Union[str, "OperatingSystemStateTypes"]] = None, + end_of_life_date: Optional[datetime.datetime] = None, + identifier: Optional["GalleryImageIdentifier"] = None, + recommended: Optional["RecommendedMachineConfiguration"] = None, + disallowed: Optional["Disallowed"] = None, + hyper_v_generation: Optional[Union[str, "HyperVGeneration"]] = None, + features: Optional[List["GalleryImageFeature"]] = None, + purchase_plan: Optional["ImagePurchasePlan"] = None, + architecture: Optional[Union[str, "Architecture"]] = None, + **kwargs + ): + """ + :keyword unique_id: The unique id of this community gallery. + :paramtype unique_id: str + :keyword os_type: This property allows you to specify the type of the OS that is included in + the disk when creating a VM from a managed image. :code:`
`:code:`
` Possible values are: + :code:`
`:code:`
` **Windows** :code:`
`:code:`
` **Linux**. Possible values + include: "Windows", "Linux". + :paramtype os_type: str or ~azure.mgmt.compute.v2022_01_03.models.OperatingSystemTypes + :keyword os_state: This property allows the user to specify whether the virtual machines + created under this image are 'Generalized' or 'Specialized'. Possible values include: + "Generalized", "Specialized". + :paramtype os_state: str or ~azure.mgmt.compute.v2022_01_03.models.OperatingSystemStateTypes + :keyword end_of_life_date: The end of life date of the gallery image definition. This property + can be used for decommissioning purposes. This property is updatable. + :paramtype end_of_life_date: ~datetime.datetime + :keyword identifier: This is the gallery image definition identifier. + :paramtype identifier: ~azure.mgmt.compute.v2022_01_03.models.GalleryImageIdentifier + :keyword recommended: The properties describe the recommended machine configuration for this + Image Definition. These properties are updatable. + :paramtype recommended: ~azure.mgmt.compute.v2022_01_03.models.RecommendedMachineConfiguration + :keyword disallowed: Describes the disallowed disk types. + :paramtype disallowed: ~azure.mgmt.compute.v2022_01_03.models.Disallowed + :keyword hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS + disks only. Possible values include: "V1", "V2". + :paramtype hyper_v_generation: str or ~azure.mgmt.compute.v2022_01_03.models.HyperVGeneration + :keyword features: A list of gallery image features. + :paramtype features: list[~azure.mgmt.compute.v2022_01_03.models.GalleryImageFeature] + :keyword purchase_plan: Describes the gallery image definition purchase plan. This is used by + marketplace images. + :paramtype purchase_plan: ~azure.mgmt.compute.v2022_01_03.models.ImagePurchasePlan + :keyword architecture: The architecture of the image. Applicable to OS disks only. Possible + values include: "x64", "Arm64". + :paramtype architecture: str or ~azure.mgmt.compute.v2022_01_03.models.Architecture + """ + super(CommunityGalleryImage, self).__init__(unique_id=unique_id, **kwargs) + self.os_type = os_type + self.os_state = os_state + self.end_of_life_date = end_of_life_date + self.identifier = identifier + self.recommended = recommended + self.disallowed = disallowed + self.hyper_v_generation = hyper_v_generation + self.features = features + self.purchase_plan = purchase_plan + self.architecture = architecture + + +class CommunityGalleryImageList(msrest.serialization.Model): + """The List Community Gallery Images operation response. + + All required parameters must be populated in order to send to Azure. + + :ivar value: Required. A list of community gallery images. + :vartype value: list[~azure.mgmt.compute.v2022_01_03.models.CommunityGalleryImage] + :ivar next_link: The uri to fetch the next page of community gallery images. Call ListNext() + with this to fetch the next page of community gallery images. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[CommunityGalleryImage]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["CommunityGalleryImage"], + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: Required. A list of community gallery images. + :paramtype value: list[~azure.mgmt.compute.v2022_01_03.models.CommunityGalleryImage] + :keyword next_link: The uri to fetch the next page of community gallery images. Call ListNext() + with this to fetch the next page of community gallery images. + :paramtype next_link: str + """ + super(CommunityGalleryImageList, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class CommunityGalleryImageVersion(PirCommunityGalleryResource): + """Specifies information about the gallery image version that you want to create or update. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Resource name. + :vartype name: str + :ivar location: Resource location. + :vartype location: str + :ivar type: Resource type. + :vartype type: str + :ivar unique_id: The unique id of this community gallery. + :vartype unique_id: str + :ivar published_date: The published date of the gallery image version Definition. This property + can be used for decommissioning purposes. This property is updatable. + :vartype published_date: ~datetime.datetime + :ivar end_of_life_date: The end of life date of the gallery image version Definition. This + property can be used for decommissioning purposes. This property is updatable. + :vartype end_of_life_date: ~datetime.datetime + :ivar exclude_from_latest: If set to true, Virtual Machines deployed from the latest version of + the Image Definition won't use this Image Version. + :vartype exclude_from_latest: bool + :ivar storage_profile: Describes the storage profile of the image version. + :vartype storage_profile: + ~azure.mgmt.compute.v2022_01_03.models.SharedGalleryImageVersionStorageProfile + """ + + _validation = { + 'name': {'readonly': True}, + 'location': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'unique_id': {'key': 'identifier.uniqueId', 'type': 'str'}, + 'published_date': {'key': 'properties.publishedDate', 'type': 'iso-8601'}, + 'end_of_life_date': {'key': 'properties.endOfLifeDate', 'type': 'iso-8601'}, + 'exclude_from_latest': {'key': 'properties.excludeFromLatest', 'type': 'bool'}, + 'storage_profile': {'key': 'properties.storageProfile', 'type': 'SharedGalleryImageVersionStorageProfile'}, + } + + def __init__( + self, + *, + unique_id: Optional[str] = None, + published_date: Optional[datetime.datetime] = None, + end_of_life_date: Optional[datetime.datetime] = None, + exclude_from_latest: Optional[bool] = None, + storage_profile: Optional["SharedGalleryImageVersionStorageProfile"] = None, + **kwargs + ): + """ + :keyword unique_id: The unique id of this community gallery. + :paramtype unique_id: str + :keyword published_date: The published date of the gallery image version Definition. This + property can be used for decommissioning purposes. This property is updatable. + :paramtype published_date: ~datetime.datetime + :keyword end_of_life_date: The end of life date of the gallery image version Definition. This + property can be used for decommissioning purposes. This property is updatable. + :paramtype end_of_life_date: ~datetime.datetime + :keyword exclude_from_latest: If set to true, Virtual Machines deployed from the latest version + of the Image Definition won't use this Image Version. + :paramtype exclude_from_latest: bool + :keyword storage_profile: Describes the storage profile of the image version. + :paramtype storage_profile: + ~azure.mgmt.compute.v2022_01_03.models.SharedGalleryImageVersionStorageProfile + """ + super(CommunityGalleryImageVersion, self).__init__(unique_id=unique_id, **kwargs) + self.published_date = published_date + self.end_of_life_date = end_of_life_date + self.exclude_from_latest = exclude_from_latest + self.storage_profile = storage_profile + + +class CommunityGalleryImageVersionList(msrest.serialization.Model): + """The List Community Gallery Image versions operation response. + + All required parameters must be populated in order to send to Azure. + + :ivar value: Required. A list of community gallery image versions. + :vartype value: list[~azure.mgmt.compute.v2022_01_03.models.CommunityGalleryImageVersion] + :ivar next_link: The uri to fetch the next page of community gallery image versions. Call + ListNext() with this to fetch the next page of community gallery image versions. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[CommunityGalleryImageVersion]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["CommunityGalleryImageVersion"], + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: Required. A list of community gallery image versions. + :paramtype value: list[~azure.mgmt.compute.v2022_01_03.models.CommunityGalleryImageVersion] + :keyword next_link: The uri to fetch the next page of community gallery image versions. Call + ListNext() with this to fetch the next page of community gallery image versions. + :paramtype next_link: str + """ + super(CommunityGalleryImageVersionList, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class CommunityGalleryInfo(msrest.serialization.Model): + """Information of community gallery if current gallery is shared to community. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar publisher_uri: Community gallery publisher uri. + :vartype publisher_uri: str + :ivar publisher_contact: Community gallery publisher contact email. + :vartype publisher_contact: str + :ivar eula: Community gallery publisher eula. + :vartype eula: str + :ivar public_name_prefix: Community gallery public name prefix. + :vartype public_name_prefix: str + :ivar community_gallery_enabled: Contains info about whether community gallery sharing is + enabled. + :vartype community_gallery_enabled: bool + :ivar public_names: Community gallery public name list. + :vartype public_names: list[str] + """ + + _validation = { + 'community_gallery_enabled': {'readonly': True}, + 'public_names': {'readonly': True}, + } + + _attribute_map = { + 'publisher_uri': {'key': 'publisherUri', 'type': 'str'}, + 'publisher_contact': {'key': 'publisherContact', 'type': 'str'}, + 'eula': {'key': 'eula', 'type': 'str'}, + 'public_name_prefix': {'key': 'publicNamePrefix', 'type': 'str'}, + 'community_gallery_enabled': {'key': 'communityGalleryEnabled', 'type': 'bool'}, + 'public_names': {'key': 'publicNames', 'type': '[str]'}, + } + + def __init__( + self, + *, + publisher_uri: Optional[str] = None, + publisher_contact: Optional[str] = None, + eula: Optional[str] = None, + public_name_prefix: Optional[str] = None, + **kwargs + ): + """ + :keyword publisher_uri: Community gallery publisher uri. + :paramtype publisher_uri: str + :keyword publisher_contact: Community gallery publisher contact email. + :paramtype publisher_contact: str + :keyword eula: Community gallery publisher eula. + :paramtype eula: str + :keyword public_name_prefix: Community gallery public name prefix. + :paramtype public_name_prefix: str + """ + super(CommunityGalleryInfo, self).__init__(**kwargs) + self.publisher_uri = publisher_uri + self.publisher_contact = publisher_contact + self.eula = eula + self.public_name_prefix = public_name_prefix + self.community_gallery_enabled = None + self.public_names = None + + +class DiskImageEncryption(msrest.serialization.Model): + """This is the disk image encryption base class. + + :ivar disk_encryption_set_id: A relative URI containing the resource ID of the disk encryption + set. + :vartype disk_encryption_set_id: str + """ + + _attribute_map = { + 'disk_encryption_set_id': {'key': 'diskEncryptionSetId', 'type': 'str'}, + } + + def __init__( + self, + *, + disk_encryption_set_id: Optional[str] = None, + **kwargs + ): + """ + :keyword disk_encryption_set_id: A relative URI containing the resource ID of the disk + encryption set. + :paramtype disk_encryption_set_id: str + """ + super(DiskImageEncryption, self).__init__(**kwargs) + self.disk_encryption_set_id = disk_encryption_set_id + + +class DataDiskImageEncryption(DiskImageEncryption): + """Contains encryption settings for a data disk image. + + All required parameters must be populated in order to send to Azure. + + :ivar disk_encryption_set_id: A relative URI containing the resource ID of the disk encryption + set. + :vartype disk_encryption_set_id: str + :ivar lun: Required. This property specifies the logical unit number of the data disk. This + value is used to identify data disks within the Virtual Machine and therefore must be unique + for each data disk attached to the Virtual Machine. + :vartype lun: int + """ + + _validation = { + 'lun': {'required': True}, + } + + _attribute_map = { + 'disk_encryption_set_id': {'key': 'diskEncryptionSetId', 'type': 'str'}, + 'lun': {'key': 'lun', 'type': 'int'}, + } + + def __init__( + self, + *, + lun: int, + disk_encryption_set_id: Optional[str] = None, + **kwargs + ): + """ + :keyword disk_encryption_set_id: A relative URI containing the resource ID of the disk + encryption set. + :paramtype disk_encryption_set_id: str + :keyword lun: Required. This property specifies the logical unit number of the data disk. This + value is used to identify data disks within the Virtual Machine and therefore must be unique + for each data disk attached to the Virtual Machine. + :paramtype lun: int + """ + super(DataDiskImageEncryption, self).__init__(disk_encryption_set_id=disk_encryption_set_id, **kwargs) + self.lun = lun + + +class Disallowed(msrest.serialization.Model): + """Describes the disallowed disk types. + + :ivar disk_types: A list of disk types. + :vartype disk_types: list[str] + """ + + _attribute_map = { + 'disk_types': {'key': 'diskTypes', 'type': '[str]'}, + } + + def __init__( + self, + *, + disk_types: Optional[List[str]] = None, + **kwargs + ): + """ + :keyword disk_types: A list of disk types. + :paramtype disk_types: list[str] + """ + super(Disallowed, self).__init__(**kwargs) + self.disk_types = disk_types + + +class EncryptionImages(msrest.serialization.Model): + """Optional. Allows users to provide customer managed keys for encrypting the OS and data disks in the gallery artifact. + + :ivar os_disk_image: Contains encryption settings for an OS disk image. + :vartype os_disk_image: ~azure.mgmt.compute.v2022_01_03.models.OSDiskImageEncryption + :ivar data_disk_images: A list of encryption specifications for data disk images. + :vartype data_disk_images: list[~azure.mgmt.compute.v2022_01_03.models.DataDiskImageEncryption] + """ + + _attribute_map = { + 'os_disk_image': {'key': 'osDiskImage', 'type': 'OSDiskImageEncryption'}, + 'data_disk_images': {'key': 'dataDiskImages', 'type': '[DataDiskImageEncryption]'}, + } + + def __init__( + self, + *, + os_disk_image: Optional["OSDiskImageEncryption"] = None, + data_disk_images: Optional[List["DataDiskImageEncryption"]] = None, + **kwargs + ): + """ + :keyword os_disk_image: Contains encryption settings for an OS disk image. + :paramtype os_disk_image: ~azure.mgmt.compute.v2022_01_03.models.OSDiskImageEncryption + :keyword data_disk_images: A list of encryption specifications for data disk images. + :paramtype data_disk_images: + list[~azure.mgmt.compute.v2022_01_03.models.DataDiskImageEncryption] + """ + super(EncryptionImages, self).__init__(**kwargs) + self.os_disk_image = os_disk_image + self.data_disk_images = data_disk_images + + +class Resource(msrest.serialization.Model): + """The Resource model definition. + + 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 + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = location + self.tags = tags + + +class Gallery(Resource): + """Specifies information about the Shared Image Gallery that you want to create or update. + + 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 + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar description: The description of this Shared Image Gallery resource. This property is + updatable. + :vartype description: str + :ivar identifier: Describes the gallery unique name. + :vartype identifier: ~azure.mgmt.compute.v2022_01_03.models.GalleryIdentifier + :ivar provisioning_state: The provisioning state, which only appears in the response. Possible + values include: "Creating", "Updating", "Failed", "Succeeded", "Deleting", "Migrating". + :vartype provisioning_state: str or + ~azure.mgmt.compute.v2022_01_03.models.GalleryPropertiesProvisioningState + :ivar sharing_profile: Profile for gallery sharing to subscription or tenant. + :vartype sharing_profile: ~azure.mgmt.compute.v2022_01_03.models.SharingProfile + :ivar soft_delete_policy: Contains information about the soft deletion policy of the gallery. + :vartype soft_delete_policy: ~azure.mgmt.compute.v2022_01_03.models.SoftDeletePolicy + :ivar sharing_status: Sharing status of current gallery. + :vartype sharing_status: ~azure.mgmt.compute.v2022_01_03.models.SharingStatus + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'provisioning_state': {'readonly': True}, + 'sharing_status': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'identifier': {'key': 'properties.identifier', 'type': 'GalleryIdentifier'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'sharing_profile': {'key': 'properties.sharingProfile', 'type': 'SharingProfile'}, + 'soft_delete_policy': {'key': 'properties.softDeletePolicy', 'type': 'SoftDeletePolicy'}, + 'sharing_status': {'key': 'properties.sharingStatus', 'type': 'SharingStatus'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + description: Optional[str] = None, + identifier: Optional["GalleryIdentifier"] = None, + sharing_profile: Optional["SharingProfile"] = None, + soft_delete_policy: Optional["SoftDeletePolicy"] = None, + **kwargs + ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword description: The description of this Shared Image Gallery resource. This property is + updatable. + :paramtype description: str + :keyword identifier: Describes the gallery unique name. + :paramtype identifier: ~azure.mgmt.compute.v2022_01_03.models.GalleryIdentifier + :keyword sharing_profile: Profile for gallery sharing to subscription or tenant. + :paramtype sharing_profile: ~azure.mgmt.compute.v2022_01_03.models.SharingProfile + :keyword soft_delete_policy: Contains information about the soft deletion policy of the + gallery. + :paramtype soft_delete_policy: ~azure.mgmt.compute.v2022_01_03.models.SoftDeletePolicy + """ + super(Gallery, self).__init__(location=location, tags=tags, **kwargs) + self.description = description + self.identifier = identifier + self.provisioning_state = None + self.sharing_profile = sharing_profile + self.soft_delete_policy = soft_delete_policy + self.sharing_status = None + + +class GalleryApplication(Resource): + """Specifies information about the gallery Application Definition that you want to create or update. + + 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 + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar description: The description of this gallery Application Definition resource. This + property is updatable. + :vartype description: str + :ivar eula: The Eula agreement for the gallery Application Definition. + :vartype eula: str + :ivar privacy_statement_uri: The privacy statement uri. + :vartype privacy_statement_uri: str + :ivar release_note_uri: The release note uri. + :vartype release_note_uri: str + :ivar end_of_life_date: The end of life date of the gallery Application Definition. This + property can be used for decommissioning purposes. This property is updatable. + :vartype end_of_life_date: ~datetime.datetime + :ivar supported_os_type: 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**. Possible values + include: "Windows", "Linux". + :vartype supported_os_type: str or ~azure.mgmt.compute.v2022_01_03.models.OperatingSystemTypes + """ + + _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}'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'eula': {'key': 'properties.eula', 'type': 'str'}, + 'privacy_statement_uri': {'key': 'properties.privacyStatementUri', 'type': 'str'}, + 'release_note_uri': {'key': 'properties.releaseNoteUri', 'type': 'str'}, + 'end_of_life_date': {'key': 'properties.endOfLifeDate', 'type': 'iso-8601'}, + 'supported_os_type': {'key': 'properties.supportedOSType', 'type': 'str'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + description: Optional[str] = None, + eula: Optional[str] = None, + privacy_statement_uri: Optional[str] = None, + release_note_uri: Optional[str] = None, + end_of_life_date: Optional[datetime.datetime] = None, + supported_os_type: Optional[Union[str, "OperatingSystemTypes"]] = None, + **kwargs + ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword description: The description of this gallery Application Definition resource. This + property is updatable. + :paramtype description: str + :keyword eula: The Eula agreement for the gallery Application Definition. + :paramtype eula: str + :keyword privacy_statement_uri: The privacy statement uri. + :paramtype privacy_statement_uri: str + :keyword release_note_uri: The release note uri. + :paramtype release_note_uri: str + :keyword end_of_life_date: The end of life date of the gallery Application Definition. This + property can be used for decommissioning purposes. This property is updatable. + :paramtype end_of_life_date: ~datetime.datetime + :keyword supported_os_type: 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**. Possible values + include: "Windows", "Linux". + :paramtype supported_os_type: str or + ~azure.mgmt.compute.v2022_01_03.models.OperatingSystemTypes + """ + super(GalleryApplication, self).__init__(location=location, tags=tags, **kwargs) + self.description = description + self.eula = eula + self.privacy_statement_uri = privacy_statement_uri + self.release_note_uri = release_note_uri + self.end_of_life_date = end_of_life_date + self.supported_os_type = supported_os_type + + +class GalleryApplicationList(msrest.serialization.Model): + """The List Gallery Applications operation response. + + All required parameters must be populated in order to send to Azure. + + :ivar value: Required. A list of Gallery Applications. + :vartype value: list[~azure.mgmt.compute.v2022_01_03.models.GalleryApplication] + :ivar next_link: The uri to fetch the next page of Application Definitions in the Application + Gallery. Call ListNext() with this to fetch the next page of gallery Application Definitions. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[GalleryApplication]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["GalleryApplication"], + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: Required. A list of Gallery Applications. + :paramtype value: list[~azure.mgmt.compute.v2022_01_03.models.GalleryApplication] + :keyword next_link: The uri to fetch the next page of Application Definitions in the + Application Gallery. Call ListNext() with this to fetch the next page of gallery Application + Definitions. + :paramtype next_link: str + """ + super(GalleryApplicationList, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class UpdateResourceDefinition(msrest.serialization.Model): + """The Update Resource model definition. + + 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 tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ + super(UpdateResourceDefinition, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.tags = tags + + +class GalleryApplicationUpdate(UpdateResourceDefinition): + """Specifies information about the gallery Application Definition that you want to update. + + 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 tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar description: The description of this gallery Application Definition resource. This + property is updatable. + :vartype description: str + :ivar eula: The Eula agreement for the gallery Application Definition. + :vartype eula: str + :ivar privacy_statement_uri: The privacy statement uri. + :vartype privacy_statement_uri: str + :ivar release_note_uri: The release note uri. + :vartype release_note_uri: str + :ivar end_of_life_date: The end of life date of the gallery Application Definition. This + property can be used for decommissioning purposes. This property is updatable. + :vartype end_of_life_date: ~datetime.datetime + :ivar supported_os_type: 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**. Possible values + include: "Windows", "Linux". + :vartype supported_os_type: str or ~azure.mgmt.compute.v2022_01_03.models.OperatingSystemTypes + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'eula': {'key': 'properties.eula', 'type': 'str'}, + 'privacy_statement_uri': {'key': 'properties.privacyStatementUri', 'type': 'str'}, + 'release_note_uri': {'key': 'properties.releaseNoteUri', 'type': 'str'}, + 'end_of_life_date': {'key': 'properties.endOfLifeDate', 'type': 'iso-8601'}, + 'supported_os_type': {'key': 'properties.supportedOSType', 'type': 'str'}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + description: Optional[str] = None, + eula: Optional[str] = None, + privacy_statement_uri: Optional[str] = None, + release_note_uri: Optional[str] = None, + end_of_life_date: Optional[datetime.datetime] = None, + supported_os_type: Optional[Union[str, "OperatingSystemTypes"]] = None, + **kwargs + ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword description: The description of this gallery Application Definition resource. This + property is updatable. + :paramtype description: str + :keyword eula: The Eula agreement for the gallery Application Definition. + :paramtype eula: str + :keyword privacy_statement_uri: The privacy statement uri. + :paramtype privacy_statement_uri: str + :keyword release_note_uri: The release note uri. + :paramtype release_note_uri: str + :keyword end_of_life_date: The end of life date of the gallery Application Definition. This + property can be used for decommissioning purposes. This property is updatable. + :paramtype end_of_life_date: ~datetime.datetime + :keyword supported_os_type: 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**. Possible values + include: "Windows", "Linux". + :paramtype supported_os_type: str or + ~azure.mgmt.compute.v2022_01_03.models.OperatingSystemTypes + """ + super(GalleryApplicationUpdate, self).__init__(tags=tags, **kwargs) + self.description = description + self.eula = eula + self.privacy_statement_uri = privacy_statement_uri + self.release_note_uri = release_note_uri + self.end_of_life_date = end_of_life_date + self.supported_os_type = supported_os_type + + +class GalleryApplicationVersion(Resource): + """Specifies information about the gallery Application Version that you want to create or update. + + 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 + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar publishing_profile: The publishing profile of a gallery image version. + :vartype publishing_profile: + ~azure.mgmt.compute.v2022_01_03.models.GalleryApplicationVersionPublishingProfile + :ivar provisioning_state: The provisioning state, which only appears in the response. Possible + values include: "Creating", "Updating", "Failed", "Succeeded", "Deleting", "Migrating". + :vartype provisioning_state: str or + ~azure.mgmt.compute.v2022_01_03.models.GalleryApplicationVersionPropertiesProvisioningState + :ivar replication_status: This is the replication status of the gallery image version. + :vartype replication_status: ~azure.mgmt.compute.v2022_01_03.models.ReplicationStatus + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'provisioning_state': {'readonly': True}, + 'replication_status': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'publishing_profile': {'key': 'properties.publishingProfile', 'type': 'GalleryApplicationVersionPublishingProfile'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'replication_status': {'key': 'properties.replicationStatus', 'type': 'ReplicationStatus'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + publishing_profile: Optional["GalleryApplicationVersionPublishingProfile"] = None, + **kwargs + ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword publishing_profile: The publishing profile of a gallery image version. + :paramtype publishing_profile: + ~azure.mgmt.compute.v2022_01_03.models.GalleryApplicationVersionPublishingProfile + """ + super(GalleryApplicationVersion, self).__init__(location=location, tags=tags, **kwargs) + self.publishing_profile = publishing_profile + self.provisioning_state = None + self.replication_status = None + + +class GalleryApplicationVersionList(msrest.serialization.Model): + """The List Gallery Application version operation response. + + All required parameters must be populated in order to send to Azure. + + :ivar value: Required. A list of gallery Application Versions. + :vartype value: list[~azure.mgmt.compute.v2022_01_03.models.GalleryApplicationVersion] + :ivar next_link: The uri to fetch the next page of gallery Application Versions. Call + ListNext() with this to fetch the next page of gallery Application Versions. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[GalleryApplicationVersion]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["GalleryApplicationVersion"], + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: Required. A list of gallery Application Versions. + :paramtype value: list[~azure.mgmt.compute.v2022_01_03.models.GalleryApplicationVersion] + :keyword next_link: The uri to fetch the next page of gallery Application Versions. Call + ListNext() with this to fetch the next page of gallery Application Versions. + :paramtype next_link: str + """ + super(GalleryApplicationVersionList, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class GalleryArtifactPublishingProfileBase(msrest.serialization.Model): + """Describes the basic gallery artifact publishing profile. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar target_regions: The target regions where the Image Version is going to be replicated to. + This property is updatable. + :vartype target_regions: list[~azure.mgmt.compute.v2022_01_03.models.TargetRegion] + :ivar replica_count: The number of replicas of the Image Version to be created per region. This + property would take effect for a region when regionalReplicaCount is not specified. This + property is updatable. + :vartype replica_count: int + :ivar exclude_from_latest: If set to true, Virtual Machines deployed from the latest version of + the Image Definition won't use this Image Version. + :vartype exclude_from_latest: bool + :ivar published_date: The timestamp for when the gallery image version is published. + :vartype published_date: ~datetime.datetime + :ivar end_of_life_date: The end of life date of the gallery image version. This property can be + used for decommissioning purposes. This property is updatable. + :vartype end_of_life_date: ~datetime.datetime + :ivar storage_account_type: Specifies the storage account type to be used to store the image. + This property is not updatable. Possible values include: "Standard_LRS", "Standard_ZRS", + "Premium_LRS". + :vartype storage_account_type: str or ~azure.mgmt.compute.v2022_01_03.models.StorageAccountType + :ivar replication_mode: Optional parameter which specifies the mode to be used for replication. + This property is not updatable. Possible values include: "Full", "Shallow". + :vartype replication_mode: str or ~azure.mgmt.compute.v2022_01_03.models.ReplicationMode + :ivar target_extended_locations: The target extended locations where the Image Version is going + to be replicated to. This property is updatable. + :vartype target_extended_locations: + list[~azure.mgmt.compute.v2022_01_03.models.GalleryTargetExtendedLocation] + """ + + _validation = { + 'published_date': {'readonly': True}, + } + + _attribute_map = { + 'target_regions': {'key': 'targetRegions', 'type': '[TargetRegion]'}, + 'replica_count': {'key': 'replicaCount', 'type': 'int'}, + 'exclude_from_latest': {'key': 'excludeFromLatest', 'type': 'bool'}, + 'published_date': {'key': 'publishedDate', 'type': 'iso-8601'}, + 'end_of_life_date': {'key': 'endOfLifeDate', 'type': 'iso-8601'}, + 'storage_account_type': {'key': 'storageAccountType', 'type': 'str'}, + 'replication_mode': {'key': 'replicationMode', 'type': 'str'}, + 'target_extended_locations': {'key': 'targetExtendedLocations', 'type': '[GalleryTargetExtendedLocation]'}, + } + + def __init__( + self, + *, + target_regions: Optional[List["TargetRegion"]] = None, + replica_count: Optional[int] = None, + exclude_from_latest: Optional[bool] = None, + end_of_life_date: Optional[datetime.datetime] = None, + storage_account_type: Optional[Union[str, "StorageAccountType"]] = None, + replication_mode: Optional[Union[str, "ReplicationMode"]] = None, + target_extended_locations: Optional[List["GalleryTargetExtendedLocation"]] = None, + **kwargs + ): + """ + :keyword target_regions: The target regions where the Image Version is going to be replicated + to. This property is updatable. + :paramtype target_regions: list[~azure.mgmt.compute.v2022_01_03.models.TargetRegion] + :keyword replica_count: The number of replicas of the Image Version to be created per region. + This property would take effect for a region when regionalReplicaCount is not specified. This + property is updatable. + :paramtype replica_count: int + :keyword exclude_from_latest: If set to true, Virtual Machines deployed from the latest version + of the Image Definition won't use this Image Version. + :paramtype exclude_from_latest: bool + :keyword end_of_life_date: The end of life date of the gallery image version. This property can + be used for decommissioning purposes. This property is updatable. + :paramtype end_of_life_date: ~datetime.datetime + :keyword storage_account_type: Specifies the storage account type to be used to store the + image. This property is not updatable. Possible values include: "Standard_LRS", "Standard_ZRS", + "Premium_LRS". + :paramtype storage_account_type: str or + ~azure.mgmt.compute.v2022_01_03.models.StorageAccountType + :keyword replication_mode: Optional parameter which specifies the mode to be used for + replication. This property is not updatable. Possible values include: "Full", "Shallow". + :paramtype replication_mode: str or ~azure.mgmt.compute.v2022_01_03.models.ReplicationMode + :keyword target_extended_locations: The target extended locations where the Image Version is + going to be replicated to. This property is updatable. + :paramtype target_extended_locations: + list[~azure.mgmt.compute.v2022_01_03.models.GalleryTargetExtendedLocation] + """ + super(GalleryArtifactPublishingProfileBase, self).__init__(**kwargs) + self.target_regions = target_regions + self.replica_count = replica_count + self.exclude_from_latest = exclude_from_latest + self.published_date = None + self.end_of_life_date = end_of_life_date + self.storage_account_type = storage_account_type + self.replication_mode = replication_mode + self.target_extended_locations = target_extended_locations + + +class GalleryApplicationVersionPublishingProfile(GalleryArtifactPublishingProfileBase): + """The publishing profile of a gallery image version. + + 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 target_regions: The target regions where the Image Version is going to be replicated to. + This property is updatable. + :vartype target_regions: list[~azure.mgmt.compute.v2022_01_03.models.TargetRegion] + :ivar replica_count: The number of replicas of the Image Version to be created per region. This + property would take effect for a region when regionalReplicaCount is not specified. This + property is updatable. + :vartype replica_count: int + :ivar exclude_from_latest: If set to true, Virtual Machines deployed from the latest version of + the Image Definition won't use this Image Version. + :vartype exclude_from_latest: bool + :ivar published_date: The timestamp for when the gallery image version is published. + :vartype published_date: ~datetime.datetime + :ivar end_of_life_date: The end of life date of the gallery image version. This property can be + used for decommissioning purposes. This property is updatable. + :vartype end_of_life_date: ~datetime.datetime + :ivar storage_account_type: Specifies the storage account type to be used to store the image. + This property is not updatable. Possible values include: "Standard_LRS", "Standard_ZRS", + "Premium_LRS". + :vartype storage_account_type: str or ~azure.mgmt.compute.v2022_01_03.models.StorageAccountType + :ivar replication_mode: Optional parameter which specifies the mode to be used for replication. + This property is not updatable. Possible values include: "Full", "Shallow". + :vartype replication_mode: str or ~azure.mgmt.compute.v2022_01_03.models.ReplicationMode + :ivar target_extended_locations: The target extended locations where the Image Version is going + to be replicated to. This property is updatable. + :vartype target_extended_locations: + list[~azure.mgmt.compute.v2022_01_03.models.GalleryTargetExtendedLocation] + :ivar source: Required. The source image from which the Image Version is going to be created. + :vartype source: ~azure.mgmt.compute.v2022_01_03.models.UserArtifactSource + :ivar manage_actions: + :vartype manage_actions: ~azure.mgmt.compute.v2022_01_03.models.UserArtifactManage + :ivar enable_health_check: Optional. Whether or not this application reports health. + :vartype enable_health_check: bool + """ + + _validation = { + 'published_date': {'readonly': True}, + 'source': {'required': True}, + } + + _attribute_map = { + 'target_regions': {'key': 'targetRegions', 'type': '[TargetRegion]'}, + 'replica_count': {'key': 'replicaCount', 'type': 'int'}, + 'exclude_from_latest': {'key': 'excludeFromLatest', 'type': 'bool'}, + 'published_date': {'key': 'publishedDate', 'type': 'iso-8601'}, + 'end_of_life_date': {'key': 'endOfLifeDate', 'type': 'iso-8601'}, + 'storage_account_type': {'key': 'storageAccountType', 'type': 'str'}, + 'replication_mode': {'key': 'replicationMode', 'type': 'str'}, + 'target_extended_locations': {'key': 'targetExtendedLocations', 'type': '[GalleryTargetExtendedLocation]'}, + 'source': {'key': 'source', 'type': 'UserArtifactSource'}, + 'manage_actions': {'key': 'manageActions', 'type': 'UserArtifactManage'}, + 'enable_health_check': {'key': 'enableHealthCheck', 'type': 'bool'}, + } + + def __init__( + self, + *, + source: "UserArtifactSource", + target_regions: Optional[List["TargetRegion"]] = None, + replica_count: Optional[int] = None, + exclude_from_latest: Optional[bool] = None, + end_of_life_date: Optional[datetime.datetime] = None, + storage_account_type: Optional[Union[str, "StorageAccountType"]] = None, + replication_mode: Optional[Union[str, "ReplicationMode"]] = None, + target_extended_locations: Optional[List["GalleryTargetExtendedLocation"]] = None, + manage_actions: Optional["UserArtifactManage"] = None, + enable_health_check: Optional[bool] = None, + **kwargs + ): + """ + :keyword target_regions: The target regions where the Image Version is going to be replicated + to. This property is updatable. + :paramtype target_regions: list[~azure.mgmt.compute.v2022_01_03.models.TargetRegion] + :keyword replica_count: The number of replicas of the Image Version to be created per region. + This property would take effect for a region when regionalReplicaCount is not specified. This + property is updatable. + :paramtype replica_count: int + :keyword exclude_from_latest: If set to true, Virtual Machines deployed from the latest version + of the Image Definition won't use this Image Version. + :paramtype exclude_from_latest: bool + :keyword end_of_life_date: The end of life date of the gallery image version. This property can + be used for decommissioning purposes. This property is updatable. + :paramtype end_of_life_date: ~datetime.datetime + :keyword storage_account_type: Specifies the storage account type to be used to store the + image. This property is not updatable. Possible values include: "Standard_LRS", "Standard_ZRS", + "Premium_LRS". + :paramtype storage_account_type: str or + ~azure.mgmt.compute.v2022_01_03.models.StorageAccountType + :keyword replication_mode: Optional parameter which specifies the mode to be used for + replication. This property is not updatable. Possible values include: "Full", "Shallow". + :paramtype replication_mode: str or ~azure.mgmt.compute.v2022_01_03.models.ReplicationMode + :keyword target_extended_locations: The target extended locations where the Image Version is + going to be replicated to. This property is updatable. + :paramtype target_extended_locations: + list[~azure.mgmt.compute.v2022_01_03.models.GalleryTargetExtendedLocation] + :keyword source: Required. The source image from which the Image Version is going to be + created. + :paramtype source: ~azure.mgmt.compute.v2022_01_03.models.UserArtifactSource + :keyword manage_actions: + :paramtype manage_actions: ~azure.mgmt.compute.v2022_01_03.models.UserArtifactManage + :keyword enable_health_check: Optional. Whether or not this application reports health. + :paramtype enable_health_check: bool + """ + 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, replication_mode=replication_mode, target_extended_locations=target_extended_locations, **kwargs) + self.source = source + self.manage_actions = manage_actions + self.enable_health_check = enable_health_check + + +class GalleryApplicationVersionUpdate(UpdateResourceDefinition): + """Specifies information about the gallery Application Version that you want to update. + + 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 tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar publishing_profile: The publishing profile of a gallery image version. + :vartype publishing_profile: + ~azure.mgmt.compute.v2022_01_03.models.GalleryApplicationVersionPublishingProfile + :ivar provisioning_state: The provisioning state, which only appears in the response. Possible + values include: "Creating", "Updating", "Failed", "Succeeded", "Deleting", "Migrating". + :vartype provisioning_state: str or + ~azure.mgmt.compute.v2022_01_03.models.GalleryApplicationVersionPropertiesProvisioningState + :ivar replication_status: This is the replication status of the gallery image version. + :vartype replication_status: ~azure.mgmt.compute.v2022_01_03.models.ReplicationStatus + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'replication_status': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'publishing_profile': {'key': 'properties.publishingProfile', 'type': 'GalleryApplicationVersionPublishingProfile'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'replication_status': {'key': 'properties.replicationStatus', 'type': 'ReplicationStatus'}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + publishing_profile: Optional["GalleryApplicationVersionPublishingProfile"] = None, + **kwargs + ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword publishing_profile: The publishing profile of a gallery image version. + :paramtype publishing_profile: + ~azure.mgmt.compute.v2022_01_03.models.GalleryApplicationVersionPublishingProfile + """ + super(GalleryApplicationVersionUpdate, self).__init__(tags=tags, **kwargs) + self.publishing_profile = publishing_profile + self.provisioning_state = None + self.replication_status = None + + +class GalleryArtifactSource(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. + + :ivar managed_image: Required. The managed artifact. + :vartype managed_image: ~azure.mgmt.compute.v2022_01_03.models.ManagedArtifact + """ + + _validation = { + 'managed_image': {'required': True}, + } + + _attribute_map = { + 'managed_image': {'key': 'managedImage', 'type': 'ManagedArtifact'}, + } + + def __init__( + self, + *, + managed_image: "ManagedArtifact", + **kwargs + ): + """ + :keyword managed_image: Required. The managed artifact. + :paramtype managed_image: ~azure.mgmt.compute.v2022_01_03.models.ManagedArtifact + """ + super(GalleryArtifactSource, self).__init__(**kwargs) + self.managed_image = managed_image + + +class GalleryArtifactVersionSource(msrest.serialization.Model): + """The gallery artifact version source. + + :ivar id: The id of the gallery artifact version source. Can specify a disk uri, snapshot uri, + user image or storage account resource. + :vartype id: str + :ivar uri: The uri of the gallery artifact version source. Currently used to specify vhd/blob + source. + :vartype uri: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'uri': {'key': 'uri', 'type': 'str'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + uri: Optional[str] = None, + **kwargs + ): + """ + :keyword id: The id of the gallery artifact version source. Can specify a disk uri, snapshot + uri, user image or storage account resource. + :paramtype id: str + :keyword uri: The uri of the gallery artifact version source. Currently used to specify + vhd/blob source. + :paramtype uri: str + """ + super(GalleryArtifactVersionSource, self).__init__(**kwargs) + self.id = id + self.uri = uri + + +class GalleryDiskImage(msrest.serialization.Model): + """This is the disk image base class. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar size_in_gb: This property indicates the size of the VHD to be created. + :vartype size_in_gb: int + :ivar host_caching: The host caching of the disk. Valid values are 'None', 'ReadOnly', and + 'ReadWrite'. Possible values include: "None", "ReadOnly", "ReadWrite". + :vartype host_caching: str or ~azure.mgmt.compute.v2022_01_03.models.HostCaching + :ivar source: The gallery artifact version source. + :vartype source: ~azure.mgmt.compute.v2022_01_03.models.GalleryArtifactVersionSource + """ + + _validation = { + 'size_in_gb': {'readonly': True}, + } + + _attribute_map = { + 'size_in_gb': {'key': 'sizeInGB', 'type': 'int'}, + 'host_caching': {'key': 'hostCaching', 'type': 'str'}, + 'source': {'key': 'source', 'type': 'GalleryArtifactVersionSource'}, + } + + def __init__( + self, + *, + host_caching: Optional[Union[str, "HostCaching"]] = None, + source: Optional["GalleryArtifactVersionSource"] = None, + **kwargs + ): + """ + :keyword host_caching: The host caching of the disk. Valid values are 'None', 'ReadOnly', and + 'ReadWrite'. Possible values include: "None", "ReadOnly", "ReadWrite". + :paramtype host_caching: str or ~azure.mgmt.compute.v2022_01_03.models.HostCaching + :keyword source: The gallery artifact version source. + :paramtype source: ~azure.mgmt.compute.v2022_01_03.models.GalleryArtifactVersionSource + """ + super(GalleryDiskImage, self).__init__(**kwargs) + self.size_in_gb = None + self.host_caching = host_caching + self.source = source + + +class GalleryDataDiskImage(GalleryDiskImage): + """This is the data disk image. + + 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 size_in_gb: This property indicates the size of the VHD to be created. + :vartype size_in_gb: int + :ivar host_caching: The host caching of the disk. Valid values are 'None', 'ReadOnly', and + 'ReadWrite'. Possible values include: "None", "ReadOnly", "ReadWrite". + :vartype host_caching: str or ~azure.mgmt.compute.v2022_01_03.models.HostCaching + :ivar source: The gallery artifact version source. + :vartype source: ~azure.mgmt.compute.v2022_01_03.models.GalleryArtifactVersionSource + :ivar lun: Required. This property specifies the logical unit number of the data disk. This + value is used to identify data disks within the Virtual Machine and therefore must be unique + for each data disk attached to the Virtual Machine. + :vartype lun: int + """ + + _validation = { + 'size_in_gb': {'readonly': True}, + 'lun': {'required': True}, + } + + _attribute_map = { + 'size_in_gb': {'key': 'sizeInGB', 'type': 'int'}, + 'host_caching': {'key': 'hostCaching', 'type': 'str'}, + 'source': {'key': 'source', 'type': 'GalleryArtifactVersionSource'}, + 'lun': {'key': 'lun', 'type': 'int'}, + } + + def __init__( + self, + *, + lun: int, + host_caching: Optional[Union[str, "HostCaching"]] = None, + source: Optional["GalleryArtifactVersionSource"] = None, + **kwargs + ): + """ + :keyword host_caching: The host caching of the disk. Valid values are 'None', 'ReadOnly', and + 'ReadWrite'. Possible values include: "None", "ReadOnly", "ReadWrite". + :paramtype host_caching: str or ~azure.mgmt.compute.v2022_01_03.models.HostCaching + :keyword source: The gallery artifact version source. + :paramtype source: ~azure.mgmt.compute.v2022_01_03.models.GalleryArtifactVersionSource + :keyword lun: Required. This property specifies the logical unit number of the data disk. This + value is used to identify data disks within the Virtual Machine and therefore must be unique + for each data disk attached to the Virtual Machine. + :paramtype lun: int + """ + super(GalleryDataDiskImage, self).__init__(host_caching=host_caching, source=source, **kwargs) + self.lun = lun + + +class GalleryExtendedLocation(msrest.serialization.Model): + """The name of the extended location. + + :ivar name: + :vartype name: str + :ivar type: It is type of the extended location. Possible values include: "EdgeZone", + "Unknown". + :vartype type: str or ~azure.mgmt.compute.v2022_01_03.models.GalleryExtendedLocationType + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + type: Optional[Union[str, "GalleryExtendedLocationType"]] = None, + **kwargs + ): + """ + :keyword name: + :paramtype name: str + :keyword type: It is type of the extended location. Possible values include: "EdgeZone", + "Unknown". + :paramtype type: str or ~azure.mgmt.compute.v2022_01_03.models.GalleryExtendedLocationType + """ + super(GalleryExtendedLocation, self).__init__(**kwargs) + self.name = name + self.type = type + + +class GalleryIdentifier(msrest.serialization.Model): + """Describes the gallery unique name. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar unique_name: The unique name of the Shared Image Gallery. This name is generated + automatically by Azure. + :vartype unique_name: str + """ + + _validation = { + 'unique_name': {'readonly': True}, + } + + _attribute_map = { + 'unique_name': {'key': 'uniqueName', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(GalleryIdentifier, self).__init__(**kwargs) + self.unique_name = None + + +class GalleryImage(Resource): + """Specifies information about the gallery image definition that you want to create or update. + + 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 + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar description: The description of this gallery image definition resource. This property is + updatable. + :vartype description: str + :ivar eula: The Eula agreement for the gallery image definition. + :vartype eula: str + :ivar privacy_statement_uri: The privacy statement uri. + :vartype privacy_statement_uri: str + :ivar release_note_uri: The release note uri. + :vartype release_note_uri: str + :ivar os_type: This property allows you to specify the type of the OS that is included in the + disk when creating a VM from a managed image. :code:`
`:code:`
` Possible values are: + :code:`
`:code:`
` **Windows** :code:`
`:code:`
` **Linux**. Possible values + include: "Windows", "Linux". + :vartype os_type: str or ~azure.mgmt.compute.v2022_01_03.models.OperatingSystemTypes + :ivar os_state: This property allows the user to specify whether the virtual machines created + under this image are 'Generalized' or 'Specialized'. Possible values include: "Generalized", + "Specialized". + :vartype os_state: str or ~azure.mgmt.compute.v2022_01_03.models.OperatingSystemStateTypes + :ivar hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS + disks only. Possible values include: "V1", "V2". + :vartype hyper_v_generation: str or ~azure.mgmt.compute.v2022_01_03.models.HyperVGeneration + :ivar end_of_life_date: The end of life date of the gallery image definition. This property can + be used for decommissioning purposes. This property is updatable. + :vartype end_of_life_date: ~datetime.datetime + :ivar identifier: This is the gallery image definition identifier. + :vartype identifier: ~azure.mgmt.compute.v2022_01_03.models.GalleryImageIdentifier + :ivar recommended: The properties describe the recommended machine configuration for this Image + Definition. These properties are updatable. + :vartype recommended: ~azure.mgmt.compute.v2022_01_03.models.RecommendedMachineConfiguration + :ivar disallowed: Describes the disallowed disk types. + :vartype disallowed: ~azure.mgmt.compute.v2022_01_03.models.Disallowed + :ivar purchase_plan: Describes the gallery image definition purchase plan. This is used by + marketplace images. + :vartype purchase_plan: ~azure.mgmt.compute.v2022_01_03.models.ImagePurchasePlan + :ivar provisioning_state: The provisioning state, which only appears in the response. Possible + values include: "Creating", "Updating", "Failed", "Succeeded", "Deleting", "Migrating". + :vartype provisioning_state: str or + ~azure.mgmt.compute.v2022_01_03.models.GalleryImagePropertiesProvisioningState + :ivar features: A list of gallery image features. + :vartype features: list[~azure.mgmt.compute.v2022_01_03.models.GalleryImageFeature] + :ivar architecture: The architecture of the image. Applicable to OS disks only. Possible values + include: "x64", "Arm64". + :vartype architecture: str or ~azure.mgmt.compute.v2022_01_03.models.Architecture + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'eula': {'key': 'properties.eula', 'type': 'str'}, + 'privacy_statement_uri': {'key': 'properties.privacyStatementUri', 'type': 'str'}, + 'release_note_uri': {'key': 'properties.releaseNoteUri', 'type': 'str'}, + 'os_type': {'key': 'properties.osType', 'type': 'str'}, + 'os_state': {'key': 'properties.osState', 'type': 'str'}, + 'hyper_v_generation': {'key': 'properties.hyperVGeneration', 'type': 'str'}, + 'end_of_life_date': {'key': 'properties.endOfLifeDate', 'type': 'iso-8601'}, + 'identifier': {'key': 'properties.identifier', 'type': 'GalleryImageIdentifier'}, + 'recommended': {'key': 'properties.recommended', 'type': 'RecommendedMachineConfiguration'}, + 'disallowed': {'key': 'properties.disallowed', 'type': 'Disallowed'}, + 'purchase_plan': {'key': 'properties.purchasePlan', 'type': 'ImagePurchasePlan'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'features': {'key': 'properties.features', 'type': '[GalleryImageFeature]'}, + 'architecture': {'key': 'properties.architecture', 'type': 'str'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + description: Optional[str] = None, + eula: Optional[str] = None, + privacy_statement_uri: Optional[str] = None, + release_note_uri: Optional[str] = None, + os_type: Optional[Union[str, "OperatingSystemTypes"]] = None, + os_state: Optional[Union[str, "OperatingSystemStateTypes"]] = None, + hyper_v_generation: Optional[Union[str, "HyperVGeneration"]] = None, + end_of_life_date: Optional[datetime.datetime] = None, + identifier: Optional["GalleryImageIdentifier"] = None, + recommended: Optional["RecommendedMachineConfiguration"] = None, + disallowed: Optional["Disallowed"] = None, + purchase_plan: Optional["ImagePurchasePlan"] = None, + features: Optional[List["GalleryImageFeature"]] = None, + architecture: Optional[Union[str, "Architecture"]] = None, + **kwargs + ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword description: The description of this gallery image definition resource. This property + is updatable. + :paramtype description: str + :keyword eula: The Eula agreement for the gallery image definition. + :paramtype eula: str + :keyword privacy_statement_uri: The privacy statement uri. + :paramtype privacy_statement_uri: str + :keyword release_note_uri: The release note uri. + :paramtype release_note_uri: str + :keyword os_type: This property allows you to specify the type of the OS that is included in + the disk when creating a VM from a managed image. :code:`
`:code:`
` Possible values are: + :code:`
`:code:`
` **Windows** :code:`
`:code:`
` **Linux**. Possible values + include: "Windows", "Linux". + :paramtype os_type: str or ~azure.mgmt.compute.v2022_01_03.models.OperatingSystemTypes + :keyword os_state: This property allows the user to specify whether the virtual machines + created under this image are 'Generalized' or 'Specialized'. Possible values include: + "Generalized", "Specialized". + :paramtype os_state: str or ~azure.mgmt.compute.v2022_01_03.models.OperatingSystemStateTypes + :keyword hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS + disks only. Possible values include: "V1", "V2". + :paramtype hyper_v_generation: str or ~azure.mgmt.compute.v2022_01_03.models.HyperVGeneration + :keyword end_of_life_date: The end of life date of the gallery image definition. This property + can be used for decommissioning purposes. This property is updatable. + :paramtype end_of_life_date: ~datetime.datetime + :keyword identifier: This is the gallery image definition identifier. + :paramtype identifier: ~azure.mgmt.compute.v2022_01_03.models.GalleryImageIdentifier + :keyword recommended: The properties describe the recommended machine configuration for this + Image Definition. These properties are updatable. + :paramtype recommended: ~azure.mgmt.compute.v2022_01_03.models.RecommendedMachineConfiguration + :keyword disallowed: Describes the disallowed disk types. + :paramtype disallowed: ~azure.mgmt.compute.v2022_01_03.models.Disallowed + :keyword purchase_plan: Describes the gallery image definition purchase plan. This is used by + marketplace images. + :paramtype purchase_plan: ~azure.mgmt.compute.v2022_01_03.models.ImagePurchasePlan + :keyword features: A list of gallery image features. + :paramtype features: list[~azure.mgmt.compute.v2022_01_03.models.GalleryImageFeature] + :keyword architecture: The architecture of the image. Applicable to OS disks only. Possible + values include: "x64", "Arm64". + :paramtype architecture: str or ~azure.mgmt.compute.v2022_01_03.models.Architecture + """ + super(GalleryImage, self).__init__(location=location, tags=tags, **kwargs) + self.description = description + self.eula = eula + self.privacy_statement_uri = privacy_statement_uri + self.release_note_uri = release_note_uri + self.os_type = os_type + self.os_state = os_state + self.hyper_v_generation = hyper_v_generation + self.end_of_life_date = end_of_life_date + self.identifier = identifier + self.recommended = recommended + self.disallowed = disallowed + self.purchase_plan = purchase_plan + self.provisioning_state = None + self.features = features + self.architecture = architecture + + +class GalleryImageFeature(msrest.serialization.Model): + """A feature for gallery image. + + :ivar name: The name of the gallery image feature. + :vartype name: str + :ivar value: The value of the gallery image feature. + :vartype value: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + value: Optional[str] = None, + **kwargs + ): + """ + :keyword name: The name of the gallery image feature. + :paramtype name: str + :keyword value: The value of the gallery image feature. + :paramtype value: str + """ + super(GalleryImageFeature, self).__init__(**kwargs) + self.name = name + self.value = value + + +class GalleryImageIdentifier(msrest.serialization.Model): + """This is the gallery image definition identifier. + + All required parameters must be populated in order to send to Azure. + + :ivar publisher: Required. The name of the gallery image definition publisher. + :vartype publisher: str + :ivar offer: Required. The name of the gallery image definition offer. + :vartype offer: str + :ivar sku: Required. The name of the gallery image definition SKU. + :vartype sku: str + """ + + _validation = { + 'publisher': {'required': True}, + 'offer': {'required': True}, + 'sku': {'required': True}, + } + + _attribute_map = { + 'publisher': {'key': 'publisher', 'type': 'str'}, + 'offer': {'key': 'offer', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'str'}, + } + + def __init__( + self, + *, + publisher: str, + offer: str, + sku: str, + **kwargs + ): + """ + :keyword publisher: Required. The name of the gallery image definition publisher. + :paramtype publisher: str + :keyword offer: Required. The name of the gallery image definition offer. + :paramtype offer: str + :keyword sku: Required. The name of the gallery image definition SKU. + :paramtype sku: str + """ + super(GalleryImageIdentifier, self).__init__(**kwargs) + self.publisher = publisher + self.offer = offer + self.sku = sku + + +class GalleryImageList(msrest.serialization.Model): + """The List Gallery Images operation response. + + All required parameters must be populated in order to send to Azure. + + :ivar value: Required. A list of Shared Image Gallery images. + :vartype value: list[~azure.mgmt.compute.v2022_01_03.models.GalleryImage] + :ivar next_link: The uri to fetch the next page of Image Definitions in the Shared Image + Gallery. Call ListNext() with this to fetch the next page of gallery image definitions. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[GalleryImage]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["GalleryImage"], + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: Required. A list of Shared Image Gallery images. + :paramtype value: list[~azure.mgmt.compute.v2022_01_03.models.GalleryImage] + :keyword next_link: The uri to fetch the next page of Image Definitions in the Shared Image + Gallery. Call ListNext() with this to fetch the next page of gallery image definitions. + :paramtype next_link: str + """ + super(GalleryImageList, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class GalleryImageUpdate(UpdateResourceDefinition): + """Specifies information about the gallery image definition that you want to update. + + 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 tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar description: The description of this gallery image definition resource. This property is + updatable. + :vartype description: str + :ivar eula: The Eula agreement for the gallery image definition. + :vartype eula: str + :ivar privacy_statement_uri: The privacy statement uri. + :vartype privacy_statement_uri: str + :ivar release_note_uri: The release note uri. + :vartype release_note_uri: str + :ivar os_type: This property allows you to specify the type of the OS that is included in the + disk when creating a VM from a managed image. :code:`
`:code:`
` Possible values are: + :code:`
`:code:`
` **Windows** :code:`
`:code:`
` **Linux**. Possible values + include: "Windows", "Linux". + :vartype os_type: str or ~azure.mgmt.compute.v2022_01_03.models.OperatingSystemTypes + :ivar os_state: This property allows the user to specify whether the virtual machines created + under this image are 'Generalized' or 'Specialized'. Possible values include: "Generalized", + "Specialized". + :vartype os_state: str or ~azure.mgmt.compute.v2022_01_03.models.OperatingSystemStateTypes + :ivar hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS + disks only. Possible values include: "V1", "V2". + :vartype hyper_v_generation: str or ~azure.mgmt.compute.v2022_01_03.models.HyperVGeneration + :ivar end_of_life_date: The end of life date of the gallery image definition. This property can + be used for decommissioning purposes. This property is updatable. + :vartype end_of_life_date: ~datetime.datetime + :ivar identifier: This is the gallery image definition identifier. + :vartype identifier: ~azure.mgmt.compute.v2022_01_03.models.GalleryImageIdentifier + :ivar recommended: The properties describe the recommended machine configuration for this Image + Definition. These properties are updatable. + :vartype recommended: ~azure.mgmt.compute.v2022_01_03.models.RecommendedMachineConfiguration + :ivar disallowed: Describes the disallowed disk types. + :vartype disallowed: ~azure.mgmt.compute.v2022_01_03.models.Disallowed + :ivar purchase_plan: Describes the gallery image definition purchase plan. This is used by + marketplace images. + :vartype purchase_plan: ~azure.mgmt.compute.v2022_01_03.models.ImagePurchasePlan + :ivar provisioning_state: The provisioning state, which only appears in the response. Possible + values include: "Creating", "Updating", "Failed", "Succeeded", "Deleting", "Migrating". + :vartype provisioning_state: str or + ~azure.mgmt.compute.v2022_01_03.models.GalleryImagePropertiesProvisioningState + :ivar features: A list of gallery image features. + :vartype features: list[~azure.mgmt.compute.v2022_01_03.models.GalleryImageFeature] + :ivar architecture: The architecture of the image. Applicable to OS disks only. Possible values + include: "x64", "Arm64". + :vartype architecture: str or ~azure.mgmt.compute.v2022_01_03.models.Architecture + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'eula': {'key': 'properties.eula', 'type': 'str'}, + 'privacy_statement_uri': {'key': 'properties.privacyStatementUri', 'type': 'str'}, + 'release_note_uri': {'key': 'properties.releaseNoteUri', 'type': 'str'}, + 'os_type': {'key': 'properties.osType', 'type': 'str'}, + 'os_state': {'key': 'properties.osState', 'type': 'str'}, + 'hyper_v_generation': {'key': 'properties.hyperVGeneration', 'type': 'str'}, + 'end_of_life_date': {'key': 'properties.endOfLifeDate', 'type': 'iso-8601'}, + 'identifier': {'key': 'properties.identifier', 'type': 'GalleryImageIdentifier'}, + 'recommended': {'key': 'properties.recommended', 'type': 'RecommendedMachineConfiguration'}, + 'disallowed': {'key': 'properties.disallowed', 'type': 'Disallowed'}, + 'purchase_plan': {'key': 'properties.purchasePlan', 'type': 'ImagePurchasePlan'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'features': {'key': 'properties.features', 'type': '[GalleryImageFeature]'}, + 'architecture': {'key': 'properties.architecture', 'type': 'str'}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + description: Optional[str] = None, + eula: Optional[str] = None, + privacy_statement_uri: Optional[str] = None, + release_note_uri: Optional[str] = None, + os_type: Optional[Union[str, "OperatingSystemTypes"]] = None, + os_state: Optional[Union[str, "OperatingSystemStateTypes"]] = None, + hyper_v_generation: Optional[Union[str, "HyperVGeneration"]] = None, + end_of_life_date: Optional[datetime.datetime] = None, + identifier: Optional["GalleryImageIdentifier"] = None, + recommended: Optional["RecommendedMachineConfiguration"] = None, + disallowed: Optional["Disallowed"] = None, + purchase_plan: Optional["ImagePurchasePlan"] = None, + features: Optional[List["GalleryImageFeature"]] = None, + architecture: Optional[Union[str, "Architecture"]] = None, + **kwargs + ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword description: The description of this gallery image definition resource. This property + is updatable. + :paramtype description: str + :keyword eula: The Eula agreement for the gallery image definition. + :paramtype eula: str + :keyword privacy_statement_uri: The privacy statement uri. + :paramtype privacy_statement_uri: str + :keyword release_note_uri: The release note uri. + :paramtype release_note_uri: str + :keyword os_type: This property allows you to specify the type of the OS that is included in + the disk when creating a VM from a managed image. :code:`
`:code:`
` Possible values are: + :code:`
`:code:`
` **Windows** :code:`
`:code:`
` **Linux**. Possible values + include: "Windows", "Linux". + :paramtype os_type: str or ~azure.mgmt.compute.v2022_01_03.models.OperatingSystemTypes + :keyword os_state: This property allows the user to specify whether the virtual machines + created under this image are 'Generalized' or 'Specialized'. Possible values include: + "Generalized", "Specialized". + :paramtype os_state: str or ~azure.mgmt.compute.v2022_01_03.models.OperatingSystemStateTypes + :keyword hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS + disks only. Possible values include: "V1", "V2". + :paramtype hyper_v_generation: str or ~azure.mgmt.compute.v2022_01_03.models.HyperVGeneration + :keyword end_of_life_date: The end of life date of the gallery image definition. This property + can be used for decommissioning purposes. This property is updatable. + :paramtype end_of_life_date: ~datetime.datetime + :keyword identifier: This is the gallery image definition identifier. + :paramtype identifier: ~azure.mgmt.compute.v2022_01_03.models.GalleryImageIdentifier + :keyword recommended: The properties describe the recommended machine configuration for this + Image Definition. These properties are updatable. + :paramtype recommended: ~azure.mgmt.compute.v2022_01_03.models.RecommendedMachineConfiguration + :keyword disallowed: Describes the disallowed disk types. + :paramtype disallowed: ~azure.mgmt.compute.v2022_01_03.models.Disallowed + :keyword purchase_plan: Describes the gallery image definition purchase plan. This is used by + marketplace images. + :paramtype purchase_plan: ~azure.mgmt.compute.v2022_01_03.models.ImagePurchasePlan + :keyword features: A list of gallery image features. + :paramtype features: list[~azure.mgmt.compute.v2022_01_03.models.GalleryImageFeature] + :keyword architecture: The architecture of the image. Applicable to OS disks only. Possible + values include: "x64", "Arm64". + :paramtype architecture: str or ~azure.mgmt.compute.v2022_01_03.models.Architecture + """ + super(GalleryImageUpdate, self).__init__(tags=tags, **kwargs) + self.description = description + self.eula = eula + self.privacy_statement_uri = privacy_statement_uri + self.release_note_uri = release_note_uri + self.os_type = os_type + self.os_state = os_state + self.hyper_v_generation = hyper_v_generation + self.end_of_life_date = end_of_life_date + self.identifier = identifier + self.recommended = recommended + self.disallowed = disallowed + self.purchase_plan = purchase_plan + self.provisioning_state = None + self.features = features + self.architecture = architecture + + +class GalleryImageVersion(Resource): + """Specifies information about the gallery image version that you want to create or update. + + 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 + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar publishing_profile: The publishing profile of a gallery image Version. + :vartype publishing_profile: + ~azure.mgmt.compute.v2022_01_03.models.GalleryImageVersionPublishingProfile + :ivar provisioning_state: The provisioning state, which only appears in the response. Possible + values include: "Creating", "Updating", "Failed", "Succeeded", "Deleting", "Migrating". + :vartype provisioning_state: str or + ~azure.mgmt.compute.v2022_01_03.models.GalleryImageVersionPropertiesProvisioningState + :ivar storage_profile: This is the storage profile of a Gallery Image Version. + :vartype storage_profile: + ~azure.mgmt.compute.v2022_01_03.models.GalleryImageVersionStorageProfile + :ivar replication_status: This is the replication status of the gallery image version. + :vartype replication_status: ~azure.mgmt.compute.v2022_01_03.models.ReplicationStatus + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'provisioning_state': {'readonly': True}, + 'replication_status': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'publishing_profile': {'key': 'properties.publishingProfile', 'type': 'GalleryImageVersionPublishingProfile'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'storage_profile': {'key': 'properties.storageProfile', 'type': 'GalleryImageVersionStorageProfile'}, + 'replication_status': {'key': 'properties.replicationStatus', 'type': 'ReplicationStatus'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + publishing_profile: Optional["GalleryImageVersionPublishingProfile"] = None, + storage_profile: Optional["GalleryImageVersionStorageProfile"] = None, + **kwargs + ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword publishing_profile: The publishing profile of a gallery image Version. + :paramtype publishing_profile: + ~azure.mgmt.compute.v2022_01_03.models.GalleryImageVersionPublishingProfile + :keyword storage_profile: This is the storage profile of a Gallery Image Version. + :paramtype storage_profile: + ~azure.mgmt.compute.v2022_01_03.models.GalleryImageVersionStorageProfile + """ + super(GalleryImageVersion, self).__init__(location=location, tags=tags, **kwargs) + self.publishing_profile = publishing_profile + self.provisioning_state = None + self.storage_profile = storage_profile + self.replication_status = None + + +class GalleryImageVersionList(msrest.serialization.Model): + """The List Gallery Image version operation response. + + All required parameters must be populated in order to send to Azure. + + :ivar value: Required. A list of gallery image versions. + :vartype value: list[~azure.mgmt.compute.v2022_01_03.models.GalleryImageVersion] + :ivar next_link: The uri to fetch the next page of gallery image versions. Call ListNext() with + this to fetch the next page of gallery image versions. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[GalleryImageVersion]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["GalleryImageVersion"], + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: Required. A list of gallery image versions. + :paramtype value: list[~azure.mgmt.compute.v2022_01_03.models.GalleryImageVersion] + :keyword next_link: The uri to fetch the next page of gallery image versions. Call ListNext() + with this to fetch the next page of gallery image versions. + :paramtype next_link: str + """ + super(GalleryImageVersionList, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class GalleryImageVersionPublishingProfile(GalleryArtifactPublishingProfileBase): + """The publishing profile of a gallery image Version. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar target_regions: The target regions where the Image Version is going to be replicated to. + This property is updatable. + :vartype target_regions: list[~azure.mgmt.compute.v2022_01_03.models.TargetRegion] + :ivar replica_count: The number of replicas of the Image Version to be created per region. This + property would take effect for a region when regionalReplicaCount is not specified. This + property is updatable. + :vartype replica_count: int + :ivar exclude_from_latest: If set to true, Virtual Machines deployed from the latest version of + the Image Definition won't use this Image Version. + :vartype exclude_from_latest: bool + :ivar published_date: The timestamp for when the gallery image version is published. + :vartype published_date: ~datetime.datetime + :ivar end_of_life_date: The end of life date of the gallery image version. This property can be + used for decommissioning purposes. This property is updatable. + :vartype end_of_life_date: ~datetime.datetime + :ivar storage_account_type: Specifies the storage account type to be used to store the image. + This property is not updatable. Possible values include: "Standard_LRS", "Standard_ZRS", + "Premium_LRS". + :vartype storage_account_type: str or ~azure.mgmt.compute.v2022_01_03.models.StorageAccountType + :ivar replication_mode: Optional parameter which specifies the mode to be used for replication. + This property is not updatable. Possible values include: "Full", "Shallow". + :vartype replication_mode: str or ~azure.mgmt.compute.v2022_01_03.models.ReplicationMode + :ivar target_extended_locations: The target extended locations where the Image Version is going + to be replicated to. This property is updatable. + :vartype target_extended_locations: + list[~azure.mgmt.compute.v2022_01_03.models.GalleryTargetExtendedLocation] + """ + + _validation = { + 'published_date': {'readonly': True}, + } + + _attribute_map = { + 'target_regions': {'key': 'targetRegions', 'type': '[TargetRegion]'}, + 'replica_count': {'key': 'replicaCount', 'type': 'int'}, + 'exclude_from_latest': {'key': 'excludeFromLatest', 'type': 'bool'}, + 'published_date': {'key': 'publishedDate', 'type': 'iso-8601'}, + 'end_of_life_date': {'key': 'endOfLifeDate', 'type': 'iso-8601'}, + 'storage_account_type': {'key': 'storageAccountType', 'type': 'str'}, + 'replication_mode': {'key': 'replicationMode', 'type': 'str'}, + 'target_extended_locations': {'key': 'targetExtendedLocations', 'type': '[GalleryTargetExtendedLocation]'}, + } + + def __init__( + self, + *, + target_regions: Optional[List["TargetRegion"]] = None, + replica_count: Optional[int] = None, + exclude_from_latest: Optional[bool] = None, + end_of_life_date: Optional[datetime.datetime] = None, + storage_account_type: Optional[Union[str, "StorageAccountType"]] = None, + replication_mode: Optional[Union[str, "ReplicationMode"]] = None, + target_extended_locations: Optional[List["GalleryTargetExtendedLocation"]] = None, + **kwargs + ): + """ + :keyword target_regions: The target regions where the Image Version is going to be replicated + to. This property is updatable. + :paramtype target_regions: list[~azure.mgmt.compute.v2022_01_03.models.TargetRegion] + :keyword replica_count: The number of replicas of the Image Version to be created per region. + This property would take effect for a region when regionalReplicaCount is not specified. This + property is updatable. + :paramtype replica_count: int + :keyword exclude_from_latest: If set to true, Virtual Machines deployed from the latest version + of the Image Definition won't use this Image Version. + :paramtype exclude_from_latest: bool + :keyword end_of_life_date: The end of life date of the gallery image version. This property can + be used for decommissioning purposes. This property is updatable. + :paramtype end_of_life_date: ~datetime.datetime + :keyword storage_account_type: Specifies the storage account type to be used to store the + image. This property is not updatable. Possible values include: "Standard_LRS", "Standard_ZRS", + "Premium_LRS". + :paramtype storage_account_type: str or + ~azure.mgmt.compute.v2022_01_03.models.StorageAccountType + :keyword replication_mode: Optional parameter which specifies the mode to be used for + replication. This property is not updatable. Possible values include: "Full", "Shallow". + :paramtype replication_mode: str or ~azure.mgmt.compute.v2022_01_03.models.ReplicationMode + :keyword target_extended_locations: The target extended locations where the Image Version is + going to be replicated to. This property is updatable. + :paramtype target_extended_locations: + list[~azure.mgmt.compute.v2022_01_03.models.GalleryTargetExtendedLocation] + """ + super(GalleryImageVersionPublishingProfile, 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, replication_mode=replication_mode, target_extended_locations=target_extended_locations, **kwargs) + + +class GalleryImageVersionStorageProfile(msrest.serialization.Model): + """This is the storage profile of a Gallery Image Version. + + :ivar source: The gallery artifact version source. + :vartype source: ~azure.mgmt.compute.v2022_01_03.models.GalleryArtifactVersionSource + :ivar os_disk_image: This is the OS disk image. + :vartype os_disk_image: ~azure.mgmt.compute.v2022_01_03.models.GalleryOSDiskImage + :ivar data_disk_images: A list of data disk images. + :vartype data_disk_images: list[~azure.mgmt.compute.v2022_01_03.models.GalleryDataDiskImage] + """ + + _attribute_map = { + 'source': {'key': 'source', 'type': 'GalleryArtifactVersionSource'}, + 'os_disk_image': {'key': 'osDiskImage', 'type': 'GalleryOSDiskImage'}, + 'data_disk_images': {'key': 'dataDiskImages', 'type': '[GalleryDataDiskImage]'}, + } + + def __init__( + self, + *, + source: Optional["GalleryArtifactVersionSource"] = None, + os_disk_image: Optional["GalleryOSDiskImage"] = None, + data_disk_images: Optional[List["GalleryDataDiskImage"]] = None, + **kwargs + ): + """ + :keyword source: The gallery artifact version source. + :paramtype source: ~azure.mgmt.compute.v2022_01_03.models.GalleryArtifactVersionSource + :keyword os_disk_image: This is the OS disk image. + :paramtype os_disk_image: ~azure.mgmt.compute.v2022_01_03.models.GalleryOSDiskImage + :keyword data_disk_images: A list of data disk images. + :paramtype data_disk_images: list[~azure.mgmt.compute.v2022_01_03.models.GalleryDataDiskImage] + """ + super(GalleryImageVersionStorageProfile, self).__init__(**kwargs) + self.source = source + self.os_disk_image = os_disk_image + self.data_disk_images = data_disk_images + + +class GalleryImageVersionUpdate(UpdateResourceDefinition): + """Specifies information about the gallery image version that you want to update. + + 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 tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar publishing_profile: The publishing profile of a gallery image Version. + :vartype publishing_profile: + ~azure.mgmt.compute.v2022_01_03.models.GalleryImageVersionPublishingProfile + :ivar provisioning_state: The provisioning state, which only appears in the response. Possible + values include: "Creating", "Updating", "Failed", "Succeeded", "Deleting", "Migrating". + :vartype provisioning_state: str or + ~azure.mgmt.compute.v2022_01_03.models.GalleryImageVersionPropertiesProvisioningState + :ivar storage_profile: This is the storage profile of a Gallery Image Version. + :vartype storage_profile: + ~azure.mgmt.compute.v2022_01_03.models.GalleryImageVersionStorageProfile + :ivar replication_status: This is the replication status of the gallery image version. + :vartype replication_status: ~azure.mgmt.compute.v2022_01_03.models.ReplicationStatus + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'replication_status': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'publishing_profile': {'key': 'properties.publishingProfile', 'type': 'GalleryImageVersionPublishingProfile'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'storage_profile': {'key': 'properties.storageProfile', 'type': 'GalleryImageVersionStorageProfile'}, + 'replication_status': {'key': 'properties.replicationStatus', 'type': 'ReplicationStatus'}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + publishing_profile: Optional["GalleryImageVersionPublishingProfile"] = None, + storage_profile: Optional["GalleryImageVersionStorageProfile"] = None, + **kwargs + ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword publishing_profile: The publishing profile of a gallery image Version. + :paramtype publishing_profile: + ~azure.mgmt.compute.v2022_01_03.models.GalleryImageVersionPublishingProfile + :keyword storage_profile: This is the storage profile of a Gallery Image Version. + :paramtype storage_profile: + ~azure.mgmt.compute.v2022_01_03.models.GalleryImageVersionStorageProfile + """ + super(GalleryImageVersionUpdate, self).__init__(tags=tags, **kwargs) + self.publishing_profile = publishing_profile + self.provisioning_state = None + self.storage_profile = storage_profile + self.replication_status = None + + +class GalleryList(msrest.serialization.Model): + """The List Galleries operation response. + + All required parameters must be populated in order to send to Azure. + + :ivar value: Required. A list of galleries. + :vartype value: list[~azure.mgmt.compute.v2022_01_03.models.Gallery] + :ivar next_link: The uri to fetch the next page of galleries. Call ListNext() with this to + fetch the next page of galleries. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Gallery]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["Gallery"], + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: Required. A list of galleries. + :paramtype value: list[~azure.mgmt.compute.v2022_01_03.models.Gallery] + :keyword next_link: The uri to fetch the next page of galleries. Call ListNext() with this to + fetch the next page of galleries. + :paramtype next_link: str + """ + super(GalleryList, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class GalleryOSDiskImage(GalleryDiskImage): + """This is the OS disk image. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar size_in_gb: This property indicates the size of the VHD to be created. + :vartype size_in_gb: int + :ivar host_caching: The host caching of the disk. Valid values are 'None', 'ReadOnly', and + 'ReadWrite'. Possible values include: "None", "ReadOnly", "ReadWrite". + :vartype host_caching: str or ~azure.mgmt.compute.v2022_01_03.models.HostCaching + :ivar source: The gallery artifact version source. + :vartype source: ~azure.mgmt.compute.v2022_01_03.models.GalleryArtifactVersionSource + """ + + _validation = { + 'size_in_gb': {'readonly': True}, + } + + _attribute_map = { + 'size_in_gb': {'key': 'sizeInGB', 'type': 'int'}, + 'host_caching': {'key': 'hostCaching', 'type': 'str'}, + 'source': {'key': 'source', 'type': 'GalleryArtifactVersionSource'}, + } + + def __init__( + self, + *, + host_caching: Optional[Union[str, "HostCaching"]] = None, + source: Optional["GalleryArtifactVersionSource"] = None, + **kwargs + ): + """ + :keyword host_caching: The host caching of the disk. Valid values are 'None', 'ReadOnly', and + 'ReadWrite'. Possible values include: "None", "ReadOnly", "ReadWrite". + :paramtype host_caching: str or ~azure.mgmt.compute.v2022_01_03.models.HostCaching + :keyword source: The gallery artifact version source. + :paramtype source: ~azure.mgmt.compute.v2022_01_03.models.GalleryArtifactVersionSource + """ + super(GalleryOSDiskImage, self).__init__(host_caching=host_caching, source=source, **kwargs) + + +class GalleryTargetExtendedLocation(msrest.serialization.Model): + """GalleryTargetExtendedLocation. + + :ivar name: The name of the region. + :vartype name: str + :ivar extended_location: The name of the extended location. + :vartype extended_location: ~azure.mgmt.compute.v2022_01_03.models.GalleryExtendedLocation + :ivar extended_location_replica_count: The number of replicas of the Image Version to be + created per extended location. This property is updatable. + :vartype extended_location_replica_count: int + :ivar storage_account_type: Specifies the storage account type to be used to store the image. + This property is not updatable. Possible values include: "Standard_LRS", "Standard_ZRS", + "Premium_LRS". + :vartype storage_account_type: str or ~azure.mgmt.compute.v2022_01_03.models.StorageAccountType + :ivar encryption: Optional. Allows users to provide customer managed keys for encrypting the OS + and data disks in the gallery artifact. + :vartype encryption: ~azure.mgmt.compute.v2022_01_03.models.EncryptionImages + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'extended_location': {'key': 'extendedLocation', 'type': 'GalleryExtendedLocation'}, + 'extended_location_replica_count': {'key': 'extendedLocationReplicaCount', 'type': 'int'}, + 'storage_account_type': {'key': 'storageAccountType', 'type': 'str'}, + 'encryption': {'key': 'encryption', 'type': 'EncryptionImages'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + extended_location: Optional["GalleryExtendedLocation"] = None, + extended_location_replica_count: Optional[int] = None, + storage_account_type: Optional[Union[str, "StorageAccountType"]] = None, + encryption: Optional["EncryptionImages"] = None, + **kwargs + ): + """ + :keyword name: The name of the region. + :paramtype name: str + :keyword extended_location: The name of the extended location. + :paramtype extended_location: ~azure.mgmt.compute.v2022_01_03.models.GalleryExtendedLocation + :keyword extended_location_replica_count: The number of replicas of the Image Version to be + created per extended location. This property is updatable. + :paramtype extended_location_replica_count: int + :keyword storage_account_type: Specifies the storage account type to be used to store the + image. This property is not updatable. Possible values include: "Standard_LRS", "Standard_ZRS", + "Premium_LRS". + :paramtype storage_account_type: str or + ~azure.mgmt.compute.v2022_01_03.models.StorageAccountType + :keyword encryption: Optional. Allows users to provide customer managed keys for encrypting the + OS and data disks in the gallery artifact. + :paramtype encryption: ~azure.mgmt.compute.v2022_01_03.models.EncryptionImages + """ + super(GalleryTargetExtendedLocation, self).__init__(**kwargs) + self.name = name + self.extended_location = extended_location + self.extended_location_replica_count = extended_location_replica_count + self.storage_account_type = storage_account_type + self.encryption = encryption + + +class GalleryUpdate(UpdateResourceDefinition): + """Specifies information about the Shared Image Gallery that you want to update. + + 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 tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar description: The description of this Shared Image Gallery resource. This property is + updatable. + :vartype description: str + :ivar identifier: Describes the gallery unique name. + :vartype identifier: ~azure.mgmt.compute.v2022_01_03.models.GalleryIdentifier + :ivar provisioning_state: The provisioning state, which only appears in the response. Possible + values include: "Creating", "Updating", "Failed", "Succeeded", "Deleting", "Migrating". + :vartype provisioning_state: str or + ~azure.mgmt.compute.v2022_01_03.models.GalleryPropertiesProvisioningState + :ivar sharing_profile: Profile for gallery sharing to subscription or tenant. + :vartype sharing_profile: ~azure.mgmt.compute.v2022_01_03.models.SharingProfile + :ivar soft_delete_policy: Contains information about the soft deletion policy of the gallery. + :vartype soft_delete_policy: ~azure.mgmt.compute.v2022_01_03.models.SoftDeletePolicy + :ivar sharing_status: Sharing status of current gallery. + :vartype sharing_status: ~azure.mgmt.compute.v2022_01_03.models.SharingStatus + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'sharing_status': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'identifier': {'key': 'properties.identifier', 'type': 'GalleryIdentifier'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'sharing_profile': {'key': 'properties.sharingProfile', 'type': 'SharingProfile'}, + 'soft_delete_policy': {'key': 'properties.softDeletePolicy', 'type': 'SoftDeletePolicy'}, + 'sharing_status': {'key': 'properties.sharingStatus', 'type': 'SharingStatus'}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + description: Optional[str] = None, + identifier: Optional["GalleryIdentifier"] = None, + sharing_profile: Optional["SharingProfile"] = None, + soft_delete_policy: Optional["SoftDeletePolicy"] = None, + **kwargs + ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword description: The description of this Shared Image Gallery resource. This property is + updatable. + :paramtype description: str + :keyword identifier: Describes the gallery unique name. + :paramtype identifier: ~azure.mgmt.compute.v2022_01_03.models.GalleryIdentifier + :keyword sharing_profile: Profile for gallery sharing to subscription or tenant. + :paramtype sharing_profile: ~azure.mgmt.compute.v2022_01_03.models.SharingProfile + :keyword soft_delete_policy: Contains information about the soft deletion policy of the + gallery. + :paramtype soft_delete_policy: ~azure.mgmt.compute.v2022_01_03.models.SoftDeletePolicy + """ + super(GalleryUpdate, self).__init__(tags=tags, **kwargs) + self.description = description + self.identifier = identifier + self.provisioning_state = None + self.sharing_profile = sharing_profile + self.soft_delete_policy = soft_delete_policy + self.sharing_status = None + + +class ImagePurchasePlan(msrest.serialization.Model): + """Describes the gallery image definition purchase plan. This is used by marketplace images. + + :ivar name: The plan ID. + :vartype name: str + :ivar publisher: The publisher ID. + :vartype publisher: str + :ivar product: The product ID. + :vartype product: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'publisher': {'key': 'publisher', 'type': 'str'}, + 'product': {'key': 'product', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + publisher: Optional[str] = None, + product: Optional[str] = None, + **kwargs + ): + """ + :keyword name: The plan ID. + :paramtype name: str + :keyword publisher: The publisher ID. + :paramtype publisher: str + :keyword product: The product ID. + :paramtype product: str + """ + super(ImagePurchasePlan, self).__init__(**kwargs) + self.name = name + self.publisher = publisher + self.product = product + + +class InnerError(msrest.serialization.Model): + """Inner error details. + + :ivar exceptiontype: The exception type. + :vartype exceptiontype: str + :ivar errordetail: The internal error message or exception dump. + :vartype 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 + ): + """ + :keyword exceptiontype: The exception type. + :paramtype exceptiontype: str + :keyword errordetail: The internal error message or exception dump. + :paramtype errordetail: str + """ + super(InnerError, self).__init__(**kwargs) + self.exceptiontype = exceptiontype + self.errordetail = errordetail + + +class ManagedArtifact(msrest.serialization.Model): + """The managed artifact. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Required. The managed artifact id. + :vartype id: str + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + *, + id: str, + **kwargs + ): + """ + :keyword id: Required. The managed artifact id. + :paramtype id: str + """ + super(ManagedArtifact, self).__init__(**kwargs) + self.id = id + + +class OSDiskImageEncryption(DiskImageEncryption): + """Contains encryption settings for an OS disk image. + + :ivar disk_encryption_set_id: A relative URI containing the resource ID of the disk encryption + set. + :vartype disk_encryption_set_id: str + :ivar security_profile: This property specifies the security profile of an OS disk image. + :vartype security_profile: ~azure.mgmt.compute.v2022_01_03.models.OSDiskImageSecurityProfile + """ + + _attribute_map = { + 'disk_encryption_set_id': {'key': 'diskEncryptionSetId', 'type': 'str'}, + 'security_profile': {'key': 'securityProfile', 'type': 'OSDiskImageSecurityProfile'}, + } + + def __init__( + self, + *, + disk_encryption_set_id: Optional[str] = None, + security_profile: Optional["OSDiskImageSecurityProfile"] = None, + **kwargs + ): + """ + :keyword disk_encryption_set_id: A relative URI containing the resource ID of the disk + encryption set. + :paramtype disk_encryption_set_id: str + :keyword security_profile: This property specifies the security profile of an OS disk image. + :paramtype security_profile: ~azure.mgmt.compute.v2022_01_03.models.OSDiskImageSecurityProfile + """ + super(OSDiskImageEncryption, self).__init__(disk_encryption_set_id=disk_encryption_set_id, **kwargs) + self.security_profile = security_profile + + +class OSDiskImageSecurityProfile(msrest.serialization.Model): + """Contains security profile for an OS disk image. + + :ivar confidential_vm_encryption_type: confidential VM encryption types. Possible values + include: "EncryptedVMGuestStateOnlyWithPmk", "EncryptedWithPmk", "EncryptedWithCmk". + :vartype confidential_vm_encryption_type: str or + ~azure.mgmt.compute.v2022_01_03.models.ConfidentialVMEncryptionType + :ivar secure_vm_disk_encryption_set_id: secure VM disk encryption set id. + :vartype secure_vm_disk_encryption_set_id: str + """ + + _attribute_map = { + 'confidential_vm_encryption_type': {'key': 'confidentialVMEncryptionType', 'type': 'str'}, + 'secure_vm_disk_encryption_set_id': {'key': 'secureVMDiskEncryptionSetId', 'type': 'str'}, + } + + def __init__( + self, + *, + confidential_vm_encryption_type: Optional[Union[str, "ConfidentialVMEncryptionType"]] = None, + secure_vm_disk_encryption_set_id: Optional[str] = None, + **kwargs + ): + """ + :keyword confidential_vm_encryption_type: confidential VM encryption types. Possible values + include: "EncryptedVMGuestStateOnlyWithPmk", "EncryptedWithPmk", "EncryptedWithCmk". + :paramtype confidential_vm_encryption_type: str or + ~azure.mgmt.compute.v2022_01_03.models.ConfidentialVMEncryptionType + :keyword secure_vm_disk_encryption_set_id: secure VM disk encryption set id. + :paramtype secure_vm_disk_encryption_set_id: str + """ + super(OSDiskImageSecurityProfile, self).__init__(**kwargs) + self.confidential_vm_encryption_type = confidential_vm_encryption_type + self.secure_vm_disk_encryption_set_id = secure_vm_disk_encryption_set_id + + +class PirResource(msrest.serialization.Model): + """The Resource model definition. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Resource name. + :vartype name: str + :ivar location: Resource location. + :vartype location: str + """ + + _validation = { + 'name': {'readonly': True}, + 'location': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(PirResource, self).__init__(**kwargs) + self.name = None + self.location = None + + +class PirSharedGalleryResource(PirResource): + """Base information about the shared gallery resource in pir. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Resource name. + :vartype name: str + :ivar location: Resource location. + :vartype location: str + :ivar unique_id: The unique id of this shared gallery. + :vartype unique_id: str + """ + + _validation = { + 'name': {'readonly': True}, + 'location': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'unique_id': {'key': 'identifier.uniqueId', 'type': 'str'}, + } + + def __init__( + self, + *, + unique_id: Optional[str] = None, + **kwargs + ): + """ + :keyword unique_id: The unique id of this shared gallery. + :paramtype unique_id: str + """ + super(PirSharedGalleryResource, self).__init__(**kwargs) + self.unique_id = unique_id + + +class RecommendedMachineConfiguration(msrest.serialization.Model): + """The properties describe the recommended machine configuration for this Image Definition. These properties are updatable. + + :ivar v_cp_us: Describes the resource range. + :vartype v_cp_us: ~azure.mgmt.compute.v2022_01_03.models.ResourceRange + :ivar memory: Describes the resource range. + :vartype memory: ~azure.mgmt.compute.v2022_01_03.models.ResourceRange + """ + + _attribute_map = { + 'v_cp_us': {'key': 'vCPUs', 'type': 'ResourceRange'}, + 'memory': {'key': 'memory', 'type': 'ResourceRange'}, + } + + def __init__( + self, + *, + v_cp_us: Optional["ResourceRange"] = None, + memory: Optional["ResourceRange"] = None, + **kwargs + ): + """ + :keyword v_cp_us: Describes the resource range. + :paramtype v_cp_us: ~azure.mgmt.compute.v2022_01_03.models.ResourceRange + :keyword memory: Describes the resource range. + :paramtype memory: ~azure.mgmt.compute.v2022_01_03.models.ResourceRange + """ + super(RecommendedMachineConfiguration, self).__init__(**kwargs) + self.v_cp_us = v_cp_us + self.memory = memory + + +class RegionalReplicationStatus(msrest.serialization.Model): + """This is the regional replication status. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar region: The region to which the gallery image version is being replicated to. + :vartype region: str + :ivar state: This is the regional replication state. Possible values include: "Unknown", + "Replicating", "Completed", "Failed". + :vartype state: str or ~azure.mgmt.compute.v2022_01_03.models.ReplicationState + :ivar details: The details of the replication status. + :vartype details: str + :ivar progress: It indicates progress of the replication job. + :vartype progress: int + """ + + _validation = { + 'region': {'readonly': True}, + 'state': {'readonly': True}, + 'details': {'readonly': True}, + 'progress': {'readonly': True}, + } + + _attribute_map = { + 'region': {'key': 'region', 'type': 'str'}, + 'state': {'key': 'state', 'type': 'str'}, + 'details': {'key': 'details', 'type': 'str'}, + 'progress': {'key': 'progress', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(RegionalReplicationStatus, self).__init__(**kwargs) + self.region = None + self.state = None + self.details = None + self.progress = None + + +class RegionalSharingStatus(msrest.serialization.Model): + """Gallery regional sharing status. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar region: Region name. + :vartype region: str + :ivar state: Gallery sharing state in current region. Possible values include: "Succeeded", + "InProgress", "Failed", "Unknown". + :vartype state: str or ~azure.mgmt.compute.v2022_01_03.models.SharingState + :ivar details: Details of gallery regional sharing failure. + :vartype details: str + """ + + _validation = { + 'state': {'readonly': True}, + } + + _attribute_map = { + 'region': {'key': 'region', 'type': 'str'}, + 'state': {'key': 'state', 'type': 'str'}, + 'details': {'key': 'details', 'type': 'str'}, + } + + def __init__( + self, + *, + region: Optional[str] = None, + details: Optional[str] = None, + **kwargs + ): + """ + :keyword region: Region name. + :paramtype region: str + :keyword details: Details of gallery regional sharing failure. + :paramtype details: str + """ + super(RegionalSharingStatus, self).__init__(**kwargs) + self.region = region + self.state = None + self.details = details + + +class ReplicationStatus(msrest.serialization.Model): + """This is the replication status of the gallery image version. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar aggregated_state: This is the aggregated replication status based on all the regional + replication status flags. Possible values include: "Unknown", "InProgress", "Completed", + "Failed". + :vartype aggregated_state: str or + ~azure.mgmt.compute.v2022_01_03.models.AggregatedReplicationState + :ivar summary: This is a summary of replication status for each region. + :vartype summary: list[~azure.mgmt.compute.v2022_01_03.models.RegionalReplicationStatus] + """ + + _validation = { + 'aggregated_state': {'readonly': True}, + 'summary': {'readonly': True}, + } + + _attribute_map = { + 'aggregated_state': {'key': 'aggregatedState', 'type': 'str'}, + 'summary': {'key': 'summary', 'type': '[RegionalReplicationStatus]'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ReplicationStatus, self).__init__(**kwargs) + self.aggregated_state = None + self.summary = None + + +class ResourceRange(msrest.serialization.Model): + """Describes the resource range. + + :ivar min: The minimum number of the resource. + :vartype min: int + :ivar max: The maximum number of the resource. + :vartype max: int + """ + + _attribute_map = { + 'min': {'key': 'min', 'type': 'int'}, + 'max': {'key': 'max', 'type': 'int'}, + } + + def __init__( + self, + *, + min: Optional[int] = None, + max: Optional[int] = None, + **kwargs + ): + """ + :keyword min: The minimum number of the resource. + :paramtype min: int + :keyword max: The maximum number of the resource. + :paramtype max: int + """ + super(ResourceRange, self).__init__(**kwargs) + self.min = min + self.max = max + + +class SharedGallery(PirSharedGalleryResource): + """Specifies information about the Shared Gallery that you want to create or update. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Resource name. + :vartype name: str + :ivar location: Resource location. + :vartype location: str + :ivar unique_id: The unique id of this shared gallery. + :vartype unique_id: str + """ + + _validation = { + 'name': {'readonly': True}, + 'location': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'unique_id': {'key': 'identifier.uniqueId', 'type': 'str'}, + } + + def __init__( + self, + *, + unique_id: Optional[str] = None, + **kwargs + ): + """ + :keyword unique_id: The unique id of this shared gallery. + :paramtype unique_id: str + """ + super(SharedGallery, self).__init__(unique_id=unique_id, **kwargs) + + +class SharedGalleryDiskImage(msrest.serialization.Model): + """This is the disk image base class. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar disk_size_gb: This property indicates the size of the VHD to be created. + :vartype disk_size_gb: int + :ivar host_caching: The host caching of the disk. Valid values are 'None', 'ReadOnly', and + 'ReadWrite'. Possible values include: "None", "ReadOnly", "ReadWrite". + :vartype host_caching: str or ~azure.mgmt.compute.v2022_01_03.models.SharedGalleryHostCaching + """ + + _validation = { + 'disk_size_gb': {'readonly': True}, + } + + _attribute_map = { + 'disk_size_gb': {'key': 'diskSizeGB', 'type': 'int'}, + 'host_caching': {'key': 'hostCaching', 'type': 'str'}, + } + + def __init__( + self, + *, + host_caching: Optional[Union[str, "SharedGalleryHostCaching"]] = None, + **kwargs + ): + """ + :keyword host_caching: The host caching of the disk. Valid values are 'None', 'ReadOnly', and + 'ReadWrite'. Possible values include: "None", "ReadOnly", "ReadWrite". + :paramtype host_caching: str or ~azure.mgmt.compute.v2022_01_03.models.SharedGalleryHostCaching + """ + super(SharedGalleryDiskImage, self).__init__(**kwargs) + self.disk_size_gb = None + self.host_caching = host_caching + + +class SharedGalleryDataDiskImage(SharedGalleryDiskImage): + """This is the data disk image. + + 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 disk_size_gb: This property indicates the size of the VHD to be created. + :vartype disk_size_gb: int + :ivar host_caching: The host caching of the disk. Valid values are 'None', 'ReadOnly', and + 'ReadWrite'. Possible values include: "None", "ReadOnly", "ReadWrite". + :vartype host_caching: str or ~azure.mgmt.compute.v2022_01_03.models.SharedGalleryHostCaching + :ivar lun: Required. This property specifies the logical unit number of the data disk. This + value is used to identify data disks within the Virtual Machine and therefore must be unique + for each data disk attached to the Virtual Machine. + :vartype lun: int + """ + + _validation = { + 'disk_size_gb': {'readonly': True}, + 'lun': {'required': True}, + } + + _attribute_map = { + 'disk_size_gb': {'key': 'diskSizeGB', 'type': 'int'}, + 'host_caching': {'key': 'hostCaching', 'type': 'str'}, + 'lun': {'key': 'lun', 'type': 'int'}, + } + + def __init__( + self, + *, + lun: int, + host_caching: Optional[Union[str, "SharedGalleryHostCaching"]] = None, + **kwargs + ): + """ + :keyword host_caching: The host caching of the disk. Valid values are 'None', 'ReadOnly', and + 'ReadWrite'. Possible values include: "None", "ReadOnly", "ReadWrite". + :paramtype host_caching: str or ~azure.mgmt.compute.v2022_01_03.models.SharedGalleryHostCaching + :keyword lun: Required. This property specifies the logical unit number of the data disk. This + value is used to identify data disks within the Virtual Machine and therefore must be unique + for each data disk attached to the Virtual Machine. + :paramtype lun: int + """ + super(SharedGalleryDataDiskImage, self).__init__(host_caching=host_caching, **kwargs) + self.lun = lun + + +class SharedGalleryImage(PirSharedGalleryResource): + """Specifies information about the gallery image definition that you want to create or update. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Resource name. + :vartype name: str + :ivar location: Resource location. + :vartype location: str + :ivar unique_id: The unique id of this shared gallery. + :vartype unique_id: str + :ivar os_type: This property allows you to specify the type of the OS that is included in the + disk when creating a VM from a managed image. :code:`
`:code:`
` Possible values are: + :code:`
`:code:`
` **Windows** :code:`
`:code:`
` **Linux**. Possible values + include: "Windows", "Linux". + :vartype os_type: str or ~azure.mgmt.compute.v2022_01_03.models.OperatingSystemTypes + :ivar os_state: This property allows the user to specify whether the virtual machines created + under this image are 'Generalized' or 'Specialized'. Possible values include: "Generalized", + "Specialized". + :vartype os_state: str or ~azure.mgmt.compute.v2022_01_03.models.OperatingSystemStateTypes + :ivar end_of_life_date: The end of life date of the gallery image definition. This property can + be used for decommissioning purposes. This property is updatable. + :vartype end_of_life_date: ~datetime.datetime + :ivar identifier: This is the gallery image definition identifier. + :vartype identifier: ~azure.mgmt.compute.v2022_01_03.models.GalleryImageIdentifier + :ivar recommended: The properties describe the recommended machine configuration for this Image + Definition. These properties are updatable. + :vartype recommended: ~azure.mgmt.compute.v2022_01_03.models.RecommendedMachineConfiguration + :ivar disallowed: Describes the disallowed disk types. + :vartype disallowed: ~azure.mgmt.compute.v2022_01_03.models.Disallowed + :ivar hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS + disks only. Possible values include: "V1", "V2". + :vartype hyper_v_generation: str or ~azure.mgmt.compute.v2022_01_03.models.HyperVGeneration + :ivar features: A list of gallery image features. + :vartype features: list[~azure.mgmt.compute.v2022_01_03.models.GalleryImageFeature] + :ivar purchase_plan: Describes the gallery image definition purchase plan. This is used by + marketplace images. + :vartype purchase_plan: ~azure.mgmt.compute.v2022_01_03.models.ImagePurchasePlan + :ivar architecture: The architecture of the image. Applicable to OS disks only. Possible values + include: "x64", "Arm64". + :vartype architecture: str or ~azure.mgmt.compute.v2022_01_03.models.Architecture + """ + + _validation = { + 'name': {'readonly': True}, + 'location': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'unique_id': {'key': 'identifier.uniqueId', 'type': 'str'}, + 'os_type': {'key': 'properties.osType', 'type': 'str'}, + 'os_state': {'key': 'properties.osState', 'type': 'str'}, + 'end_of_life_date': {'key': 'properties.endOfLifeDate', 'type': 'iso-8601'}, + 'identifier': {'key': 'properties.identifier', 'type': 'GalleryImageIdentifier'}, + 'recommended': {'key': 'properties.recommended', 'type': 'RecommendedMachineConfiguration'}, + 'disallowed': {'key': 'properties.disallowed', 'type': 'Disallowed'}, + 'hyper_v_generation': {'key': 'properties.hyperVGeneration', 'type': 'str'}, + 'features': {'key': 'properties.features', 'type': '[GalleryImageFeature]'}, + 'purchase_plan': {'key': 'properties.purchasePlan', 'type': 'ImagePurchasePlan'}, + 'architecture': {'key': 'properties.architecture', 'type': 'str'}, + } + + def __init__( + self, + *, + unique_id: Optional[str] = None, + os_type: Optional[Union[str, "OperatingSystemTypes"]] = None, + os_state: Optional[Union[str, "OperatingSystemStateTypes"]] = None, + end_of_life_date: Optional[datetime.datetime] = None, + identifier: Optional["GalleryImageIdentifier"] = None, + recommended: Optional["RecommendedMachineConfiguration"] = None, + disallowed: Optional["Disallowed"] = None, + hyper_v_generation: Optional[Union[str, "HyperVGeneration"]] = None, + features: Optional[List["GalleryImageFeature"]] = None, + purchase_plan: Optional["ImagePurchasePlan"] = None, + architecture: Optional[Union[str, "Architecture"]] = None, + **kwargs + ): + """ + :keyword unique_id: The unique id of this shared gallery. + :paramtype unique_id: str + :keyword os_type: This property allows you to specify the type of the OS that is included in + the disk when creating a VM from a managed image. :code:`
`:code:`
` Possible values are: + :code:`
`:code:`
` **Windows** :code:`
`:code:`
` **Linux**. Possible values + include: "Windows", "Linux". + :paramtype os_type: str or ~azure.mgmt.compute.v2022_01_03.models.OperatingSystemTypes + :keyword os_state: This property allows the user to specify whether the virtual machines + created under this image are 'Generalized' or 'Specialized'. Possible values include: + "Generalized", "Specialized". + :paramtype os_state: str or ~azure.mgmt.compute.v2022_01_03.models.OperatingSystemStateTypes + :keyword end_of_life_date: The end of life date of the gallery image definition. This property + can be used for decommissioning purposes. This property is updatable. + :paramtype end_of_life_date: ~datetime.datetime + :keyword identifier: This is the gallery image definition identifier. + :paramtype identifier: ~azure.mgmt.compute.v2022_01_03.models.GalleryImageIdentifier + :keyword recommended: The properties describe the recommended machine configuration for this + Image Definition. These properties are updatable. + :paramtype recommended: ~azure.mgmt.compute.v2022_01_03.models.RecommendedMachineConfiguration + :keyword disallowed: Describes the disallowed disk types. + :paramtype disallowed: ~azure.mgmt.compute.v2022_01_03.models.Disallowed + :keyword hyper_v_generation: The hypervisor generation of the Virtual Machine. Applicable to OS + disks only. Possible values include: "V1", "V2". + :paramtype hyper_v_generation: str or ~azure.mgmt.compute.v2022_01_03.models.HyperVGeneration + :keyword features: A list of gallery image features. + :paramtype features: list[~azure.mgmt.compute.v2022_01_03.models.GalleryImageFeature] + :keyword purchase_plan: Describes the gallery image definition purchase plan. This is used by + marketplace images. + :paramtype purchase_plan: ~azure.mgmt.compute.v2022_01_03.models.ImagePurchasePlan + :keyword architecture: The architecture of the image. Applicable to OS disks only. Possible + values include: "x64", "Arm64". + :paramtype architecture: str or ~azure.mgmt.compute.v2022_01_03.models.Architecture + """ + super(SharedGalleryImage, self).__init__(unique_id=unique_id, **kwargs) + self.os_type = os_type + self.os_state = os_state + self.end_of_life_date = end_of_life_date + self.identifier = identifier + self.recommended = recommended + self.disallowed = disallowed + self.hyper_v_generation = hyper_v_generation + self.features = features + self.purchase_plan = purchase_plan + self.architecture = architecture + + +class SharedGalleryImageList(msrest.serialization.Model): + """The List Shared Gallery Images operation response. + + All required parameters must be populated in order to send to Azure. + + :ivar value: Required. A list of shared gallery images. + :vartype value: list[~azure.mgmt.compute.v2022_01_03.models.SharedGalleryImage] + :ivar next_link: The uri to fetch the next page of shared gallery images. Call ListNext() with + this to fetch the next page of shared gallery images. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SharedGalleryImage]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["SharedGalleryImage"], + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: Required. A list of shared gallery images. + :paramtype value: list[~azure.mgmt.compute.v2022_01_03.models.SharedGalleryImage] + :keyword next_link: The uri to fetch the next page of shared gallery images. Call ListNext() + with this to fetch the next page of shared gallery images. + :paramtype next_link: str + """ + super(SharedGalleryImageList, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class SharedGalleryImageVersion(PirSharedGalleryResource): + """Specifies information about the gallery image version that you want to create or update. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Resource name. + :vartype name: str + :ivar location: Resource location. + :vartype location: str + :ivar unique_id: The unique id of this shared gallery. + :vartype unique_id: str + :ivar published_date: The published date of the gallery image version Definition. This property + can be used for decommissioning purposes. This property is updatable. + :vartype published_date: ~datetime.datetime + :ivar end_of_life_date: The end of life date of the gallery image version Definition. This + property can be used for decommissioning purposes. This property is updatable. + :vartype end_of_life_date: ~datetime.datetime + :ivar exclude_from_latest: If set to true, Virtual Machines deployed from the latest version of + the Image Definition won't use this Image Version. + :vartype exclude_from_latest: bool + :ivar storage_profile: Describes the storage profile of the image version. + :vartype storage_profile: + ~azure.mgmt.compute.v2022_01_03.models.SharedGalleryImageVersionStorageProfile + """ + + _validation = { + 'name': {'readonly': True}, + 'location': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'unique_id': {'key': 'identifier.uniqueId', 'type': 'str'}, + 'published_date': {'key': 'properties.publishedDate', 'type': 'iso-8601'}, + 'end_of_life_date': {'key': 'properties.endOfLifeDate', 'type': 'iso-8601'}, + 'exclude_from_latest': {'key': 'properties.excludeFromLatest', 'type': 'bool'}, + 'storage_profile': {'key': 'properties.storageProfile', 'type': 'SharedGalleryImageVersionStorageProfile'}, + } + + def __init__( + self, + *, + unique_id: Optional[str] = None, + published_date: Optional[datetime.datetime] = None, + end_of_life_date: Optional[datetime.datetime] = None, + exclude_from_latest: Optional[bool] = None, + storage_profile: Optional["SharedGalleryImageVersionStorageProfile"] = None, + **kwargs + ): + """ + :keyword unique_id: The unique id of this shared gallery. + :paramtype unique_id: str + :keyword published_date: The published date of the gallery image version Definition. This + property can be used for decommissioning purposes. This property is updatable. + :paramtype published_date: ~datetime.datetime + :keyword end_of_life_date: The end of life date of the gallery image version Definition. This + property can be used for decommissioning purposes. This property is updatable. + :paramtype end_of_life_date: ~datetime.datetime + :keyword exclude_from_latest: If set to true, Virtual Machines deployed from the latest version + of the Image Definition won't use this Image Version. + :paramtype exclude_from_latest: bool + :keyword storage_profile: Describes the storage profile of the image version. + :paramtype storage_profile: + ~azure.mgmt.compute.v2022_01_03.models.SharedGalleryImageVersionStorageProfile + """ + super(SharedGalleryImageVersion, self).__init__(unique_id=unique_id, **kwargs) + self.published_date = published_date + self.end_of_life_date = end_of_life_date + self.exclude_from_latest = exclude_from_latest + self.storage_profile = storage_profile + + +class SharedGalleryImageVersionList(msrest.serialization.Model): + """The List Shared Gallery Image versions operation response. + + All required parameters must be populated in order to send to Azure. + + :ivar value: Required. A list of shared gallery images versions. + :vartype value: list[~azure.mgmt.compute.v2022_01_03.models.SharedGalleryImageVersion] + :ivar next_link: The uri to fetch the next page of shared gallery image versions. Call + ListNext() with this to fetch the next page of shared gallery image versions. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SharedGalleryImageVersion]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["SharedGalleryImageVersion"], + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: Required. A list of shared gallery images versions. + :paramtype value: list[~azure.mgmt.compute.v2022_01_03.models.SharedGalleryImageVersion] + :keyword next_link: The uri to fetch the next page of shared gallery image versions. Call + ListNext() with this to fetch the next page of shared gallery image versions. + :paramtype next_link: str + """ + super(SharedGalleryImageVersionList, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class SharedGalleryImageVersionStorageProfile(msrest.serialization.Model): + """This is the storage profile of a Gallery Image Version. + + :ivar os_disk_image: This is the OS disk image. + :vartype os_disk_image: ~azure.mgmt.compute.v2022_01_03.models.SharedGalleryOSDiskImage + :ivar data_disk_images: A list of data disk images. + :vartype data_disk_images: + list[~azure.mgmt.compute.v2022_01_03.models.SharedGalleryDataDiskImage] + """ + + _attribute_map = { + 'os_disk_image': {'key': 'osDiskImage', 'type': 'SharedGalleryOSDiskImage'}, + 'data_disk_images': {'key': 'dataDiskImages', 'type': '[SharedGalleryDataDiskImage]'}, + } + + def __init__( + self, + *, + os_disk_image: Optional["SharedGalleryOSDiskImage"] = None, + data_disk_images: Optional[List["SharedGalleryDataDiskImage"]] = None, + **kwargs + ): + """ + :keyword os_disk_image: This is the OS disk image. + :paramtype os_disk_image: ~azure.mgmt.compute.v2022_01_03.models.SharedGalleryOSDiskImage + :keyword data_disk_images: A list of data disk images. + :paramtype data_disk_images: + list[~azure.mgmt.compute.v2022_01_03.models.SharedGalleryDataDiskImage] + """ + super(SharedGalleryImageVersionStorageProfile, self).__init__(**kwargs) + self.os_disk_image = os_disk_image + self.data_disk_images = data_disk_images + + +class SharedGalleryList(msrest.serialization.Model): + """The List Shared Galleries operation response. + + All required parameters must be populated in order to send to Azure. + + :ivar value: Required. A list of shared galleries. + :vartype value: list[~azure.mgmt.compute.v2022_01_03.models.SharedGallery] + :ivar next_link: The uri to fetch the next page of shared galleries. Call ListNext() with this + to fetch the next page of shared galleries. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SharedGallery]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["SharedGallery"], + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: Required. A list of shared galleries. + :paramtype value: list[~azure.mgmt.compute.v2022_01_03.models.SharedGallery] + :keyword next_link: The uri to fetch the next page of shared galleries. Call ListNext() with + this to fetch the next page of shared galleries. + :paramtype next_link: str + """ + super(SharedGalleryList, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class SharedGalleryOSDiskImage(SharedGalleryDiskImage): + """This is the OS disk image. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar disk_size_gb: This property indicates the size of the VHD to be created. + :vartype disk_size_gb: int + :ivar host_caching: The host caching of the disk. Valid values are 'None', 'ReadOnly', and + 'ReadWrite'. Possible values include: "None", "ReadOnly", "ReadWrite". + :vartype host_caching: str or ~azure.mgmt.compute.v2022_01_03.models.SharedGalleryHostCaching + """ + + _validation = { + 'disk_size_gb': {'readonly': True}, + } + + _attribute_map = { + 'disk_size_gb': {'key': 'diskSizeGB', 'type': 'int'}, + 'host_caching': {'key': 'hostCaching', 'type': 'str'}, + } + + def __init__( + self, + *, + host_caching: Optional[Union[str, "SharedGalleryHostCaching"]] = None, + **kwargs + ): + """ + :keyword host_caching: The host caching of the disk. Valid values are 'None', 'ReadOnly', and + 'ReadWrite'. Possible values include: "None", "ReadOnly", "ReadWrite". + :paramtype host_caching: str or ~azure.mgmt.compute.v2022_01_03.models.SharedGalleryHostCaching + """ + super(SharedGalleryOSDiskImage, self).__init__(host_caching=host_caching, **kwargs) + + +class SharingProfile(msrest.serialization.Model): + """Profile for gallery sharing to subscription or tenant. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar permissions: This property allows you to specify the permission of sharing gallery. + :code:`
`:code:`
` Possible values are: :code:`
`:code:`
` **Private** + :code:`
`:code:`
` **Groups** :code:`
`:code:`
` **Community**. Possible values + include: "Private", "Groups", "Community". + :vartype permissions: str or + ~azure.mgmt.compute.v2022_01_03.models.GallerySharingPermissionTypes + :ivar groups: A list of sharing profile groups. + :vartype groups: list[~azure.mgmt.compute.v2022_01_03.models.SharingProfileGroup] + :ivar community_gallery_info: Information of community gallery if current gallery is shared to + community. + :vartype community_gallery_info: any + """ + + _validation = { + 'groups': {'readonly': True}, + } + + _attribute_map = { + 'permissions': {'key': 'permissions', 'type': 'str'}, + 'groups': {'key': 'groups', 'type': '[SharingProfileGroup]'}, + 'community_gallery_info': {'key': 'communityGalleryInfo', 'type': 'object'}, + } + + def __init__( + self, + *, + permissions: Optional[Union[str, "GallerySharingPermissionTypes"]] = None, + community_gallery_info: Optional[Any] = None, + **kwargs + ): + """ + :keyword permissions: This property allows you to specify the permission of sharing gallery. + :code:`
`:code:`
` Possible values are: :code:`
`:code:`
` **Private** + :code:`
`:code:`
` **Groups** :code:`
`:code:`
` **Community**. Possible values + include: "Private", "Groups", "Community". + :paramtype permissions: str or + ~azure.mgmt.compute.v2022_01_03.models.GallerySharingPermissionTypes + :keyword community_gallery_info: Information of community gallery if current gallery is shared + to community. + :paramtype community_gallery_info: any + """ + super(SharingProfile, self).__init__(**kwargs) + self.permissions = permissions + self.groups = None + self.community_gallery_info = community_gallery_info + + +class SharingProfileGroup(msrest.serialization.Model): + """Group of the gallery sharing profile. + + :ivar type: This property allows you to specify the type of sharing group. + :code:`
`:code:`
` Possible values are: :code:`
`:code:`
` **Subscriptions** + :code:`
`:code:`
` **AADTenants**. Possible values include: "Subscriptions", + "AADTenants". + :vartype type: str or ~azure.mgmt.compute.v2022_01_03.models.SharingProfileGroupTypes + :ivar ids: A list of subscription/tenant ids the gallery is aimed to be shared to. + :vartype ids: list[str] + """ + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'ids': {'key': 'ids', 'type': '[str]'}, + } + + def __init__( + self, + *, + type: Optional[Union[str, "SharingProfileGroupTypes"]] = None, + ids: Optional[List[str]] = None, + **kwargs + ): + """ + :keyword type: This property allows you to specify the type of sharing group. + :code:`
`:code:`
` Possible values are: :code:`
`:code:`
` **Subscriptions** + :code:`
`:code:`
` **AADTenants**. Possible values include: "Subscriptions", + "AADTenants". + :paramtype type: str or ~azure.mgmt.compute.v2022_01_03.models.SharingProfileGroupTypes + :keyword ids: A list of subscription/tenant ids the gallery is aimed to be shared to. + :paramtype ids: list[str] + """ + super(SharingProfileGroup, self).__init__(**kwargs) + self.type = type + self.ids = ids + + +class SharingStatus(msrest.serialization.Model): + """Sharing status of current gallery. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar aggregated_state: Aggregated sharing state of current gallery. Possible values include: + "Succeeded", "InProgress", "Failed", "Unknown". + :vartype aggregated_state: str or ~azure.mgmt.compute.v2022_01_03.models.SharingState + :ivar summary: Summary of all regional sharing status. + :vartype summary: list[~azure.mgmt.compute.v2022_01_03.models.RegionalSharingStatus] + """ + + _validation = { + 'aggregated_state': {'readonly': True}, + } + + _attribute_map = { + 'aggregated_state': {'key': 'aggregatedState', 'type': 'str'}, + 'summary': {'key': 'summary', 'type': '[RegionalSharingStatus]'}, + } + + def __init__( + self, + *, + summary: Optional[List["RegionalSharingStatus"]] = None, + **kwargs + ): + """ + :keyword summary: Summary of all regional sharing status. + :paramtype summary: list[~azure.mgmt.compute.v2022_01_03.models.RegionalSharingStatus] + """ + super(SharingStatus, self).__init__(**kwargs) + self.aggregated_state = None + self.summary = summary + + +class SharingUpdate(msrest.serialization.Model): + """Specifies information about the gallery sharing profile update. + + All required parameters must be populated in order to send to Azure. + + :ivar operation_type: Required. This property allows you to specify the operation type of + gallery sharing update. :code:`
`:code:`
` Possible values are: :code:`
`:code:`
` + **Add** :code:`
`:code:`
` **Remove** :code:`
`:code:`
` **Reset**. Possible values + include: "Add", "Remove", "Reset", "EnableCommunity". + :vartype operation_type: str or + ~azure.mgmt.compute.v2022_01_03.models.SharingUpdateOperationTypes + :ivar groups: A list of sharing profile groups. + :vartype groups: list[~azure.mgmt.compute.v2022_01_03.models.SharingProfileGroup] + """ + + _validation = { + 'operation_type': {'required': True}, + } + + _attribute_map = { + 'operation_type': {'key': 'operationType', 'type': 'str'}, + 'groups': {'key': 'groups', 'type': '[SharingProfileGroup]'}, + } + + def __init__( + self, + *, + operation_type: Union[str, "SharingUpdateOperationTypes"], + groups: Optional[List["SharingProfileGroup"]] = None, + **kwargs + ): + """ + :keyword operation_type: Required. This property allows you to specify the operation type of + gallery sharing update. :code:`
`:code:`
` Possible values are: :code:`
`:code:`
` + **Add** :code:`
`:code:`
` **Remove** :code:`
`:code:`
` **Reset**. Possible values + include: "Add", "Remove", "Reset", "EnableCommunity". + :paramtype operation_type: str or + ~azure.mgmt.compute.v2022_01_03.models.SharingUpdateOperationTypes + :keyword groups: A list of sharing profile groups. + :paramtype groups: list[~azure.mgmt.compute.v2022_01_03.models.SharingProfileGroup] + """ + super(SharingUpdate, self).__init__(**kwargs) + self.operation_type = operation_type + self.groups = groups + + +class SoftDeletePolicy(msrest.serialization.Model): + """Contains information about the soft deletion policy of the gallery. + + :ivar is_soft_delete_enabled: Enables soft-deletion for resources in this gallery, allowing + them to be recovered within retention time. + :vartype is_soft_delete_enabled: bool + """ + + _attribute_map = { + 'is_soft_delete_enabled': {'key': 'isSoftDeleteEnabled', 'type': 'bool'}, + } + + def __init__( + self, + *, + is_soft_delete_enabled: Optional[bool] = None, + **kwargs + ): + """ + :keyword is_soft_delete_enabled: Enables soft-deletion for resources in this gallery, allowing + them to be recovered within retention time. + :paramtype is_soft_delete_enabled: bool + """ + super(SoftDeletePolicy, self).__init__(**kwargs) + self.is_soft_delete_enabled = is_soft_delete_enabled + + +class TargetRegion(msrest.serialization.Model): + """Describes the target region information. + + All required parameters must be populated in order to send to Azure. + + :ivar name: Required. The name of the region. + :vartype name: str + :ivar regional_replica_count: The number of replicas of the Image Version to be created per + region. This property is updatable. + :vartype regional_replica_count: int + :ivar storage_account_type: Specifies the storage account type to be used to store the image. + This property is not updatable. Possible values include: "Standard_LRS", "Standard_ZRS", + "Premium_LRS". + :vartype storage_account_type: str or ~azure.mgmt.compute.v2022_01_03.models.StorageAccountType + :ivar encryption: Optional. Allows users to provide customer managed keys for encrypting the OS + and data disks in the gallery artifact. + :vartype encryption: ~azure.mgmt.compute.v2022_01_03.models.EncryptionImages + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'regional_replica_count': {'key': 'regionalReplicaCount', 'type': 'int'}, + 'storage_account_type': {'key': 'storageAccountType', 'type': 'str'}, + 'encryption': {'key': 'encryption', 'type': 'EncryptionImages'}, + } + + def __init__( + self, + *, + name: str, + regional_replica_count: Optional[int] = None, + storage_account_type: Optional[Union[str, "StorageAccountType"]] = None, + encryption: Optional["EncryptionImages"] = None, + **kwargs + ): + """ + :keyword name: Required. The name of the region. + :paramtype name: str + :keyword regional_replica_count: The number of replicas of the Image Version to be created per + region. This property is updatable. + :paramtype regional_replica_count: int + :keyword storage_account_type: Specifies the storage account type to be used to store the + image. This property is not updatable. Possible values include: "Standard_LRS", "Standard_ZRS", + "Premium_LRS". + :paramtype storage_account_type: str or + ~azure.mgmt.compute.v2022_01_03.models.StorageAccountType + :keyword encryption: Optional. Allows users to provide customer managed keys for encrypting the + OS and data disks in the gallery artifact. + :paramtype encryption: ~azure.mgmt.compute.v2022_01_03.models.EncryptionImages + """ + super(TargetRegion, self).__init__(**kwargs) + self.name = name + self.regional_replica_count = regional_replica_count + self.storage_account_type = storage_account_type + self.encryption = encryption + + +class UserArtifactManage(msrest.serialization.Model): + """UserArtifactManage. + + All required parameters must be populated in order to send to Azure. + + :ivar install: Required. Required. The path and arguments to install the gallery application. + This is limited to 4096 characters. + :vartype install: str + :ivar remove: Required. Required. The path and arguments to remove the gallery application. + This is limited to 4096 characters. + :vartype remove: str + :ivar 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. + :vartype 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 + ): + """ + :keyword install: Required. Required. The path and arguments to install the gallery + application. This is limited to 4096 characters. + :paramtype install: str + :keyword remove: Required. Required. The path and arguments to remove the gallery application. + This is limited to 4096 characters. + :paramtype remove: str + :keyword 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. + :paramtype update: str + """ + 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. + + :ivar media_link: Required. Required. The mediaLink of the artifact, must be a readable storage + page blob. + :vartype media_link: str + :ivar default_configuration_link: Optional. The defaultConfigurationLink of the artifact, must + be a readable storage page blob. + :vartype default_configuration_link: str + """ + + _validation = { + 'media_link': {'required': True}, + } + + _attribute_map = { + 'media_link': {'key': 'mediaLink', 'type': 'str'}, + 'default_configuration_link': {'key': 'defaultConfigurationLink', 'type': 'str'}, + } + + def __init__( + self, + *, + media_link: str, + default_configuration_link: Optional[str] = None, + **kwargs + ): + """ + :keyword media_link: Required. Required. The mediaLink of the artifact, must be a readable + storage page blob. + :paramtype media_link: str + :keyword default_configuration_link: Optional. The defaultConfigurationLink of the artifact, + must be a readable storage page blob. + :paramtype default_configuration_link: str + """ + super(UserArtifactSource, self).__init__(**kwargs) + self.media_link = media_link + self.default_configuration_link = default_configuration_link diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/operations/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/operations/__init__.py new file mode 100644 index 000000000000..336e2221f2b0 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/operations/__init__.py @@ -0,0 +1,35 @@ +# 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 ._galleries_operations import GalleriesOperations +from ._gallery_images_operations import GalleryImagesOperations +from ._gallery_image_versions_operations import GalleryImageVersionsOperations +from ._gallery_applications_operations import GalleryApplicationsOperations +from ._gallery_application_versions_operations import GalleryApplicationVersionsOperations +from ._gallery_sharing_profile_operations import GallerySharingProfileOperations +from ._shared_galleries_operations import SharedGalleriesOperations +from ._shared_gallery_images_operations import SharedGalleryImagesOperations +from ._shared_gallery_image_versions_operations import SharedGalleryImageVersionsOperations +from ._community_galleries_operations import CommunityGalleriesOperations +from ._community_gallery_images_operations import CommunityGalleryImagesOperations +from ._community_gallery_image_versions_operations import CommunityGalleryImageVersionsOperations + +__all__ = [ + 'GalleriesOperations', + 'GalleryImagesOperations', + 'GalleryImageVersionsOperations', + 'GalleryApplicationsOperations', + 'GalleryApplicationVersionsOperations', + 'GallerySharingProfileOperations', + 'SharedGalleriesOperations', + 'SharedGalleryImagesOperations', + 'SharedGalleryImageVersionsOperations', + 'CommunityGalleriesOperations', + 'CommunityGalleryImagesOperations', + 'CommunityGalleryImageVersionsOperations', +] diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/operations/_community_galleries_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/operations/_community_galleries_operations.py new file mode 100644 index 000000000000..76b356ddd1b8 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/operations/_community_galleries_operations.py @@ -0,0 +1,133 @@ +# 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 functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + location: str, + public_gallery_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-03" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/communityGalleries/{publicGalleryName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "location": _SERIALIZER.url("location", location, 'str'), + "publicGalleryName": _SERIALIZER.url("public_gallery_name", public_gallery_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +class CommunityGalleriesOperations(object): + """CommunityGalleriesOperations 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.v2022_01_03.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 + + @distributed_trace + def get( + self, + location: str, + public_gallery_name: str, + **kwargs: Any + ) -> "_models.CommunityGallery": + """Get a community gallery by gallery public name. + + :param location: Resource location. + :type location: str + :param public_gallery_name: The public name of the community gallery. + :type public_gallery_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CommunityGallery, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2022_01_03.models.CommunityGallery + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CommunityGallery"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + location=location, + public_gallery_name=public_gallery_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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('CommunityGallery', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/communityGalleries/{publicGalleryName}'} # type: ignore + diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/operations/_community_gallery_image_versions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/operations/_community_gallery_image_versions_operations.py new file mode 100644 index 000000000000..3086247f4acb --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/operations/_community_gallery_image_versions_operations.py @@ -0,0 +1,266 @@ +# 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar +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 HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + location: str, + public_gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-03" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/communityGalleries/{publicGalleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "location": _SERIALIZER.url("location", location, 'str'), + "publicGalleryName": _SERIALIZER.url("public_gallery_name", public_gallery_name, 'str'), + "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, 'str'), + "galleryImageVersionName": _SERIALIZER.url("gallery_image_version_name", gallery_image_version_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + location: str, + public_gallery_name: str, + gallery_image_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-03" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/communityGalleries/{publicGalleryName}/images/{galleryImageName}/versions') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "location": _SERIALIZER.url("location", location, 'str'), + "publicGalleryName": _SERIALIZER.url("public_gallery_name", public_gallery_name, 'str'), + "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +class CommunityGalleryImageVersionsOperations(object): + """CommunityGalleryImageVersionsOperations 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.v2022_01_03.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 + + @distributed_trace + def get( + self, + location: str, + public_gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + **kwargs: Any + ) -> "_models.CommunityGalleryImageVersion": + """Get a community gallery image version. + + :param location: Resource location. + :type location: str + :param public_gallery_name: The public name of the community gallery. + :type public_gallery_name: str + :param gallery_image_name: The name of the community gallery image definition. + :type gallery_image_name: str + :param gallery_image_version_name: The name of the community gallery image version. Needs to + follow semantic version name pattern: The allowed characters are digit and period. Digits must + be within the range of a 32-bit integer. Format: + :code:``.:code:``.:code:``. + :type gallery_image_version_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CommunityGalleryImageVersion, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2022_01_03.models.CommunityGalleryImageVersion + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CommunityGalleryImageVersion"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + location=location, + public_gallery_name=public_gallery_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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('CommunityGalleryImageVersion', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/communityGalleries/{publicGalleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore + + + @distributed_trace + def list( + self, + location: str, + public_gallery_name: str, + gallery_image_name: str, + **kwargs: Any + ) -> Iterable["_models.CommunityGalleryImageVersionList"]: + """List community gallery image versions inside an image. + + :param location: Resource location. + :type location: str + :param public_gallery_name: The public name of the community gallery. + :type public_gallery_name: str + :param gallery_image_name: The name of the community gallery image definition. + :type gallery_image_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CommunityGalleryImageVersionList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2022_01_03.models.CommunityGalleryImageVersionList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CommunityGalleryImageVersionList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + location=location, + public_gallery_name=public_gallery_name, + gallery_image_name=gallery_image_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + location=location, + public_gallery_name=public_gallery_name, + gallery_image_name=gallery_image_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("CommunityGalleryImageVersionList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/communityGalleries/{publicGalleryName}/images/{galleryImageName}/versions'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/operations/_community_gallery_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/operations/_community_gallery_images_operations.py new file mode 100644 index 000000000000..ae684b1baf62 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/operations/_community_gallery_images_operations.py @@ -0,0 +1,250 @@ +# 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar +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 HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + location: str, + public_gallery_name: str, + gallery_image_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-03" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/communityGalleries/{publicGalleryName}/images/{galleryImageName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "location": _SERIALIZER.url("location", location, 'str'), + "publicGalleryName": _SERIALIZER.url("public_gallery_name", public_gallery_name, 'str'), + "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + location: str, + public_gallery_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-03" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/communityGalleries/{publicGalleryName}/images') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "location": _SERIALIZER.url("location", location, 'str'), + "publicGalleryName": _SERIALIZER.url("public_gallery_name", public_gallery_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +class CommunityGalleryImagesOperations(object): + """CommunityGalleryImagesOperations 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.v2022_01_03.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 + + @distributed_trace + def get( + self, + location: str, + public_gallery_name: str, + gallery_image_name: str, + **kwargs: Any + ) -> "_models.CommunityGalleryImage": + """Get a community gallery image. + + :param location: Resource location. + :type location: str + :param public_gallery_name: The public name of the community gallery. + :type public_gallery_name: str + :param gallery_image_name: The name of the community gallery image definition. + :type gallery_image_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CommunityGalleryImage, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2022_01_03.models.CommunityGalleryImage + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CommunityGalleryImage"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + location=location, + public_gallery_name=public_gallery_name, + gallery_image_name=gallery_image_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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('CommunityGalleryImage', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/communityGalleries/{publicGalleryName}/images/{galleryImageName}'} # type: ignore + + + @distributed_trace + def list( + self, + location: str, + public_gallery_name: str, + **kwargs: Any + ) -> Iterable["_models.CommunityGalleryImageList"]: + """List community gallery images inside a gallery. + + :param location: Resource location. + :type location: str + :param public_gallery_name: The public name of the community gallery. + :type public_gallery_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CommunityGalleryImageList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2022_01_03.models.CommunityGalleryImageList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CommunityGalleryImageList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + location=location, + public_gallery_name=public_gallery_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + location=location, + public_gallery_name=public_gallery_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("CommunityGalleryImageList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/communityGalleries/{publicGalleryName}/images'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/operations/_galleries_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/operations/_galleries_operations.py new file mode 100644 index 000000000000..e5d01dfdf2bd --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/operations/_galleries_operations.py @@ -0,0 +1,805 @@ +# 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union +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 HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2022-01-03" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2022-01-03" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + *, + select: Optional[Union[str, "_models.SelectPermissions"]] = None, + expand: Optional[Union[str, "_models.GalleryExpandParams"]] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-03" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if select is not None: + query_parameters['$select'] = _SERIALIZER.query("select", select, 'str') + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-03" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-03" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-03" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/galleries') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +class GalleriesOperations(object): + """GalleriesOperations 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.v2022_01_03.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: str, + gallery_name: str, + gallery: "_models.Gallery", + **kwargs: Any + ) -> "_models.Gallery": + cls = kwargs.pop('cls', None) # type: ClsType["_models.Gallery"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(gallery, 'Gallery') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + 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('Gallery', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Gallery', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('Gallery', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}'} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + gallery_name: str, + gallery: "_models.Gallery", + **kwargs: Any + ) -> LROPoller["_models.Gallery"]: + """Create or update a Shared Image Gallery. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. The allowed characters are alphabets + and numbers with dots and periods allowed in the middle. The maximum length is 80 characters. + :type gallery_name: str + :param gallery: Parameters supplied to the create or update Shared Image Gallery operation. + :type gallery: ~azure.mgmt.compute.v2022_01_03.models.Gallery + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either Gallery or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2022_01_03.models.Gallery] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Gallery"] + 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, + gallery_name=gallery_name, + gallery=gallery, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('Gallery', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, **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/galleries/{galleryName}'} # type: ignore + + def _update_initial( + self, + resource_group_name: str, + gallery_name: str, + gallery: "_models.GalleryUpdate", + **kwargs: Any + ) -> "_models.Gallery": + cls = kwargs.pop('cls', None) # type: ClsType["_models.Gallery"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(gallery, 'GalleryUpdate') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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('Gallery', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}'} # type: ignore + + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + gallery_name: str, + gallery: "_models.GalleryUpdate", + **kwargs: Any + ) -> LROPoller["_models.Gallery"]: + """Update a Shared Image Gallery. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. The allowed characters are alphabets + and numbers with dots and periods allowed in the middle. The maximum length is 80 characters. + :type gallery_name: str + :param gallery: Parameters supplied to the update Shared Image Gallery operation. + :type gallery: ~azure.mgmt.compute.v2022_01_03.models.GalleryUpdate + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either Gallery or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2022_01_03.models.Gallery] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Gallery"] + 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, + gallery_name=gallery_name, + gallery=gallery, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('Gallery', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, **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/galleries/{galleryName}'} # type: ignore + + @distributed_trace + def get( + self, + resource_group_name: str, + gallery_name: str, + select: Optional[Union[str, "_models.SelectPermissions"]] = None, + expand: Optional[Union[str, "_models.GalleryExpandParams"]] = None, + **kwargs: Any + ) -> "_models.Gallery": + """Retrieves information about a Shared Image Gallery. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. + :type gallery_name: str + :param select: The select expression to apply on the operation. + :type select: str or ~azure.mgmt.compute.v2022_01_03.models.SelectPermissions + :param expand: The expand query option to apply on the operation. + :type expand: str or ~azure.mgmt.compute.v2022_01_03.models.GalleryExpandParams + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Gallery, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2022_01_03.models.Gallery + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Gallery"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + select=select, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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('Gallery', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}'} # type: ignore + + + def _delete_initial( + self, + resource_group_name: str, + gallery_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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/galleries/{galleryName}'} # type: ignore + + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + gallery_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Delete a Shared Image Gallery. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery to be deleted. + :type gallery_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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, + gallery_name=gallery_name, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, **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/galleries/{galleryName}'} # type: ignore + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.GalleryList"]: + """List galleries under a resource group. + + :param resource_group_name: The 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 GalleryList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2022_01_03.models.GalleryList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("GalleryList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries'} # type: ignore + + @distributed_trace + def list( + self, + **kwargs: Any + ) -> Iterable["_models.GalleryList"]: + """List galleries under a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either GalleryList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2022_01_03.models.GalleryList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("GalleryList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/galleries'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/operations/_gallery_application_versions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/operations/_gallery_application_versions_operations.py new file mode 100644 index 000000000000..5a50c751fe2f --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/operations/_gallery_application_versions_operations.py @@ -0,0 +1,804 @@ +# 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union +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 HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2022-01-03" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + "galleryApplicationName": _SERIALIZER.url("gallery_application_name", gallery_application_name, 'str'), + "galleryApplicationVersionName": _SERIALIZER.url("gallery_application_version_name", gallery_application_version_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2022-01-03" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + "galleryApplicationName": _SERIALIZER.url("gallery_application_name", gallery_application_name, 'str'), + "galleryApplicationVersionName": _SERIALIZER.url("gallery_application_version_name", gallery_application_version_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + *, + expand: Optional[Union[str, "_models.ReplicationStatusTypes"]] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-03" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + "galleryApplicationName": _SERIALIZER.url("gallery_application_name", gallery_application_name, 'str'), + "galleryApplicationVersionName": _SERIALIZER.url("gallery_application_version_name", gallery_application_version_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-03" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + "galleryApplicationName": _SERIALIZER.url("gallery_application_name", gallery_application_name, 'str'), + "galleryApplicationVersionName": _SERIALIZER.url("gallery_application_version_name", gallery_application_version_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_gallery_application_request( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-03" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + "galleryApplicationName": _SERIALIZER.url("gallery_application_name", gallery_application_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +class GalleryApplicationVersionsOperations(object): + """GalleryApplicationVersionsOperations 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.v2022_01_03.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: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + gallery_application_version: "_models.GalleryApplicationVersion", + **kwargs: Any + ) -> "_models.GalleryApplicationVersion": + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplicationVersion"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(gallery_application_version, 'GalleryApplicationVersion') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + gallery_application_version_name=gallery_application_version_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + 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('GalleryApplicationVersion', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('GalleryApplicationVersion', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('GalleryApplicationVersion', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}'} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + gallery_application_version: "_models.GalleryApplicationVersion", + **kwargs: Any + ) -> LROPoller["_models.GalleryApplicationVersion"]: + """Create or update a gallery Application Version. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param gallery_name: The name of the Shared Application Gallery in which the Application + Definition resides. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition in which the + Application Version is to be created. + :type gallery_application_name: str + :param gallery_application_version_name: The name of the gallery Application Version to be + created. Needs to follow semantic version name pattern: The allowed characters are digit and + period. Digits must be within the range of a 32-bit integer. Format: + :code:``.:code:``.:code:``. + :type gallery_application_version_name: str + :param gallery_application_version: Parameters supplied to the create or update gallery + Application Version operation. + :type gallery_application_version: + ~azure.mgmt.compute.v2022_01_03.models.GalleryApplicationVersion + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either GalleryApplicationVersion or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2022_01_03.models.GalleryApplicationVersion] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplicationVersion"] + 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, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + gallery_application_version_name=gallery_application_version_name, + gallery_application_version=gallery_application_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('GalleryApplicationVersion', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, **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/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}'} # type: ignore + + def _update_initial( + self, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + gallery_application_version: "_models.GalleryApplicationVersionUpdate", + **kwargs: Any + ) -> "_models.GalleryApplicationVersion": + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplicationVersion"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(gallery_application_version, 'GalleryApplicationVersionUpdate') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + gallery_application_version_name=gallery_application_version_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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('GalleryApplicationVersion', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}'} # type: ignore + + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + gallery_application_version: "_models.GalleryApplicationVersionUpdate", + **kwargs: Any + ) -> LROPoller["_models.GalleryApplicationVersion"]: + """Update a gallery Application Version. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param gallery_name: The name of the Shared Application Gallery in which the Application + Definition resides. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition in which the + Application Version is to be updated. + :type gallery_application_name: str + :param gallery_application_version_name: The name of the gallery Application Version to be + updated. Needs to follow semantic version name pattern: The allowed characters are digit and + period. Digits must be within the range of a 32-bit integer. Format: + :code:``.:code:``.:code:``. + :type gallery_application_version_name: str + :param gallery_application_version: Parameters supplied to the update gallery Application + Version operation. + :type gallery_application_version: + ~azure.mgmt.compute.v2022_01_03.models.GalleryApplicationVersionUpdate + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either GalleryApplicationVersion or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2022_01_03.models.GalleryApplicationVersion] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplicationVersion"] + 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, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + gallery_application_version_name=gallery_application_version_name, + gallery_application_version=gallery_application_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('GalleryApplicationVersion', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, **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/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}'} # type: ignore + + @distributed_trace + def get( + self, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + expand: Optional[Union[str, "_models.ReplicationStatusTypes"]] = None, + **kwargs: Any + ) -> "_models.GalleryApplicationVersion": + """Retrieves information about a gallery Application Version. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param gallery_name: The name of the Shared Application Gallery in which the Application + Definition resides. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition in which the + Application Version resides. + :type gallery_application_name: str + :param gallery_application_version_name: The name of the gallery Application Version to be + retrieved. + :type gallery_application_version_name: str + :param expand: The expand expression to apply on the operation. + :type expand: str or ~azure.mgmt.compute.v2022_01_03.models.ReplicationStatusTypes + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GalleryApplicationVersion, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2022_01_03.models.GalleryApplicationVersion + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplicationVersion"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + gallery_application_version_name=gallery_application_version_name, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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('GalleryApplicationVersion', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}'} # type: ignore + + + def _delete_initial( + self, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + gallery_application_version_name=gallery_application_version_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}'} # type: ignore + + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application_version_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Delete a gallery Application Version. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param gallery_name: The name of the Shared Application Gallery in which the Application + Definition resides. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition in which the + Application Version resides. + :type gallery_application_name: str + :param gallery_application_version_name: The name of the gallery Application Version to be + deleted. + :type gallery_application_version_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + gallery_application_version_name=gallery_application_version_name, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, **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/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}'} # type: ignore + + @distributed_trace + def list_by_gallery_application( + self, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + **kwargs: Any + ) -> Iterable["_models.GalleryApplicationVersionList"]: + """List gallery Application Versions in a gallery Application Definition. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param gallery_name: The name of the Shared Application Gallery in which the Application + Definition resides. + :type gallery_name: str + :param gallery_application_name: The name of the Shared Application Gallery Application + Definition from which the Application Versions are to be listed. + :type gallery_application_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either GalleryApplicationVersionList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2022_01_03.models.GalleryApplicationVersionList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplicationVersionList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_gallery_application_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + template_url=self.list_by_gallery_application.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_gallery_application_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("GalleryApplicationVersionList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_by_gallery_application.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/operations/_gallery_applications_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/operations/_gallery_applications_operations.py new file mode 100644 index 000000000000..1c55b9829b36 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/operations/_gallery_applications_operations.py @@ -0,0 +1,748 @@ +# 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union +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 HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2022-01-03" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + "galleryApplicationName": _SERIALIZER.url("gallery_application_name", gallery_application_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2022-01-03" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + "galleryApplicationName": _SERIALIZER.url("gallery_application_name", gallery_application_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-03" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + "galleryApplicationName": _SERIALIZER.url("gallery_application_name", gallery_application_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-03" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + "galleryApplicationName": _SERIALIZER.url("gallery_application_name", gallery_application_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_gallery_request( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-03" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +class GalleryApplicationsOperations(object): + """GalleryApplicationsOperations 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.v2022_01_03.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: str, + gallery_name: str, + gallery_application_name: str, + gallery_application: "_models.GalleryApplication", + **kwargs: Any + ) -> "_models.GalleryApplication": + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplication"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(gallery_application, 'GalleryApplication') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + 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('GalleryApplication', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('GalleryApplication', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('GalleryApplication', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}'} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application: "_models.GalleryApplication", + **kwargs: Any + ) -> LROPoller["_models.GalleryApplication"]: + """Create or update a gallery Application Definition. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param gallery_name: The name of the Shared Application Gallery in which the Application + Definition is to be created. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition to be created + or updated. The allowed characters are alphabets and numbers with dots, dashes, and periods + allowed in the middle. The maximum length is 80 characters. + :type gallery_application_name: str + :param gallery_application: Parameters supplied to the create or update gallery Application + operation. + :type gallery_application: ~azure.mgmt.compute.v2022_01_03.models.GalleryApplication + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either GalleryApplication or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2022_01_03.models.GalleryApplication] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplication"] + 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, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + gallery_application=gallery_application, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('GalleryApplication', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, **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/galleries/{galleryName}/applications/{galleryApplicationName}'} # type: ignore + + def _update_initial( + self, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application: "_models.GalleryApplicationUpdate", + **kwargs: Any + ) -> "_models.GalleryApplication": + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplication"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(gallery_application, 'GalleryApplicationUpdate') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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('GalleryApplication', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}'} # type: ignore + + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + gallery_application: "_models.GalleryApplicationUpdate", + **kwargs: Any + ) -> LROPoller["_models.GalleryApplication"]: + """Update a gallery Application Definition. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param gallery_name: The name of the Shared Application Gallery in which the Application + Definition is to be updated. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition to be updated. + The allowed characters are alphabets and numbers with dots, dashes, and periods allowed in the + middle. The maximum length is 80 characters. + :type gallery_application_name: str + :param gallery_application: Parameters supplied to the update gallery Application operation. + :type gallery_application: ~azure.mgmt.compute.v2022_01_03.models.GalleryApplicationUpdate + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either GalleryApplication or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2022_01_03.models.GalleryApplication] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplication"] + 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, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + gallery_application=gallery_application, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('GalleryApplication', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, **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/galleries/{galleryName}/applications/{galleryApplicationName}'} # type: ignore + + @distributed_trace + def get( + self, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + **kwargs: Any + ) -> "_models.GalleryApplication": + """Retrieves information about a gallery Application Definition. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param gallery_name: The name of the Shared Application Gallery from which the Application + Definitions are to be retrieved. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition to be + retrieved. + :type gallery_application_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GalleryApplication, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2022_01_03.models.GalleryApplication + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplication"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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('GalleryApplication', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}'} # type: ignore + + + def _delete_initial( + self, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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/galleries/{galleryName}/applications/{galleryApplicationName}'} # type: ignore + + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + gallery_name: str, + gallery_application_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Delete a gallery Application. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param gallery_name: The name of the Shared Application Gallery in which the Application + Definition is to be deleted. + :type gallery_name: str + :param gallery_application_name: The name of the gallery Application Definition to be deleted. + :type gallery_application_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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, + gallery_name=gallery_name, + gallery_application_name=gallery_application_name, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, **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/galleries/{galleryName}/applications/{galleryApplicationName}'} # type: ignore + + @distributed_trace + def list_by_gallery( + self, + resource_group_name: str, + gallery_name: str, + **kwargs: Any + ) -> Iterable["_models.GalleryApplicationList"]: + """List gallery Application Definitions in a gallery. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param gallery_name: The name of the Shared Application Gallery from which Application + Definitions are to be listed. + :type gallery_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either GalleryApplicationList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2022_01_03.models.GalleryApplicationList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplicationList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_gallery_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + template_url=self.list_by_gallery.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_gallery_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("GalleryApplicationList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_by_gallery.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/operations/_gallery_image_versions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/operations/_gallery_image_versions_operations.py new file mode 100644 index 000000000000..5526a13073fc --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/operations/_gallery_image_versions_operations.py @@ -0,0 +1,800 @@ +# 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union +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 HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2022-01-03" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, 'str'), + "galleryImageVersionName": _SERIALIZER.url("gallery_image_version_name", gallery_image_version_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2022-01-03" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, 'str'), + "galleryImageVersionName": _SERIALIZER.url("gallery_image_version_name", gallery_image_version_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + *, + expand: Optional[Union[str, "_models.ReplicationStatusTypes"]] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-03" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, 'str'), + "galleryImageVersionName": _SERIALIZER.url("gallery_image_version_name", gallery_image_version_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-03" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, 'str'), + "galleryImageVersionName": _SERIALIZER.url("gallery_image_version_name", gallery_image_version_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_gallery_image_request( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-03" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +class GalleryImageVersionsOperations(object): + """GalleryImageVersionsOperations 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.v2022_01_03.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: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + gallery_image_version: "_models.GalleryImageVersion", + **kwargs: Any + ) -> "_models.GalleryImageVersion": + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageVersion"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(gallery_image_version, 'GalleryImageVersion') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + 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('GalleryImageVersion', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('GalleryImageVersion', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('GalleryImageVersion', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + gallery_image_version: "_models.GalleryImageVersion", + **kwargs: Any + ) -> LROPoller["_models.GalleryImageVersion"]: + """Create or update a gallery image version. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery in which the Image Definition + resides. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition in which the Image Version + is to be created. + :type gallery_image_name: str + :param gallery_image_version_name: The name of the gallery image version to be created. Needs + to follow semantic version name pattern: The allowed characters are digit and period. Digits + must be within the range of a 32-bit integer. Format: + :code:``.:code:``.:code:``. + :type gallery_image_version_name: str + :param gallery_image_version: Parameters supplied to the create or update gallery image version + operation. + :type gallery_image_version: ~azure.mgmt.compute.v2022_01_03.models.GalleryImageVersion + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either GalleryImageVersion or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2022_01_03.models.GalleryImageVersion] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageVersion"] + 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, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, + gallery_image_version=gallery_image_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('GalleryImageVersion', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, **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/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore + + def _update_initial( + self, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + gallery_image_version: "_models.GalleryImageVersionUpdate", + **kwargs: Any + ) -> "_models.GalleryImageVersion": + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageVersion"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(gallery_image_version, 'GalleryImageVersionUpdate') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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('GalleryImageVersion', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore + + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + gallery_image_version: "_models.GalleryImageVersionUpdate", + **kwargs: Any + ) -> LROPoller["_models.GalleryImageVersion"]: + """Update a gallery image version. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery in which the Image Definition + resides. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition in which the Image Version + is to be updated. + :type gallery_image_name: str + :param gallery_image_version_name: The name of the gallery image version to be updated. Needs + to follow semantic version name pattern: The allowed characters are digit and period. Digits + must be within the range of a 32-bit integer. Format: + :code:``.:code:``.:code:``. + :type gallery_image_version_name: str + :param gallery_image_version: Parameters supplied to the update gallery image version + operation. + :type gallery_image_version: ~azure.mgmt.compute.v2022_01_03.models.GalleryImageVersionUpdate + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either GalleryImageVersion or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2022_01_03.models.GalleryImageVersion] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageVersion"] + 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, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, + gallery_image_version=gallery_image_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('GalleryImageVersion', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, **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/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore + + @distributed_trace + def get( + self, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + expand: Optional[Union[str, "_models.ReplicationStatusTypes"]] = None, + **kwargs: Any + ) -> "_models.GalleryImageVersion": + """Retrieves information about a gallery image version. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery in which the Image Definition + resides. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition in which the Image Version + resides. + :type gallery_image_name: str + :param gallery_image_version_name: The name of the gallery image version to be retrieved. + :type gallery_image_version_name: str + :param expand: The expand expression to apply on the operation. + :type expand: str or ~azure.mgmt.compute.v2022_01_03.models.ReplicationStatusTypes + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GalleryImageVersion, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2022_01_03.models.GalleryImageVersion + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageVersion"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, + expand=expand, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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('GalleryImageVersion', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore + + + def _delete_initial( + self, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore + + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Delete a gallery image version. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery in which the Image Definition + resides. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition in which the Image Version + resides. + :type gallery_image_name: str + :param gallery_image_version_name: The name of the gallery image version to be deleted. + :type gallery_image_version_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, **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/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore + + @distributed_trace + def list_by_gallery_image( + self, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + **kwargs: Any + ) -> Iterable["_models.GalleryImageVersionList"]: + """List gallery image versions in a gallery image definition. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery in which the Image Definition + resides. + :type gallery_name: str + :param gallery_image_name: The name of the Shared Image Gallery Image Definition from which the + Image Versions are to be listed. + :type gallery_image_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either GalleryImageVersionList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2022_01_03.models.GalleryImageVersionList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageVersionList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_gallery_image_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + template_url=self.list_by_gallery_image.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_gallery_image_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("GalleryImageVersionList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_by_gallery_image.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/operations/_gallery_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/operations/_gallery_images_operations.py new file mode 100644 index 000000000000..3d47d6286072 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/operations/_gallery_images_operations.py @@ -0,0 +1,742 @@ +# 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union +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 HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2022-01-03" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2022-01-03" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-03" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-03" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_gallery_request( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-03" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +class GalleryImagesOperations(object): + """GalleryImagesOperations 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.v2022_01_03.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: str, + gallery_name: str, + gallery_image_name: str, + gallery_image: "_models.GalleryImage", + **kwargs: Any + ) -> "_models.GalleryImage": + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImage"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(gallery_image, 'GalleryImage') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + 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('GalleryImage', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('GalleryImage', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('GalleryImage', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}'} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image: "_models.GalleryImage", + **kwargs: Any + ) -> LROPoller["_models.GalleryImage"]: + """Create or update a gallery image definition. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery in which the Image Definition is to + be created. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition to be created or updated. + The allowed characters are alphabets and numbers with dots, dashes, and periods allowed in the + middle. The maximum length is 80 characters. + :type gallery_image_name: str + :param gallery_image: Parameters supplied to the create or update gallery image operation. + :type gallery_image: ~azure.mgmt.compute.v2022_01_03.models.GalleryImage + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either GalleryImage or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2022_01_03.models.GalleryImage] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImage"] + 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, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + gallery_image=gallery_image, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('GalleryImage', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, **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/galleries/{galleryName}/images/{galleryImageName}'} # type: ignore + + def _update_initial( + self, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image: "_models.GalleryImageUpdate", + **kwargs: Any + ) -> "_models.GalleryImage": + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImage"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(gallery_image, 'GalleryImageUpdate') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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('GalleryImage', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}'} # type: ignore + + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + gallery_image: "_models.GalleryImageUpdate", + **kwargs: Any + ) -> LROPoller["_models.GalleryImage"]: + """Update a gallery image definition. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery in which the Image Definition is to + be updated. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition to be updated. The allowed + characters are alphabets and numbers with dots, dashes, and periods allowed in the middle. The + maximum length is 80 characters. + :type gallery_image_name: str + :param gallery_image: Parameters supplied to the update gallery image operation. + :type gallery_image: ~azure.mgmt.compute.v2022_01_03.models.GalleryImageUpdate + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either GalleryImage or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2022_01_03.models.GalleryImage] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImage"] + 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, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + gallery_image=gallery_image, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('GalleryImage', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, **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/galleries/{galleryName}/images/{galleryImageName}'} # type: ignore + + @distributed_trace + def get( + self, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + **kwargs: Any + ) -> "_models.GalleryImage": + """Retrieves information about a gallery image definition. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery from which the Image Definitions are + to be retrieved. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition to be retrieved. + :type gallery_image_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GalleryImage, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2022_01_03.models.GalleryImage + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImage"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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('GalleryImage', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}'} # type: ignore + + + def _delete_initial( + self, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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/galleries/{galleryName}/images/{galleryImageName}'} # type: ignore + + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + gallery_name: str, + gallery_image_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Delete a gallery image. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery in which the Image Definition is to + be deleted. + :type gallery_name: str + :param gallery_image_name: The name of the gallery image definition to be deleted. + :type gallery_image_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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, + gallery_name=gallery_name, + gallery_image_name=gallery_image_name, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, **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/galleries/{galleryName}/images/{galleryImageName}'} # type: ignore + + @distributed_trace + def list_by_gallery( + self, + resource_group_name: str, + gallery_name: str, + **kwargs: Any + ) -> Iterable["_models.GalleryImageList"]: + """List gallery image definitions in a gallery. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery from which Image Definitions are to + be listed. + :type gallery_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either GalleryImageList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2022_01_03.models.GalleryImageList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_gallery_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + template_url=self.list_by_gallery.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_gallery_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("GalleryImageList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_by_gallery.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/operations/_gallery_sharing_profile_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/operations/_gallery_sharing_profile_operations.py new file mode 100644 index 000000000000..3887d51571d6 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/operations/_gallery_sharing_profile_operations.py @@ -0,0 +1,214 @@ +# 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 functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + gallery_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2022-01-03" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/share') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "galleryName": _SERIALIZER.url("gallery_name", gallery_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + +class GallerySharingProfileOperations(object): + """GallerySharingProfileOperations 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.v2022_01_03.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 _update_initial( + self, + resource_group_name: str, + gallery_name: str, + sharing_update: "_models.SharingUpdate", + **kwargs: Any + ) -> "_models.SharingUpdate": + cls = kwargs.pop('cls', None) # type: ClsType["_models.SharingUpdate"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(sharing_update, 'SharingUpdate') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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 response.status_code == 200: + deserialized = self._deserialize('SharingUpdate', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('SharingUpdate', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/share'} # type: ignore + + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + gallery_name: str, + sharing_update: "_models.SharingUpdate", + **kwargs: Any + ) -> LROPoller["_models.SharingUpdate"]: + """Update sharing profile of a gallery. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param gallery_name: The name of the Shared Image Gallery. + :type gallery_name: str + :param sharing_update: Parameters supplied to the update gallery sharing profile. + :type sharing_update: ~azure.mgmt.compute.v2022_01_03.models.SharingUpdate + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either SharingUpdate or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2022_01_03.models.SharingUpdate] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SharingUpdate"] + 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, + gallery_name=gallery_name, + sharing_update=sharing_update, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('SharingUpdate', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, **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/galleries/{galleryName}/share'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/operations/_shared_galleries_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/operations/_shared_galleries_operations.py new file mode 100644 index 000000000000..bb6361d7a78a --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/operations/_shared_galleries_operations.py @@ -0,0 +1,245 @@ +# 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union +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 HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + location: str, + *, + shared_to: Optional[Union[str, "_models.SharedToValues"]] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-03" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "location": _SERIALIZER.url("location", location, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if shared_to is not None: + query_parameters['sharedTo'] = _SERIALIZER.query("shared_to", shared_to, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + location: str, + gallery_unique_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-03" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "location": _SERIALIZER.url("location", location, 'str'), + "galleryUniqueName": _SERIALIZER.url("gallery_unique_name", gallery_unique_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +class SharedGalleriesOperations(object): + """SharedGalleriesOperations 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.v2022_01_03.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 + + @distributed_trace + def list( + self, + location: str, + shared_to: Optional[Union[str, "_models.SharedToValues"]] = None, + **kwargs: Any + ) -> Iterable["_models.SharedGalleryList"]: + """List shared galleries by subscription id or tenant id. + + :param location: Resource location. + :type location: str + :param shared_to: The query parameter to decide what shared galleries to fetch when doing + listing operations. + :type shared_to: str or ~azure.mgmt.compute.v2022_01_03.models.SharedToValues + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SharedGalleryList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2022_01_03.models.SharedGalleryList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedGalleryList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + location=location, + shared_to=shared_to, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + location=location, + shared_to=shared_to, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("SharedGalleryList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries'} # type: ignore + + @distributed_trace + def get( + self, + location: str, + gallery_unique_name: str, + **kwargs: Any + ) -> "_models.SharedGallery": + """Get a shared gallery by subscription id or tenant id. + + :param location: Resource location. + :type location: str + :param gallery_unique_name: The unique name of the Shared Gallery. + :type gallery_unique_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SharedGallery, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2022_01_03.models.SharedGallery + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedGallery"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + location=location, + gallery_unique_name=gallery_unique_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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('SharedGallery', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}'} # type: ignore + diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/operations/_shared_gallery_image_versions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/operations/_shared_gallery_image_versions_operations.py new file mode 100644 index 000000000000..61ebc196a9b6 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/operations/_shared_gallery_image_versions_operations.py @@ -0,0 +1,278 @@ +# 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union +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 HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + location: str, + gallery_unique_name: str, + gallery_image_name: str, + *, + shared_to: Optional[Union[str, "_models.SharedToValues"]] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-03" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}/images/{galleryImageName}/versions') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "location": _SERIALIZER.url("location", location, 'str'), + "galleryUniqueName": _SERIALIZER.url("gallery_unique_name", gallery_unique_name, 'str'), + "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if shared_to is not None: + query_parameters['sharedTo'] = _SERIALIZER.query("shared_to", shared_to, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + location: str, + gallery_unique_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-03" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}/images/{galleryImageName}/versions/{galleryImageVersionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "location": _SERIALIZER.url("location", location, 'str'), + "galleryUniqueName": _SERIALIZER.url("gallery_unique_name", gallery_unique_name, 'str'), + "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, 'str'), + "galleryImageVersionName": _SERIALIZER.url("gallery_image_version_name", gallery_image_version_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +class SharedGalleryImageVersionsOperations(object): + """SharedGalleryImageVersionsOperations 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.v2022_01_03.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 + + @distributed_trace + def list( + self, + location: str, + gallery_unique_name: str, + gallery_image_name: str, + shared_to: Optional[Union[str, "_models.SharedToValues"]] = None, + **kwargs: Any + ) -> Iterable["_models.SharedGalleryImageVersionList"]: + """List shared gallery image versions by subscription id or tenant id. + + :param location: Resource location. + :type location: str + :param gallery_unique_name: The unique name of the Shared Gallery. + :type gallery_unique_name: str + :param gallery_image_name: The name of the Shared Gallery Image Definition from which the Image + Versions are to be listed. + :type gallery_image_name: str + :param shared_to: The query parameter to decide what shared galleries to fetch when doing + listing operations. + :type shared_to: str or ~azure.mgmt.compute.v2022_01_03.models.SharedToValues + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SharedGalleryImageVersionList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2022_01_03.models.SharedGalleryImageVersionList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedGalleryImageVersionList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + location=location, + gallery_unique_name=gallery_unique_name, + gallery_image_name=gallery_image_name, + shared_to=shared_to, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + location=location, + gallery_unique_name=gallery_unique_name, + gallery_image_name=gallery_image_name, + shared_to=shared_to, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("SharedGalleryImageVersionList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}/images/{galleryImageName}/versions'} # type: ignore + + @distributed_trace + def get( + self, + location: str, + gallery_unique_name: str, + gallery_image_name: str, + gallery_image_version_name: str, + **kwargs: Any + ) -> "_models.SharedGalleryImageVersion": + """Get a shared gallery image version by subscription id or tenant id. + + :param location: Resource location. + :type location: str + :param gallery_unique_name: The unique name of the Shared Gallery. + :type gallery_unique_name: str + :param gallery_image_name: The name of the Shared Gallery Image Definition from which the Image + Versions are to be listed. + :type gallery_image_name: str + :param gallery_image_version_name: The name of the gallery image version to be created. Needs + to follow semantic version name pattern: The allowed characters are digit and period. Digits + must be within the range of a 32-bit integer. Format: + :code:``.:code:``.:code:``. + :type gallery_image_version_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SharedGalleryImageVersion, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2022_01_03.models.SharedGalleryImageVersion + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedGalleryImageVersion"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + location=location, + gallery_unique_name=gallery_unique_name, + gallery_image_name=gallery_image_name, + gallery_image_version_name=gallery_image_version_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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('SharedGalleryImageVersion', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore + diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/operations/_shared_gallery_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/operations/_shared_gallery_images_operations.py new file mode 100644 index 000000000000..e23a2d1f883d --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/operations/_shared_gallery_images_operations.py @@ -0,0 +1,261 @@ +# 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union +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 HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + location: str, + gallery_unique_name: str, + *, + shared_to: Optional[Union[str, "_models.SharedToValues"]] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-03" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}/images') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "location": _SERIALIZER.url("location", location, 'str'), + "galleryUniqueName": _SERIALIZER.url("gallery_unique_name", gallery_unique_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if shared_to is not None: + query_parameters['sharedTo'] = _SERIALIZER.query("shared_to", shared_to, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + location: str, + gallery_unique_name: str, + gallery_image_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-03" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}/images/{galleryImageName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "location": _SERIALIZER.url("location", location, 'str'), + "galleryUniqueName": _SERIALIZER.url("gallery_unique_name", gallery_unique_name, 'str'), + "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +class SharedGalleryImagesOperations(object): + """SharedGalleryImagesOperations 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.v2022_01_03.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 + + @distributed_trace + def list( + self, + location: str, + gallery_unique_name: str, + shared_to: Optional[Union[str, "_models.SharedToValues"]] = None, + **kwargs: Any + ) -> Iterable["_models.SharedGalleryImageList"]: + """List shared gallery images by subscription id or tenant id. + + :param location: Resource location. + :type location: str + :param gallery_unique_name: The unique name of the Shared Gallery. + :type gallery_unique_name: str + :param shared_to: The query parameter to decide what shared galleries to fetch when doing + listing operations. + :type shared_to: str or ~azure.mgmt.compute.v2022_01_03.models.SharedToValues + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SharedGalleryImageList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2022_01_03.models.SharedGalleryImageList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedGalleryImageList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + location=location, + gallery_unique_name=gallery_unique_name, + shared_to=shared_to, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + location=location, + gallery_unique_name=gallery_unique_name, + shared_to=shared_to, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("SharedGalleryImageList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}/images'} # type: ignore + + @distributed_trace + def get( + self, + location: str, + gallery_unique_name: str, + gallery_image_name: str, + **kwargs: Any + ) -> "_models.SharedGalleryImage": + """Get a shared gallery image by subscription id or tenant id. + + :param location: Resource location. + :type location: str + :param gallery_unique_name: The unique name of the Shared Gallery. + :type gallery_unique_name: str + :param gallery_image_name: The name of the Shared Gallery Image Definition from which the Image + Versions are to be listed. + :type gallery_image_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SharedGalleryImage, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2022_01_03.models.SharedGalleryImage + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedGalleryImage"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + location=location, + gallery_unique_name=gallery_unique_name, + gallery_image_name=gallery_image_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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('SharedGalleryImage', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}/images/{galleryImageName}'} # type: ignore + diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/py.typed b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file